Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: systemd hardening #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


override_dh_auto_install:
dh_auto_install -- prefix=/usr
dh_auto_install -- prefix=/usr
dh_installsysusers deepin-face.sysusers
dh_installtmpfiles deepin-face.tmpfiles
10 changes: 10 additions & 0 deletions debian/sysusers
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.

#Type Name ID GECOS Home directory Shell
u deepin-face - -
m deepin-face video
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-face deepin-face - -
2 changes: 1 addition & 1 deletion msic/dbus-conf/org.deepin.dde.Face1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<busconfig>

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

Expand Down
32 changes: 31 additions & 1 deletion 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
User=deepin-face
BusName=org.deepin.dde.Face1
ExecStart=/usr/libexec/deepin-face

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

DeviceAllow=char-video4linux
DevicePolicy=closed

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

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