update from celebrian

This commit is contained in:
Adrian Gunnar Lauterer 2023-12-06 22:21:44 +01:00
parent 5b8b8ae3ec
commit 24e4ce6c41
5 changed files with 83 additions and 56 deletions

View File

@ -8,6 +8,7 @@
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
../../profiles/base.nix ../../profiles/base.nix
../../services/ssh.nix ../../services/ssh.nix
../../services/nginx.nix
]; ];
@ -100,31 +101,31 @@
#vpn stuff #vpn stuff
#need to run at fresh install to create namespace: headscale namespaces create <namespace_name> # #need to run at fresh install to create namespace: headscale namespaces create <namespace_name>
services.headscale = { # services.headscale = {
enable = true; # enable = true;
user = "headscale"; # user = "headscale";
address = "127.0.0.1"; # address = "127.0.0.1";
port = 8080; # port = 8080;
settings = { # settings = {
logtail.enabled = false; # logtail.enabled = false;
metrics_listen_addr = "127.0.0.1:9090"; # metrics_listen_addr = "127.0.0.1:9090";
server_url = "https://${"vpn."+config.networking.domain}"; # server_url = "https://${"vpn."+config.networking.domain}";
dns_config = { # dns_config = {
base_domain = "${config.networking.domain}"; # base_domain = "${config.networking.domain}";
magic_dns = true; # magic_dns = true;
nameservers = [ # nameservers = [
"1.1.1.1" # "1.1.1.1"
]; # ];
}; # };
#
##should really implement with fex github and kanidm # ##should really implement with fex github and kanidm
#oidc = { # #oidc = {
# issuer = "{config.services.kanidm.serverSettings.origin}"; # # issuer = "{config.services.kanidm.serverSettings.origin}";
# allowed_domains = Domains; # # allowed_domains = Domains;
#}; # #};
}; # };
}; # };
#tailscale #tailscale
services.tailscale.enable = true; services.tailscale.enable = true;
@ -157,9 +158,9 @@ users.users."gunalx".openssh.authorizedKeys.keys = [
checkReversePath = "loose"; checkReversePath = "loose";
trustedInterfaces = [ "tailscale0" ]; trustedInterfaces = [ "tailscale0" ];
allowedUDPPorts = [ allowedUDPPorts = [
8096
80 80
443 443
6969
#config.services.openssh.ports #config.services.openssh.ports
config.services.tailscale.port config.services.tailscale.port
config.services.headscale.port config.services.headscale.port

View File

@ -3,7 +3,7 @@
imports = imports =
[ [
../packages/vim.nix ../packages/vim.nix
#./sops.nix ./sops.nix
]; ];
#nix stuff #nix stuff

View File

@ -10,7 +10,8 @@
# This will add secrets.yml to the nix store # This will add secrets.yml to the nix store
# You can avoid this by adding a string to the full path instead, i.e. # You can avoid this by adding a string to the full path instead, i.e.
# sops.defaultSopsFile = "/root/.sops/secrets/example.yaml"; # sops.defaultSopsFile = "/root/.sops/secrets/example.yaml";
sops.defaultSopsFile = ../secrets/secrets.yaml; sops.defaultSopsFile = "/etc/nixos/nix-dotfiles/secrets/secrets.yaml";
sops.validateSopsFiles = false;
# This will automatically import SSH keys as age keys # This will automatically import SSH keys as age keys
sops.age.sshKeyPaths = [ sops.age.sshKeyPaths = [
"/etc/ssh/nixos" "/etc/ssh/nixos"
@ -24,6 +25,6 @@
# This is the actual specification of the secrets. # This is the actual specification of the secrets.
#sops.secrets."myservice/my_subdir/my_secret" = {}; #sops.secrets."myservice/my_subdir/my_secret" = {};
sops.secrets."acme/certs/domeneshop" = { }; sops.secrets."acme/certs" = { };
} }

View File

@ -1,9 +1,9 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
basicAuthUser = "guest"; basicAuthUser = "guest";
basicAuthPass = "12345678"; basicAuthPass = "";
in in
{ {
#acme and certs helpful blog https://carjorvaz.com/posts/ #acme and certs helpful blog https://carjorvaz.com/posts/
security.acme = { security.acme = {
@ -15,7 +15,7 @@ in
extraDomainNames = [ "*.${config.networking.domain}" "lauterer.it" "*.lauterer.it" "*.256.no" "*.256.no"]; extraDomainNames = [ "*.${config.networking.domain}" "lauterer.it" "*.lauterer.it" "*.256.no" "*.256.no"];
dnsProvider = "domeneshop"; # from here according to privider https://go-acme.github.io/lego/dns/ dnsProvider = "domeneshop"; # from here according to privider https://go-acme.github.io/lego/dns/
dnsPropagationCheck = true; dnsPropagationCheck = true;
credentialsFile = config.sops.secrets."acme/certs/domeneshop".path; #need to manually create this file according to dnsprovider secrets, and format of key according to lego in privider and add to secrets.yaml credentialsFile = config.sops.secrets."acme/certs".path; #need to manually create this file according to dnsprovider secrets, and format of key according to lego in privider and add to secrets.yaml
}; };
}; };
@ -39,37 +39,62 @@ in
recommendedGzipSettings = true; recommendedGzipSettings = true;
recommendedOptimisation = true; recommendedOptimisation = true;
virtualHosts.${"vpn."+config.networking.domain} = {
virtualHosts.${"managment.funn-nas.lauterer.it"} = {
forceSSL = true; forceSSL = true;
useACMEHost = "${config.networking.domain}"; useACMEHost = "${config.networking.domain}";
locations."/" = { locations."/" = {
proxyWebsockets = true; proxyWebsockets = true;
proxyPass = "http://localhost:${toString config.services.headscale.port}"; proxyPass = "http://100.104.182.48";
};
basicAuth = {
guest = basicAuthPass;
}; };
}; };
virtualHosts.${config.services.kanidm.serverSettings.domain} = { # (auth.) virtualHosts.${"funn-nas.lauterer.it"} = {
forceSSL = true; forceSSL = true;
useACMEHost = "${config.networking.domain}"; useACMEHost = "${config.networking.domain}";
locations."/" = { locations."/" = {
proxyWebsockets = true; proxyWebsockets = true;
proxyPass = "${"https://"+config.services.kanidm.serverSettings.bindaddress}"; proxyPass = "https://100.104.182.48:30044";
};
basicAuth = {
guest = basicAuthPass;
}; };
}; };
virtualHosts.${"jellyfin."+config.networking.domain} = { # virtualHosts.${"vpn."+config.networking.domain} = {
forceSSL = true; # forceSSL = true;
#enableACME = true; # useACMEHost = "${config.networking.domain}";
useACMEHost = "${config.networking.domain}"; # locations."/" = {
locations."/" = { # proxyWebsockets = true;
proxyPass = "http://jellyfin.galadriel"; # proxyPass = "http://localhost:${toString config.services.headscale.port}";
proxyWebsockets = true; # };
basicAuth = { # };
guest = basicAuthPass;
}; # virtualHosts.${config.services.kanidm.serverSettings.domain} = { # (auth.)
}; # forceSSL = true;
}; # useACMEHost = "${config.networking.domain}";
# locations."/" = {
# proxyWebsockets = true;
# proxyPass = "${"https://"+config.services.kanidm.serverSettings.bindaddress}";
# };
# };
# virtualHosts.${"jellyfin."+config.networking.domain} = {
# forceSSL = true;
# #enableACME = true;
# useACMEHost = "${config.networking.domain}";
# locations."/" = {
# proxyPass = "http://jellyfin.galadriel";
# proxyWebsockets = true;
# basicAuth = {
# guest = basicAuthPass;
# };
# };
# };
}; };

View File

@ -13,13 +13,13 @@
startWhenNeeded = true; startWhenNeeded = true;
ports = [ 6969 ]; ports = [ 6969 ];
openFirewall = true; openFirewall = true;
settings.Ciphers = [ #settings.Ciphers = [
"chacha20-poly1305@openssh.com" # "chacha20-poly1305@openssh.com"
"aes256-gcm@openssh.com" # "aes256-gcm@openssh.com"
"aes128-gcm@openssh.com" # "aes128-gcm@openssh.com"
"aes256-ctr" # "aes256-ctr"
# remove some weaker ciphers # # remove some weaker ciphers
]; #];
}; };
services.endlessh = { services.endlessh = {
enable = true; enable = true;