Skip to content

Commit

Permalink
chore: systemd hardening
Browse files Browse the repository at this point in the history
加固 dbus 进程
  • Loading branch information
zsien committed Jun 24, 2024
1 parent 83b3e45 commit 004b3a7
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
1 change: 1 addition & 0 deletions misc/system-services/org.deepin.dde.LocaleHelper1.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
Name=org.deepin.dde.LocaleHelper1
Exec=/usr/lib/deepin-api/locale-helper
User=root
SystemdService=dbus-org.deepin.dde.LocaleHelper1.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
Name=org.deepin.dde.SoundThemePlayer1
Exec=/usr/lib/deepin-api/sound-theme-player
User=deepin-sound-player
SystemdService=dbus-org.deepin.dde.SoundThemePlayer1.service
39 changes: 39 additions & 0 deletions misc/systemd/system/deepin-locale-helper.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[Unit]
Description=Deepin Locale Helper

# Ask for the dbus socket.
Wants=dbus.socket
After=dbus.socket

[Service]
Type=dbus
BusName=org.deepin.dde.LocaleHelper1
ExecStart=/usr/lib/deepin-api/locale-helper

ReadWritePaths=/etc/default/locale
ReadWritePaths=/etc/locale.gen
ReadWritePaths=/usr/lib/locale/
ExecPaths=/usr/sbin/locale-gen

DevicePolicy=closed

ProtectSystem=full
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
PrivateNetwork=true
ProtectHostname=true
ProtectClock=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
RestrictAddressFamilies=AF_UNIX
RestrictNamespaces=true
LockPersonality=true
RestrictRealtime=true
RestrictSUIDSGID=true
RemoveIPC=true

[Install]
Alias=dbus-org.deepin.dde.LocaleHelper1.service
41 changes: 41 additions & 0 deletions misc/systemd/system/deepin-sound-theme-player.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[Unit]
Description=Deepin Sound Theme Player

Requisite=sound.target
After=sound.target

# Ask for the dbus socket.
Wants=dbus.socket
After=dbus.socket

[Service]
Type=dbus
BusName=org.deepin.dde.SoundThemePlayer1
User=deepin-sound-player
ExecStart=/usr/lib/deepin-api/sound-theme-player

ReadWritePaths=/var/lib/deepin-sound-player

DevicePolicy=closed
DeviceAllow=char-alsa rw

ProtectSystem=full
ProtectHome=true
PrivateTmp=true
#PrivateDevices=true
PrivateNetwork=true
ProtectHostname=true
ProtectClock=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
RestrictAddressFamilies=AF_UNIX
RestrictNamespaces=true
LockPersonality=true
RestrictRealtime=true
RestrictSUIDSGID=true
RemoveIPC=true

[Install]
Alias=dbus-org.deepin.dde.SoundThemePlayer1.service

0 comments on commit 004b3a7

Please sign in to comment.