Skip to content

Commit

Permalink
Bug#22559624 KEYRING_FILE INITIALIZATION FAILURE WHEN SELINUX ENABLED…
Browse files Browse the repository at this point in the history
… FROM DISABLED STATE

  Fix to initialize /var/lib/mysql-keyring when SELinux is enabled.
  Add /var/lib/mysql-keyring directory to file-contexts
  • Loading branch information
bkandasa committed Jan 18, 2016
1 parent 77fef83 commit 39feb38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packaging/rpm-oel/mysql.init
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ start(){
chmod 0751 "$datadir"
if [ -x /sbin/restorecon ] ; then
/sbin/restorecon "$datadir"
if [ -x /usr/sbin/semanage -a -d /var/lib/mysql -a -d /var/lib/mysql-files ] ; then
/usr/sbin/semanage fcontext -a -e /var/lib/mysql /var/lib/mysql-files >/dev/null 2>&1
/sbin/restorecon /var/lib/mysql-files
fi
for dir in /var/lib/mysql-files /var/lib/mysql-keyring ; do
if [ -x /usr/sbin/semanage -a -d /var/lib/mysql -a -d $dir ] ; then
/usr/sbin/semanage fcontext -a -e /var/lib/mysql $dir >/dev/null 2>&1
/sbin/restorecon $dir
fi
done
fi
# Now create the database
action $"Initializing MySQL database: " /usr/sbin/mysqld --initialize --datadir="$datadir" --user=mysql
Expand Down
7 changes: 6 additions & 1 deletion scripts/systemd/mysqld_pre_systemd.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/bash

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

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

0 comments on commit 39feb38

Please sign in to comment.