mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Set security options for the example signal-cli-socket systemd unit (#852)
* Restrict socket access to root and users in the signal-cli group * Sandbox signal-cli-socket service using systemd features * Add RemoveIPC too. * Restore original placeholder for ExecStart path.
This commit is contained in:
parent
69ea12b956
commit
9af3e2ca90
2 changed files with 35 additions and 2 deletions
|
@ -5,15 +5,43 @@ After=network-online.target
|
||||||
Requires=signal-cli-socket.socket
|
Requires=signal-cli-socket.socket
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
CapabilityBoundingSet=
|
||||||
Environment="SIGNAL_CLI_OPTS=-Xms2m"
|
Environment="SIGNAL_CLI_OPTS=-Xms2m"
|
||||||
|
# Update 'ReadWritePaths' if you change the config path here
|
||||||
ExecStart=%dir%/bin/signal-cli --config /var/lib/signal-cli daemon
|
ExecStart=%dir%/bin/signal-cli --config /var/lib/signal-cli daemon
|
||||||
User=signal-cli
|
LockPersonality=true
|
||||||
|
NoNewPrivileges=true
|
||||||
|
PrivateDevices=true
|
||||||
|
PrivateIPC=true
|
||||||
|
PrivateTmp=true
|
||||||
|
PrivateUsers=true
|
||||||
|
ProcSubset=pid
|
||||||
|
ProtectClock=true
|
||||||
|
ProtectControlGroups=true
|
||||||
|
ProtectHome=true
|
||||||
|
ProtectHostname=true
|
||||||
|
ProtectKernelLogs=true
|
||||||
|
ProtectKernelModules=true
|
||||||
|
ProtectKernelTunables=true
|
||||||
|
ProtectProc=invisible
|
||||||
|
ProtectSystem=strict
|
||||||
|
# Profile pictures and attachments to upload must be located here for the service to access them
|
||||||
|
ReadWritePaths=/var/lib/signal-cli
|
||||||
|
RemoveIPC=true
|
||||||
|
RestrictAddressFamilies=AF_INET AF_INET6
|
||||||
|
RestrictNamespaces=true
|
||||||
|
RestrictRealtime=true
|
||||||
|
RestrictSUIDSGID=true
|
||||||
# JVM always exits with 143 in reaction to SIGTERM signal
|
# JVM always exits with 143 in reaction to SIGTERM signal
|
||||||
SuccessExitStatus=143
|
SuccessExitStatus=143
|
||||||
StandardInput=socket
|
StandardInput=socket
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
StandardError=journal
|
StandardError=journal
|
||||||
|
SystemCallArchitectures=native
|
||||||
|
SystemCallFilter=~@debug @mount @obsolete @privileged @resources
|
||||||
|
UMask=0077
|
||||||
|
# Create the user and home directory with 'useradd -r -U -s /usr/sbin/nologin -m -b /var/lib signal-cli'
|
||||||
|
User=signal-cli
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
Also=signal-cli-socket.socket
|
Also=signal-cli-socket.socket
|
||||||
|
|
|
@ -3,6 +3,11 @@ Description=Send secure messages to Signal clients
|
||||||
|
|
||||||
[Socket]
|
[Socket]
|
||||||
ListenStream=%t/signal-cli/socket
|
ListenStream=%t/signal-cli/socket
|
||||||
|
SocketUser=root
|
||||||
|
# Add yourself to the signal-cli group to talk with the service
|
||||||
|
# Run 'usermod -aG signal-cli yourusername'
|
||||||
|
SocketGroup=signal-cli
|
||||||
|
SocketMode=0660
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=sockets.target
|
WantedBy=sockets.target
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue