Skip to content

Commit 6e71a0f

Browse files
bkandasabjornmu
authored andcommitted
Bug#22559624 KEYRING_FILE INITIALIZATION FAILURE WHEN SELINUX ENABLED FROM DISABLED STATE
Fix to initialize /var/lib/mysql-keyring when SELinux is enabled. Add /var/lib/mysql-keyring directory to file-contexts (cherry picked from commit c798fb6f39e778ae85806b29d7255b45ede98a47)
1 parent bb72525 commit 6e71a0f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

packaging/rpm-oel/mysql.init

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ start(){
9898
chmod 0751 "$datadir"
9999
if [ -x /sbin/restorecon ] ; then
100100
/sbin/restorecon "$datadir"
101-
if [ -x /usr/sbin/semanage -a -d /var/lib/mysql -a -d /var/lib/mysql-files ] ; then
102-
/usr/sbin/semanage fcontext -a -e /var/lib/mysql /var/lib/mysql-files >/dev/null 2>&1
103-
/sbin/restorecon /var/lib/mysql-files
104-
fi
101+
for dir in /var/lib/mysql-files /var/lib/mysql-keyring ; do
102+
if [ -x /usr/sbin/semanage -a -d /var/lib/mysql -a -d $dir ] ; then
103+
/usr/sbin/semanage fcontext -a -e /var/lib/mysql $dir >/dev/null 2>&1
104+
/sbin/restorecon $dir
105+
fi
106+
done
105107
fi
106108
# Now create the database
107109
action $"Initializing MySQL database: " /usr/sbin/mysqld --initialize --datadir="$datadir" --user=mysql

scripts/systemd/mysqld_pre_systemd.in

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/bash
22

3-
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3+
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License as published by
@@ -57,6 +57,11 @@ install_db () {
5757
if [ -x /usr/sbin/restorecon ]; then
5858
/usr/sbin/restorecon "$datadir"
5959
/usr/sbin/restorecon $log
60+
for dir in /var/lib/mysql-files /var/lib/mysql-keyring ; do
61+
if [ -x /usr/sbin/semanage -a -d /var/lib/mysql -a -d $dir ] ; then
62+
/usr/sbin/semanage fcontext -a -e /var/lib/mysql $dir >/dev/null 2>&1
63+
/sbin/restorecon $dir
64+
done
6065
fi
6166

6267
# If special mysql dir is in place, skip db install

0 commit comments

Comments
 (0)