Skip to content

Commit aeffec6

Browse files
eworm-deLinuxJedi
authored andcommitted
MDEV-19210: do not run pre and post scripts as root
Now that we do not pollute systemd's environment but write private environment files running these as root is not longer required. So let's drop `PermissionsStartOnly=true`. Debian adds extra `ExecStartPre=` and `ExecStartPost=`, though. Use special executable prefix for full privileges there. (See systemd.service(5) for details.)
1 parent 4c56c66 commit aeffec6

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

cmake/systemd.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ MACRO(CHECK_SYSTEMD)
5050
SET(SYSTEMD_SCRIPTS ${SYSTEMD_SCRIPTS} galera_new_cluster galera_recovery)
5151
ENDIF()
5252
IF(DEB)
53-
SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld")
54-
SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=/etc/mysql/debian-start")
53+
SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=+/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld")
54+
SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=+/etc/mysql/debian-start")
5555
ENDIF()
5656
IF(URING_FOUND)
5757
SET(SYSTEMD_LIMIT "# For liburing and io_uring_setup()

support-files/mariadb.service.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ ProtectSystem=full
6868
# Prevent accessing /home, /root and /run/user
6969
ProtectHome=true
7070

71-
# Execute pre and post scripts as root, otherwise it does it as User=
72-
PermissionsStartOnly=true
73-
7471
# Use an environment file to pass variable _WSREP_NEW_CLUSTER
7572
EnvironmentFile=-@mysqlunixdir@/wsrep-new-cluster
7673

0 commit comments

Comments
 (0)