Merge pull request 'ipfs: hardened ipfs config' (#13) from claudiomaradonna/dot-files:master into master

Reviewed-on: https://gitea.it/Unitoo/dot-files/pulls/13
This commit is contained in:
Claudio Maradonna 2022-04-24 11:19:14 +02:00
commit 9b3cf76244
1 changed files with 42 additions and 13 deletions

View File

@ -1,26 +1,55 @@
[Unit] [Unit]
Description=IPFS Daemon Description=IPFS Daemon
Documentation=https://docs.ipfs.io/
After=network.target After=network.target
[Service] [Service]
#Runtime # hardening
Environment="IPFS_PATH=/mnt/ipfs" ReadWritePaths=/home/ipfs /mnt/ipfs
Environment=IPFS_LOGGING="error" NoNewPrivileges=true
ExecStart=/home/ipfs/.local/bin/ipfs daemon --enable-gc --migrate ProtectSystem=strict
User=ipfs ProtectKernelTunables=true
Restart=on-failure ProtectKernelModules=true
RestartSec=10s ProtectKernelLogs=true
KillSignal=SIGINT PrivateDevices=true
DevicePolicy=closed
ProtectControlGroups=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
ProtectHostname=true
PrivateTmp=true
ProtectClock=true
LockPersonality=true
RestrictNamespaces=true
RestrictRealtime=true
MemoryDenyWriteExecute=true
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged
#ProtectHome=true
RemoveIPC=true
RestrictSUIDSGID=true
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#Accounting LimitNOFILE=8192
LimitNOFILE=10240
#LimitNice=10 #LimitNice=10
MemoryAccounting=true MemoryAccounting=true
MemoryHigh=512M MemoryHigh=768M
MemoryMax=768M MemoryMax=1024M
MemorySwapMax=512M MemorySwapMax=0
CPUAccounting=true CPUAccounting=true
CPUQuota=40% CPUQuota=40%
TimeoutStartSec=infinity
Type=notify
Environment="IPFS_PATH=/mnt/ipfs"
Environment=IPFS_LOGGING="error"
Environment=IPFS_FD_MAX=8192
ExecStart=/home/ipfs/.local/bin/ipfs daemon --init --enable-gc --migrate
User=ipfs
Group=ipfs
StateDirectory=ipfs
Restart=on-failure
KillSignal=SIGINT
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target