fix: get headscale and glauth starting up nicely again

main
LeRoyce Pearson 2024-01-10 00:48:59 -07:00
parent 922165b439
commit df1214e7d2
2 changed files with 11 additions and 5 deletions

View File

@ -199,8 +199,8 @@
{
datastore = "plugin";
plugin = "${pkgs.glauth-sqlite}/bin/sqlite.so";
pluginhandler = "NewSqliteHandler";
database = "/run/glauth/glauth.db";
pluginhandler = "NewSQLiteHandler";
database = "/var/lib/glauth/users.db";
}
];
api = {
@ -506,8 +506,8 @@
'';
virtualHosts."dex.samsehu.perli.casa".extraConfig = ''
@connected_via_tailscale remote_ip 100.64.0.0/10 fd7a:115c:a1e0::/48
handle @connected_via_tailscale {
@in_virtual_or_local_network remote_ip 100.64.0.0/10 fd7a:115c:a1e0::/48 private_ranges
handle @in_virtual_or_local_network {
reverse_proxy localhost:5556
}
respond 403

View File

@ -19,6 +19,11 @@ with lib;
package = mkPackageOption pkgs "glauth" { };
dataDir = mkOption {
type = types.path;
default = "/var/lib/glauth";
};
user = mkOption {
default = "glauth";
type = types.str;
@ -53,7 +58,7 @@ with lib;
users.users."${cfg.user}" = {
isSystemUser = true;
group = cfg.group;
home = "/var/empty";
home = cfg.dataDir;
};
users.groups."${cfg.group}" = {};
@ -67,6 +72,7 @@ with lib;
User = "${cfg.user}";
Group = "${cfg.group}";
ExecStart = ''${cfg.package}/bin/glauth -c ${settingsFormat.generate "glauth.cfg" cfg.settings}'';
StateDirectory = mkIf (cfg.dataDir == "/var/lib/glauth") [ "glauth" ];
};
};
};