systemd-user.service 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # tested with systemd=252.31-1~deb12u1+rpi1 on raspberry pi os 12/bookworm
  2. # 1. copy to ~/.config/systemd/user/systemctl-mqtt.service
  3. # 2. edit parameters in ExecStart
  4. # 3. systemctl --user daemon-reload
  5. # 4. systemctl --user restart systemctl-mqtt.service
  6. # 5. sudo loginctl enable-linger $USER
  7. # 6. systemctl --user enable systemctl-mqtt.service
  8. [Unit]
  9. Documentation=https://github.com/fphammerle/systemctl-mqtt
  10. [Service]
  11. KeyringMode=private
  12. # > Failed to update dynamic user credentials: Permission denied
  13. DynamicUser=no
  14. # > Failed at step CAPABILITIES spawning …: Operation not permitted
  15. #CapabilityBoundingSet=
  16. NoNewPrivileges=yes
  17. # > Failed at step CAPABILITIES spawning …: Operation not permitted
  18. PrivateDevices=no
  19. # > Failed at step CAPABILITIES spawning …: Operation not permitted
  20. ProtectClock=no
  21. # > Failed at step CAPABILITIES spawning …: Operation not permitted
  22. ProtectKernelLogs=no
  23. ProtectControlGroups=yes
  24. # > Failed at step CAPABILITIES spawning …: Operation not permitted
  25. ProtectKernelModules=no
  26. SystemCallArchitectures=native
  27. MemoryDenyWriteExecute=yes
  28. RestrictNamespaces=~user pid net uts mnt ipc cgroup
  29. RestrictSUIDSGID=yes
  30. # > ProtectHostname=yes is configured, but UTS namespace setup is prohibited
  31. # . (container manager?), ignoring namespace setup.
  32. ProtectHostname=no
  33. LockPersonality=yes
  34. ProtectKernelTunables=yes
  35. RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
  36. RestrictRealtime=yes
  37. # ineffective?
  38. DeviceAllow=
  39. ProtectSystem=strict
  40. ProtectProc=invisible
  41. ProcSubset=pid
  42. # ineffective
  43. ProtectHome=yes
  44. PrivateNetwork=no
  45. PrivateUsers=no
  46. PrivateTmp=yes
  47. SystemCallFilter=~@clock @swap @resources @reboot @raw-io @privileged \
  48. @obsolete @mount @module @debug @cpu-emulation
  49. # ineffective
  50. #IPAddressAllow=
  51. #IPAddressDeny=any
  52. UMask=0077
  53. #ExecStartPre=/usr/lib/systemd/systemd-networkd-wait-online
  54. Type=exec
  55. ExecStart=%h/.local/bin/systemctl-mqtt --mqtt-host localhost --log-level debug
  56. [Install]
  57. WantedBy=default.target