Skip to content

Commit

Permalink
Hardening systemd pcscd.service file
Browse files Browse the repository at this point in the history
See https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html

The exposure level was:
$ systemd-analyze security pcscd.service
[...]
→ Overall exposure level for pcscd.service: 9.6 UNSAFE 😨

And we now have:
$ systemd-analyze security pcscd.service
[...]
→ Overall exposure level for pcscd.service: 2.1 OK 🙂

Thanks to David Fields for the initial patch
"systemd service hardening for pcscd"
LudovicRousseau/PCSC#207
  • Loading branch information
LudovicRousseau committed Feb 4, 2025
1 parent f0f4fa1 commit abcfeae
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions etc/pcscd.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,39 @@ ExecStart=@sbindir_exp@/pcscd --foreground --auto-exit $PCSCD_ARGS
ExecReload=@sbindir_exp@/pcscd --hotplug
EnvironmentFile=-@sysconfdir@/default/pcscd

# Paths
ProtectProc=invisible

# Capabilities
CapabilityBoundingSet=

# Security
NoNewPrivileges=yes

# Process Properties
UMask=0077

# Sandboxing
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectHostname=yes
ProtectClock=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectControlGroups=yes
RestrictNamespaces=yes
LockPersonality=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes

# System Call Filtering
SystemCallFilter=@system-service
SystemCallFilter=~@resources @privileged
SystemCallArchitectures=native

[Install]
Also=pcscd.socket

0 comments on commit abcfeae

Please sign in to comment.