diff options
author | Kevin Cox <kevincox@kevincox.ca> | 2022-03-22 08:10:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 08:10:01 -0400 |
commit | 954f445608833d7e6b17ea9332e473556a282a69 (patch) | |
tree | 881f9ba4e0072e256dabab0eec6658f14bea3ea9 /nixos/modules | |
parent | 6ca7a970172ac1044b1ccf6bf6f448df50ec39b4 (diff) | |
parent | 41d45d674a3460b4984c6e3917f7cf231d0ec386 (diff) | |
download | nixlib-954f445608833d7e6b17ea9332e473556a282a69.tar nixlib-954f445608833d7e6b17ea9332e473556a282a69.tar.gz nixlib-954f445608833d7e6b17ea9332e473556a282a69.tar.bz2 nixlib-954f445608833d7e6b17ea9332e473556a282a69.tar.lz nixlib-954f445608833d7e6b17ea9332e473556a282a69.tar.xz nixlib-954f445608833d7e6b17ea9332e473556a282a69.tar.zst nixlib-954f445608833d7e6b17ea9332e473556a282a69.zip |
Merge pull request #165252 from Luflosi/ipfs-hardening
nixos/ipfs: add systemd hardening
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/network-filesystems/ipfs.nix | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix index 17da020bf3e2..655785b99d87 100644 --- a/nixos/modules/services/network-filesystems/ipfs.nix +++ b/nixos/modules/services/network-filesystems/ipfs.nix @@ -239,7 +239,10 @@ in "d '${cfg.ipnsMountDir}' - ${cfg.user} ${cfg.group} - -" ]; - systemd.packages = [ cfg.package ]; + # The hardened systemd unit breaks the fuse-mount function according to documentation in the unit file itself + systemd.packages = if cfg.autoMount + then [ cfg.package.systemd_unit ] + else [ cfg.package.systemd_unit_hardened ]; systemd.services.ipfs = { path = [ "/run/wrappers" cfg.package ]; @@ -275,6 +278,8 @@ in ExecStart = [ "" "${cfg.package}/bin/ipfs daemon ${ipfsFlags}" ]; User = cfg.user; Group = cfg.group; + StateDirectory = ""; + ReadWritePaths = [ "" cfg.dataDir ]; } // optionalAttrs (cfg.serviceFdlimit != null) { LimitNOFILE = cfg.serviceFdlimit; }; } // optionalAttrs (!cfg.startWhenNeeded) { wantedBy = [ "default.target" ]; |