Skip to content

Commit

Permalink
dist: Set ProtectClock, RestrictAddressFamilies and CapabilityBoundin…
Browse files Browse the repository at this point in the history
…gSet

This increases the isolation of Maddy service. Maddy capabilities can be
bound to only CAP_NET_BIND_SERVICE. This also restricts the service to
only use Unix sockets, IPv4 and IPv6.
  • Loading branch information
erdnaxe authored and foxcpp committed Aug 27, 2021
1 parent c0845fb commit 34a8c68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dist/systemd/maddy.service
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ ProtectHome=true
ProtectSystem=strict
ProtectKernelTunables=true
ProtectHostname=true
ProtectClock=true
ProtectControlGroups=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6

# Additional sandboxing. You need to disable all of these options
# for privileged helper binaries (for system auth) to work correctly.
Expand All @@ -50,6 +52,7 @@ KillSignal=SIGTERM

# Required to bind on ports lower than 1024.
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE

# Force all files created by maddy to be only readable by it.
UMask=0027
Expand Down
3 changes: 3 additions & 0 deletions dist/systemd/maddy@.service
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ PrivateHome=true
ProtectSystem=strict
ProtectKernelTunables=true
ProtectHostname=true
ProtectClock=true
ProtectControlGroups=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
DeviceAllow=/dev/syslog

# Additional sandboxing. You need to disable all of these options
Expand All @@ -46,6 +48,7 @@ KillSignal=SIGTERM

# Required to bind on ports lower than 1024.
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE

# Force all files created by maddy to be only readable by it.
UMask=0027
Expand Down

0 comments on commit 34a8c68

Please sign in to comment.