headscale
This commit is contained in:
parent
26b5a32ab1
commit
3daa817aad
6 changed files with 120 additions and 38 deletions
|
|
@ -1,51 +1,52 @@
|
|||
{ ... }:
|
||||
{
|
||||
networking.networkmanager.enable = true;
|
||||
networking.networkmanager.wifi.macAddress = "random";
|
||||
|
||||
hardware.bluetooth.enable = true;
|
||||
services.blueman.enable = true;
|
||||
systemd.services.NetworkManager-wait-online.enable = false;
|
||||
|
||||
services.tailscale = {
|
||||
enable = true;
|
||||
useRoutingFeatures = "client";
|
||||
};
|
||||
|
||||
systemd.services.NetworkManager-wait-online.enable = false;
|
||||
|
||||
networking.networkmanager.ensureProfiles.profiles = {
|
||||
"tuda-vpn" = {
|
||||
connection = {
|
||||
autoconnect = "false";
|
||||
id = "tuda-vpn";
|
||||
type = "vpn";
|
||||
};
|
||||
ipv4 = {
|
||||
method = "auto";
|
||||
};
|
||||
ipv6 = {
|
||||
addr-gen-mode = "stable-privacy";
|
||||
method = "auto";
|
||||
};
|
||||
vpn = {
|
||||
authtype = "password";
|
||||
autoconnect-flags = "0";
|
||||
certsigs-flags = "0";
|
||||
cookie-flags = "2";
|
||||
disable_udp = "no";
|
||||
enable_csd_trojan = "no";
|
||||
gateway = "vpn.hrz.tu-darmstadt.de";
|
||||
gateway-flags = "2";
|
||||
gwcert-flags = "2";
|
||||
lasthost-flags = "0";
|
||||
pem_passphrase_fsid = "no";
|
||||
prevent_invalid_cert = "no";
|
||||
protocol = "anyconnect";
|
||||
resolve-flags = "2";
|
||||
service-type = "org.freedesktop.NetworkManager.openconnect";
|
||||
stoken_source = "disabled";
|
||||
xmlconfig-flags = "0";
|
||||
password-flags = 0;
|
||||
networking = {
|
||||
enableIPv6 = true;
|
||||
networkmanager.enable = true;
|
||||
networkmanager.wifi.macAddress = "random";
|
||||
networkmanager.ensureProfiles.profiles = {
|
||||
"tuda-vpn" = {
|
||||
connection = {
|
||||
autoconnect = "false";
|
||||
id = "tuda-vpn";
|
||||
type = "vpn";
|
||||
};
|
||||
ipv4 = {
|
||||
method = "auto";
|
||||
};
|
||||
ipv6 = {
|
||||
addr-gen-mode = "stable-privacy";
|
||||
method = "auto";
|
||||
};
|
||||
vpn = {
|
||||
authtype = "password";
|
||||
autoconnect-flags = "0";
|
||||
certsigs-flags = "0";
|
||||
cookie-flags = "2";
|
||||
disable_udp = "no";
|
||||
enable_csd_trojan = "no";
|
||||
gateway = "vpn.hrz.tu-darmstadt.de";
|
||||
gateway-flags = "2";
|
||||
gwcert-flags = "2";
|
||||
lasthost-flags = "0";
|
||||
pem_passphrase_fsid = "no";
|
||||
prevent_invalid_cert = "no";
|
||||
protocol = "anyconnect";
|
||||
resolve-flags = "2";
|
||||
service-type = "org.freedesktop.NetworkManager.openconnect";
|
||||
stoken_source = "disabled";
|
||||
xmlconfig-flags = "0";
|
||||
password-flags = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
8
mod/server/all.nix
Normal file
8
mod/server/all.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{ mod, ... }:
|
||||
{
|
||||
imports = with mod.server; [
|
||||
services
|
||||
networking
|
||||
security
|
||||
];
|
||||
}
|
||||
28
mod/server/networking.nix
Normal file
28
mod/server/networking.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ ... }:
|
||||
{
|
||||
networking = {
|
||||
enableIPv6 = true;
|
||||
|
||||
interfaces = {
|
||||
"ens3".ipv6.addresses = [
|
||||
{
|
||||
address = "2a03:4000:3b:f99::";
|
||||
prefixLength = 64;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
defaultGateway6 = {
|
||||
address = "fe80::1";
|
||||
interface = "ens3";
|
||||
};
|
||||
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
9
mod/server/security.nix
Normal file
9
mod/server/security.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
{
|
||||
security = {
|
||||
acme = {
|
||||
acceptTerms = true;
|
||||
defaults.email = "acme@henri-dohmen.de";
|
||||
};
|
||||
};
|
||||
}
|
||||
35
mod/server/services.nix
Normal file
35
mod/server/services.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{ config, ... }:
|
||||
let
|
||||
headscale-domain = "headscale.hdohmen.de";
|
||||
in
|
||||
{
|
||||
services = {
|
||||
# TODO: maybe just use wireguard...
|
||||
headscale = {
|
||||
enable = true;
|
||||
address = "127.0.0.1";
|
||||
port = 8080;
|
||||
settings = {
|
||||
server_url = "https://${headscale-domain}";
|
||||
prefixes.v4 = "100.10.11.0/24";
|
||||
prefixes.v6 = "fd7a:115c:1011::/48";
|
||||
dns = {
|
||||
magic_dns = true;
|
||||
base_domain = "net.hdohmen.de";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nginx = {
|
||||
enable = true;
|
||||
virtualHosts.${headscale-domain} = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:${toString config.services.headscale.port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue