-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5885344
commit 07334a3
Showing
14 changed files
with
100 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
_: { | ||
imports = [ | ||
./cloudflared | ||
./dns | ||
./nginx | ||
./tailscale | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
modules/base/common/services/networking/tailscale/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
lib, | ||
config, | ||
pkgs, | ||
... | ||
}: let | ||
inherit (config.services.tailscale) interfaceName port; | ||
inherit (lib) mkIf optionals; | ||
|
||
cfg = config.modules.services.networking.tailscale; | ||
in { | ||
config = mkIf cfg.enable { | ||
environment.systemPackages = with pkgs; [tailscale]; | ||
|
||
networking.firewall = { | ||
trustedInterfaces = [interfaceName]; | ||
allowedUDPPorts = [port]; | ||
checkReversePath = "loose"; | ||
}; | ||
|
||
boot.kernel.sysctl = mkIf (cfg.runMode == "server") { | ||
# https://tailscale.com/kb/1103/exit-nodes/#enable-ip-forwarding | ||
"net.ipv4.ip_forward" = true; | ||
"net.ipv6.conf.all.forwarding" = true; | ||
}; | ||
|
||
services.tailscale = { | ||
enable = true; | ||
useRoutingFeatures = cfg.runMode; | ||
extraUpFlags = | ||
[ | ||
"--ssh" | ||
] | ||
++ optionals (cfg.runMode == "server") [ | ||
"--advertise-exit-node" | ||
]; | ||
permitCertUid = mkIf (cfg.runMode != "server") "root"; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters