Skip to content

Commit

Permalink
feat: 对deepin-face服务进行安全加固
Browse files Browse the repository at this point in the history
对deepin-face服务进行安全加固

Task: https://pms.uniontech.com/task-view-361193.html
  • Loading branch information
ECQZXC authored and deepin-bot[bot] committed Sep 9, 2024
1 parent 83ce880 commit 6fb287e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
3 changes: 2 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


override_dh_auto_install:
dh_auto_install -- prefix=/usr
dh_auto_install -- prefix=/usr
dh_installtmpfiles deepin-face.tmpfiles
2 changes: 2 additions & 0 deletions debian/tmpfiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Type Path Mode User Group Age Argument
f /var/log/deepin-face.log 0644 deepin-daemon deepin-daemon - -
6 changes: 3 additions & 3 deletions msic/dbus-conf/org.deepin.dde.Face1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

<!-- Only root can own the service -->
<policy user="root">
<!-- Only deepin-daemon can own the service -->
<policy user="deepin-daemon">
<allow own="org.deepin.dde.Face1"/>
</policy>

Expand All @@ -15,7 +15,7 @@
<allow send_destination="org.deepin.dde.Face1"/>

</policy>
<policy user="root">
<policy user="deepin-daemon">
<allow own="org.deepin.dde.Face1"/>
<allow send_destination="org.deepin.dde.Face1" />
</policy>
Expand Down
34 changes: 32 additions & 2 deletions msic/systemd/deepin-face.service
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
[Unit]
Description=Deepin Face Authenticate Driver

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

[Service]
User=root
Type=dbus
BusName=org.deepin.dde.Face1
User=deepin-daemon
SupplementaryGroups=video
BusName=com.deepin.face
ExecStart=/usr/libexec/deepin-face

ProtectSystem=strict
#ReadOnlyPaths=/usr/share/seetaface-models/
ReadWritePaths=/var/log/deepin-face.log

DeviceAllow=char-video4linux
DevicePolicy=closed

NoNewPrivileges=yes
ProtectHome=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
PrivateMounts=yes
PrivateTmp=yes
# 需要video device
#PrivateDevices=yes
PrivateNetwork=yes
PrivateUsers=yes
RestrictNamespaces=yes
LockPersonality=yes
RestrictRealtime=yes
RemoveIPC=yes
MemoryDenyWriteExecute=yes
# 内存占用TODO
#MemoryLimit=100M

0 comments on commit 6fb287e

Please sign in to comment.