Commit 6b860c84 authored by Patrick J Cherry's avatar Patrick J Cherry
Browse files

Merge branch 'add-mysql-admin-user' into 'stretch'

Add admin@localhost MySQL user

See merge request open-source/symbiosis!98
parents b4154fb6 28c7af36
symbiosis-mysql (2018:0719) stable; urgency=medium
* Add an 'admin'@'localhost' MySQL user with standard username/password
authentication for phpmyadmin.
-- Andrew Ladlow <andrew.ladlow@bytemark.co.uk> Thu, 19 Jul 2018 15:21:47 +0100
symbiosis-mysql (2017:0905) stable; urgency=medium
* Explcitly depend on the stretch version of default-mysql-server to pull
......
#!/bin/sh -e
. /usr/share/debconf/confmodule
if [ ! -e /etc/first-boot.d/.mysql.hash ] ; then
while [ -z "$RET" ] ; do
db_input high symbiosis-mysql/admin_password || true
db_go
db_get symbiosis-mysql/admin_password
done
fi
exit 0
......@@ -8,7 +8,7 @@ Standards-Version: 3.9.6
Package: symbiosis-mysql
Architecture: all
Depends: default-mysql-server (>= 1.0.2), ruby, symbiosis-common (>= 2014:0113), ${misc:Depends}
Depends: default-mysql-server (>= 1.0.2), ruby, symbiosis-common (>= 2014:0113), debconf, ${misc:Depends}
Replaces: bytemark-vhost-mysql, symbiosis-monit (<< 2011:1206)
Provides: bytemark-vhost-mysql
Conflicts: bytemark-vhost-mysql
......
......@@ -2,6 +2,8 @@
set -e
. /usr/share/debconf/confmodule
#
# Skip, if we are not in "configure" state
#
......@@ -41,4 +43,17 @@ if [ -x /usr/bin/mysql_upgrade ] ; then
/usr/bin/mysql_upgrade --defaults-file=/etc/mysql/debian.cnf || true
fi
#
# Add an admin user with user/password authentication for phpmyadmin if one doesn't already exist
#
if grep -qx 'password = ' /etc/mysql/debian.cnf && [ "$(mysql -u root -se "select exists(select user from mysql.user where user = 'admin');")" = "0" ] ; then
echo "I: Adding 'admin'@'localhost' MySQL user"
if [ -e /etc/first-boot.d/.mysql.hash ]; then
mysql -u root -e "grant all privileges on *.* to 'admin'@'localhost' identified by password '*$(cat /etc/first-boot.d/.mysql.hash)' with grant option;"
else
db_get symbiosis-mysql/admin_password
mysql -u root -e "grant all privileges on *.* to 'admin'@'localhost' identified by '$RET' with grant option;"
fi
fi
exit 0
if [ "$1" = "purge" -a -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
fi
Template: symbiosis-mysql/admin_password
Type: password
Description: Enter a password for the 'admin@localhost' MySQL user:
MariaDB enforces Unix socket authentication by default, which is incompatible with phpMyAdmin.
A new MySQL user will be created, 'admin@localhost', which uses traditional username/password
authentication and is therefore compatible with phpMyAdmin. This user will have privileges
equivalent to 'root@localhost'.
......@@ -6,6 +6,8 @@ locales locales/locales_to_be_generated multiselect en_GB.UTF-8 UTF-8
mysql-server-5.5 mysql-server/root_password password semiconscious malpractice
# Repeat password for the MySQL "root" user:
mysql-server-5.5 mysql-server/root_password_again password semiconscious malpractice
# Set password for the MySQL "admin" user for phpMyAdmin access:
symbiosis-mysql symbiosis-mysql/admin_password password semiconscious malpractice
# Password of the database's administrative user:
phpmyadmin phpmyadmin/mysql/admin-pass password semiconscious malpractice
# Password of the database's administrative user:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment