Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance systemd security #407

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Enhance systemd security #407

wants to merge 2 commits into from

Conversation

hykilpikonna
Copy link

It's a very bad practice to run an exposed networking service as root, and rathole shouldn't recommend doing that. Here are some changes to enhance security:

  • DynamicUser=yes – Run the binary in its own minimal-privilege user.
  • NoNewPrivileges=yes – Prevents privilege escalation.
  • PrivateTmp=yes – Isolates /tmp and /var/tmp to prevent interference.
  • PrivateDevices=yes and DevicePolicy=closed – Restricts access to device files.
  • ProtectSystem=strict – Makes the filesystem read-only except for essential directories.
  • ProtectHome=read-only – Prevents modification of user home directories.
  • ProtectControlGroups=yes, ProtectKernelModules=yes, ProtectKernelTunables=yes – Restricts access to kernel-related settings.
  • RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK – Limits allowed network families.
  • RestrictNamespaces=yes – Disables namespace usage to prevent container escape vulnerabilities.
  • RestrictRealtime=yes and RestrictSUIDSGID=yes – Prevents real-time scheduling abuse and SUID/SGID privilege escalation.
  • LockPersonality=yes – Prevents personality changes to avoid exploits.
  • AmbientCapabilities=CAP_NET_BIND_SERVICE – Allow binding to lower port numbers (e.g. 80)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant