-
-
Save timothyklim/c481981ee13a2da206ea774d5f982645 to your computer and use it in GitHub Desktop.
An example secure systemd unit file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Some internet-facing service | |
After=network.target | |
[Service] | |
Type=simple | |
WorkingDirectory=... | |
EnvironmentFile=... | |
ExecStart=... | |
DynamicUser=true | |
PrivateDevices=true | |
ProtectHostname=true | |
ProtectKernelTunables=true | |
ProtectKernelModules=true | |
ProtectControlGroups=true | |
SystemCallArchitectures=native | |
LockPersonality=true | |
MemoryDenyWriteExecute=true | |
InaccessiblePaths=/dev /boot | |
RestrictRealtime=true | |
PrivateMounts=true | |
MountFlags=private | |
PrivateUsers=true | |
UMask=0777 | |
RestrictAddressFamilies=AF_INET AF_INET6 | |
RestrictNamespaces=yes | |
CapabilityBoundingSet= | |
AmbientCapabilities= | |
SystemCallFilter=@system-service | |
SystemCallFilter=~@privileged @resources | |
ProtectKernelLogs=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment