2021-04-12 18:23:04 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.doh-proxy-rust;
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
|
|
|
options.services.doh-proxy-rust = {
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "doh-proxy-rust");
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
flags = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
2021-10-06 13:57:05 +00:00
|
|
|
example = [ "--server-address=9.9.9.9:53" ];
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2021-04-12 18:23:04 +00:00
|
|
|
A list of command-line flags to pass to doh-proxy. For details on the
|
2022-08-12 12:06:08 +00:00
|
|
|
available options, see <https://github.com/jedisct1/doh-server#usage>.
|
2021-04-12 18:23:04 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.doh-proxy-rust = {
|
|
|
|
description = "doh-proxy-rust";
|
|
|
|
after = [ "network.target" "nss-lookup.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.doh-proxy-rust}/bin/doh-proxy ${escapeShellArgs cfg.flags}";
|
|
|
|
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" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = with maintainers; [ stephank ];
|
|
|
|
|
|
|
|
}
|