Use IPAddress{Allow,Deny} by default for systemd services

This commit is contained in:
Jonas Nick
2019-04-28 13:15:17 +00:00
parent d9533edad1
commit eaaf8e9aab
12 changed files with 79 additions and 22 deletions
+19 -1
View File
@@ -1,3 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
let
defaultHardening = {
PrivateTmp = "true";
@@ -11,12 +15,26 @@ let
ProtectControlGroups = "true";
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
LockPersonality = "true";
IPAddressDeny = "any";
};
in
{
inherit defaultHardening;
# node applications apparently rely on memory write execute
nodeHardening = defaultHardening // { MemoryDenyWriteExecute = "false"; };
node = { MemoryDenyWriteExecute = "false"; };
# Allow tor traffic. Allow takes precedence over Deny.
allowTor = { IPAddressAllow = "127.0.0.1/32"; };
# Allow any traffic
allowAnyIP = { IPAddressAllow = "any"; };
enforceTor = mkOption {
type = types.bool;
default = false;
description = ''
"Whether to force Tor on a service by only allowing connections from and
to 127.0.0.1;";
'';
};
}