forked from mirrors/nixpkgs
chrony: update sandboxing options
This commit is contained in:
parent
6ae49bc107
commit
b943fb24b7
|
@ -339,6 +339,13 @@
|
||||||
And backup your data.
|
And backup your data.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
<literal>services.chronyd</literal> is now started with
|
||||||
|
additional systemd sandbox/hardening options for better
|
||||||
|
security.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The module <literal>services.headscale</literal> was
|
The module <literal>services.headscale</literal> was
|
||||||
|
|
|
@ -94,6 +94,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||||
|
|
||||||
And backup your data.
|
And backup your data.
|
||||||
|
|
||||||
|
- `services.chronyd` is now started with additional systemd sandbox/hardening options for better security.
|
||||||
|
|
||||||
- The module `services.headscale` was refactored to be compliant with [RFC 0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md). To be precise, this means that the following things have changed:
|
- The module `services.headscale` was refactored to be compliant with [RFC 0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md). To be precise, this means that the following things have changed:
|
||||||
|
|
||||||
- Most settings has been migrated under [services.headscale.settings](#opt-services.headscale.settings) which is an attribute-set that
|
- Most settings has been migrated under [services.headscale.settings](#opt-services.headscale.settings) which is an attribute-set that
|
||||||
|
|
|
@ -147,9 +147,9 @@ in
|
||||||
systemd.services.systemd-timedated.environment = { SYSTEMD_TIMEDATED_NTP_SERVICES = "chronyd.service"; };
|
systemd.services.systemd-timedated.environment = { SYSTEMD_TIMEDATED_NTP_SERVICES = "chronyd.service"; };
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d ${stateDir} 0755 chrony chrony - -"
|
"d ${stateDir} 0750 chrony chrony - -"
|
||||||
"f ${driftFile} 0640 chrony chrony -"
|
"f ${driftFile} 0640 chrony chrony - -"
|
||||||
"f ${keyFile} 0640 chrony chrony -"
|
"f ${keyFile} 0640 chrony chrony - -"
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.chronyd =
|
systemd.services.chronyd =
|
||||||
|
@ -164,15 +164,47 @@ in
|
||||||
path = [ chronyPkg ];
|
path = [ chronyPkg ];
|
||||||
|
|
||||||
unitConfig.ConditionCapability = "CAP_SYS_TIME";
|
unitConfig.ConditionCapability = "CAP_SYS_TIME";
|
||||||
serviceConfig =
|
serviceConfig = {
|
||||||
{ Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = "${chronyPkg}/bin/chronyd ${builtins.toString chronyFlags}";
|
ExecStart = "${chronyPkg}/bin/chronyd ${builtins.toString chronyFlags}";
|
||||||
|
|
||||||
ProtectHome = "yes";
|
# Proc filesystem
|
||||||
|
ProcSubset = "pid";
|
||||||
|
ProtectProc = "invisible";
|
||||||
|
# Access write directories
|
||||||
|
ReadWritePaths = [ "${stateDir}" ];
|
||||||
|
UMask = "0027";
|
||||||
|
# Capabilities
|
||||||
|
CapabilityBoundingSet = [ "CAP_CHOWN" "CAP_DAC_OVERRIDE" "CAP_NET_BIND_SERVICE" "CAP_SETGID" "CAP_SETUID" "CAP_SYS_RESOURCE" "CAP_SYS_TIME" ];
|
||||||
|
# Device Access
|
||||||
|
DeviceAllow = [ "char-pps rw" "char-ptp rw" "char-rtc rw" ];
|
||||||
|
DevicePolicy = "closed";
|
||||||
|
# Security
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
# Sandboxing
|
||||||
ProtectSystem = "full";
|
ProtectSystem = "full";
|
||||||
PrivateTmp = "yes";
|
ProtectHome = true;
|
||||||
|
PrivateTmp = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
PrivateUsers = false;
|
||||||
|
ProtectHostname = true;
|
||||||
|
ProtectClock = false;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
|
||||||
|
RestrictNamespaces = true;
|
||||||
|
LockPersonality = true;
|
||||||
|
MemoryDenyWriteExecute = true;
|
||||||
|
RestrictRealtime = true;
|
||||||
|
RestrictSUIDSGID = true;
|
||||||
|
RemoveIPC = true;
|
||||||
|
PrivateMounts = true;
|
||||||
|
# System Call Filtering
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
SystemCallFilter = [ "~@cpu-emulation @debug @keyring @mount @obsolete @privileged @resources" "@clock" "@setuid" "capset" "chown" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue