custom certificates + ssl module to deploy it. headscale module using self-signed certificate. sops-nix secrets to deploy certificate keys. random file are also sorted.
This commit is contained in:
parent
081d1fa6e1
commit
5824942904
17 changed files with 171 additions and 54 deletions
51
modules/headscale/default.nix
Normal file
51
modules/headscale/default.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
# core service definition
|
||||
services.headscale = {
|
||||
enable = true;
|
||||
address = "0.0.0.0";
|
||||
port = 443;
|
||||
settings = {
|
||||
server_url = "https://niczos.loc:443";
|
||||
log.level = "info";
|
||||
dns.base_domain = "loc.niczos";
|
||||
dns.magic_dns = false;
|
||||
dns.override_local_dns = false;
|
||||
tls_cert_path = "/etc/ssl/certs/headscale/main.crt";
|
||||
tls_key_path = "/etc/ssl/keys/headscale/main.pem";
|
||||
};
|
||||
};
|
||||
|
||||
# Firewall configuration
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
8080
|
||||
50443
|
||||
];
|
||||
allowedUDPPorts = [
|
||||
3478
|
||||
];
|
||||
};
|
||||
|
||||
# Certificates and keys
|
||||
imports = [
|
||||
/etc/nixos/modules/ssl.nix
|
||||
];
|
||||
environment.etc."ssl/certs/headscale/main.crt" = {
|
||||
source = "/etc/nixos/modules/headscale/certs/main.crt";
|
||||
user = "headscale";
|
||||
mode = "0600";
|
||||
};
|
||||
sops.secrets.main = {
|
||||
sopsFile = "/etc/nixos/modules/headscale/keys/main.yaml";
|
||||
mode = "0060";
|
||||
owner = "nobody";
|
||||
group = "headscale";
|
||||
path = "/etc/ssl/keys/headscale/main.pem";
|
||||
};
|
||||
|
||||
networking.hosts = {
|
||||
"127.0.0.1" = [ "niczos.loc" ];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue