Skip to content

Commit 972f0bf

Browse files
committed
chore: systemd hardening
加固 dbus 进程
1 parent 83ce880 commit 972f0bf

5 files changed

Lines changed: 47 additions & 3 deletions

File tree

debian/rules

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
2020

2121

2222
override_dh_auto_install:
23-
dh_auto_install -- prefix=/usr
23+
dh_auto_install -- prefix=/usr
24+
dh_installsysusers deepin-face.sysusers
25+
dh_installtmpfiles deepin-face.tmpfiles

debian/sysusers

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file is part of systemd.
2+
#
3+
# systemd is free software; you can redistribute it and/or modify it
4+
# under the terms of the GNU Lesser General Public License as published by
5+
# the Free Software Foundation; either version 2.1 of the License, or
6+
# (at your option) any later version.
7+
8+
#Type Name ID GECOS Home directory Shell
9+
u deepin-face - -
10+
m deepin-face video

debian/tmpfiles

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Type Path Mode User Group Age Argument
2+
f /var/log/deepin-face.log 0644 deepin-face deepin-face - -

msic/dbus-conf/org.deepin.dde.Face1.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<busconfig>
77

88
<!-- Only root can own the service -->
9-
<policy user="root">
9+
<policy user="deepin-face">
1010
<allow own="org.deepin.dde.Face1"/>
1111
</policy>
1212

msic/systemd/deepin-face.service

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,39 @@
11
[Unit]
22
Description=Deepin Face Authenticate Driver
33

4+
# Ask for the dbus socket.
5+
Wants=dbus.socket
6+
After=dbus.socket
7+
48
[Service]
5-
User=root
69
Type=dbus
10+
User=deepin-face
711
BusName=org.deepin.dde.Face1
812
ExecStart=/usr/libexec/deepin-face
913

14+
ReadOnlyPaths=/usr/share/seetaface-models/
15+
ReadWritePaths=/var/log/deepin-face.log
16+
17+
DeviceAllow=char-video4linux
18+
DevicePolicy=closed
19+
20+
ProtectSystem=full
21+
ProtectHome=true
22+
PrivateTmp=true
23+
PrivateDevices=true
24+
PrivateNetwork=true
25+
ProtectHostname=true
26+
ProtectClock=true
27+
ProtectKernelTunables=true
28+
ProtectKernelModules=true
29+
ProtectKernelLogs=true
30+
ProtectControlGroups=true
31+
RestrictAddressFamilies=AF_UNIX
32+
RestrictNamespaces=true
33+
LockPersonality=true
34+
RestrictRealtime=true
35+
RestrictSUIDSGID=true
36+
RemoveIPC=true
37+
38+
[Install]
39+
Alias=dbus-org.deepin.dde.Face1.service

0 commit comments

Comments
 (0)