Add authkey to tailscale module

This commit is contained in:
Jordan Holt 2024-05-17 23:12:51 +01:00
parent 92c3bd3a13
commit 93c04e83d3
Signed by: jordan
GPG Key ID: B8CFFF61F1CCF520

View File

@ -1,6 +1,9 @@
{ config, lib, pkgs, ... }:
{ config, inputs, lib, pkgs, ... }:
let cfg = config.modules.networking.tailscale;
let
cfg = config.modules.networking.tailscale;
headscale = "https://headscale.vimium.net";
hostname = config.networking.hostName;
in {
options.modules.networking.tailscale = {
enable = lib.mkOption {
@ -14,8 +17,24 @@ in {
};
config = lib.mkIf cfg.enable {
services.tailscale.enable = true;
age.secrets."passwords/services/tailscale/${hostname}-authkey" = {
file = "${inputs.secrets}/passwords/services/tailscale/${hostname}-authkey.age";
};
environment.systemPackages = [ pkgs.tailscale ];
services.tailscale = {
enable = true;
authKeyFile = config.age.secrets."passwords/services/tailscale/${hostname}-authkey".path;
extraUpFlags = [
"--login-server"
headscale
];
};
services.openssh.openFirewall = !cfg.restrictSSH;
networking.firewall = {
checkReversePath = "loose";
trustedInterfaces = [ "tailscale0" ];