Skip to content

Commit 76a2715

Browse files
committed
MDEV-33301 memlock with systemd still not working
.. even with MDEV-9095 fix CapabilityBounding sets require filesystem setcap attributes for the executable to gain privileges during execution. A side effect of this however is the getauxvec(AT_SECURE) gets set, and the secure_getenv from OpenSSL internals on OPENSSL_CONF environment variable will get ignored (openssl gh issue 21770). According to capabilities(7), Ambient capabilities don't trigger ld.so triggering the secure execution mode. Include SELinux and Apparmor capabilities for ipc_lock
1 parent ee2ed1a commit 76a2715

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

support-files/mariadb.service.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Group=mysql
5151
# CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0
5252
# does nothing for non-root, not needed if /etc/shadow is u+r
5353
# CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason
54-
CapabilityBoundingSet=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
54+
AmbientCapabilities=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
5555

5656
# PrivateDevices=true implies NoNewPrivileges=true and
5757
# SUID auth_pam_tool suddenly doesn't do setuid anymore

support-files/mariadb@.service.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ PrivateNetwork=false
181181
# CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0
182182
# does nothing for non-root, not needed if /etc/shadow is u+r
183183
# CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason
184-
CapabilityBoundingSet=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
184+
AmbientCapabilities=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
185185

186186
# PrivateDevices=true implies NoNewPrivileges=true and
187187
# SUID auth_pam_tool suddenly doesn't do setuid anymore

support-files/policy/apparmor/usr.sbin.mysqld

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
capability chown,
1616
capability dac_override,
17+
capability ipc_lock,
1718
capability setgid,
1819
capability setuid,
1920
capability sys_rawio,

support-files/policy/selinux/mariadb-server.te

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require {
2525
class lnk_file read;
2626
class process { getattr signull };
2727
class unix_stream_socket connectto;
28-
class capability { sys_resource sys_nice };
28+
class capability { ipc_lock sys_resource sys_nice };
2929
class tcp_socket { name_bind name_connect };
3030
class file { execute setattr read create getattr execute_no_trans write ioctl open append unlink };
3131
class sock_file { create unlink getattr };
@@ -87,6 +87,8 @@ allow mysqld_t bin_t:file { getattr read execute open execute_no_trans ioctl };
8787

8888
# MariaDB additions
8989
allow mysqld_t self:process setpgid;
90+
allow mysqld_t self:capability { ipc_lock };
91+
9092
# This rule allows port tcp/4444
9193
allow mysqld_t kerberos_port_t:tcp_socket { name_bind name_connect };
9294
# This rule allows port tcp/4567 (tram_port_t may not be available on

0 commit comments

Comments
 (0)