2020-08-18 08:36:13 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.doh-proxy-rust;
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
|
|
|
|
options.services.doh-proxy-rust = {
|
|
|
|
|
2024-08-28 21:19:06 +02:00
|
|
|
enable = lib.mkEnableOption "doh-proxy-rust";
|
2020-08-18 08:36:13 +02:00
|
|
|
|
2024-08-28 21:19:06 +02:00
|
|
|
flags = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
2020-08-18 08:36:13 +02:00
|
|
|
default = [ ];
|
2021-10-03 18:06:03 +02:00
|
|
|
example = [ "--server-address=9.9.9.9:53" ];
|
2020-08-18 08:36:13 +02:00
|
|
|
description = ''
|
|
|
|
A list of command-line flags to pass to doh-proxy. For details on the
|
|
|
|
available options, see <https://github.com/jedisct1/doh-server#usage>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2024-08-28 21:19:06 +02:00
|
|
|
config = lib.mkIf cfg.enable {
|
2020-08-18 08:36:13 +02:00
|
|
|
systemd.services.doh-proxy-rust = {
|
|
|
|
description = "doh-proxy-rust";
|
|
|
|
after = [
|
|
|
|
"network.target"
|
|
|
|
"nss-lookup.target"
|
|
|
|
];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
2024-08-28 21:19:06 +02:00
|
|
|
ExecStart = "${pkgs.doh-proxy-rust}/bin/doh-proxy ${lib.escapeShellArgs cfg.flags}";
|
2020-08-18 08:36:13 +02:00
|
|
|
Restart = "always";
|
|
|
|
RestartSec = 10;
|
|
|
|
DynamicUser = true;
|
|
|
|
|
|
|
|
CapabilityBoundingSet = "";
|
|
|
|
LockPersonality = true;
|
|
|
|
MemoryDenyWriteExecute = true;
|
|
|
|
NoNewPrivileges = true;
|
|
|
|
ProtectClock = true;
|
|
|
|
ProtectHome = true;
|
|
|
|
ProtectHostname = true;
|
|
|
|
ProtectKernelLogs = true;
|
|
|
|
RemoveIPC = true;
|
|
|
|
RestrictAddressFamilies = "AF_INET AF_INET6";
|
|
|
|
RestrictNamespaces = true;
|
|
|
|
RestrictRealtime = true;
|
|
|
|
RestrictSUIDSGID = true;
|
|
|
|
SystemCallArchitectures = "native";
|
|
|
|
SystemCallErrorNumber = "EPERM";
|
|
|
|
SystemCallFilter = [
|
|
|
|
"@system-service"
|
|
|
|
"~@privileged @resources"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-28 21:19:06 +02:00
|
|
|
meta.maintainers = with lib.maintainers; [ stephank ];
|
2020-08-18 08:36:13 +02:00
|
|
|
|
|
|
|
}
|