Skip to content

Commit

Permalink
Linux: Don't create user for systemd units use DynamicUser
Browse files Browse the repository at this point in the history
Signed-off-by: Björn Bidar <[email protected]>
  • Loading branch information
Thaodan committed Oct 28, 2022
1 parent 0a29296 commit 8ae9103
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion davmail.spec
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ install -m 0644 src/appstream/org.davmail.DavMail.appdata.xml $RPM_BUILD_ROOT%{_
rm -rf $RPM_BUILD_ROOT

%pre
%if 0%{!?systemd_macros:1}
/usr/sbin/groupadd -f -r davmail > /dev/null 2>&1 || :
/usr/sbin/useradd -r -s /sbin/nologin -d /var/lib/davmail -M \
-g davmail davmail > /dev/null 2>&1 || :
%if %systemd_macros
%else
%service_add_pre davmail.service
%endif

Expand Down Expand Up @@ -230,6 +231,7 @@ fi
- Create initial log file with systemd-tmpfiles
- Harden systemd service
- Add systemd system sevice template unit
- Don't create user for systemd units use DynamicUser
* Wed Jul 07 2021 Michal Suchanek <[email protected]>
- Tumbleweed no longer supports init.d services and fails build when installed
Expand Down
1 change: 1 addition & 0 deletions src/init/davmail.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ After=network.target
[Service]
Type=simple
User=davmail
DynamicUser=yes
PermissionsStartOnly=true
AmbientCapabilities=CAP_NET_BIND_SERVICE
ExecStart=/usr/bin/davmail -server /etc/davmail.properties
Expand Down
1 change: 1 addition & 0 deletions src/init/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ After=network.target
[Service]
Type=simple
User=davmail
DynamicUser=yes
PermissionsStartOnly=true
AmbientCapabilities=CAP_NET_BIND_SERVICE
ExecStart=/usr/bin/davmail -server /etc/davmail/%i.properties
Expand Down

0 comments on commit 8ae9103

Please sign in to comment.