Debian 10 phpmyadmin start
This commit is contained in:
parent
8af896c3e0
commit
6a34f617f8
3 changed files with 139 additions and 1 deletions
|
@ -2509,7 +2509,6 @@ function convertToMariaDBFromMYSQLPrompt(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function convertToMariaDBFromMYSQL(){
|
function convertToMariaDBFromMYSQL(){
|
||||||
# Get current version of MySQL
|
# Get current version of MySQL
|
||||||
mysqlVersionInstalled=$(apt-cache policy mysql-server | grep -o "Candidate:.*" | grep -o "[^Candidate: ].*")
|
mysqlVersionInstalled=$(apt-cache policy mysql-server | grep -o "Candidate:.*" | grep -o "[^Candidate: ].*")
|
||||||
|
@ -3005,6 +3004,52 @@ function checkApacheVersionForProxyFCGI(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function packageCanBeInstalledFromRepo(){
|
||||||
|
#$1 is the package name
|
||||||
|
if [ ! -z "$1" ]; then
|
||||||
|
packageSearchResult=$(apt-cache policy "$1" | grep -o "Candidate:.*" | grep -o "[^Candidate: ].*")
|
||||||
|
if [ ! -z "$packageSearchResult" ] && [ "$packageSearchResult" != "(none)" ]; then
|
||||||
|
packageSearchedExists=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
packageSearchedExists=false
|
||||||
|
}
|
||||||
|
|
||||||
|
function installPHPMyAdminManually(){
|
||||||
|
curDir=$(pwd)
|
||||||
|
packageCanBeInstalledFromRepo "phpmyadmin"
|
||||||
|
if [ "$packageSearchedExists" = false ] && [ ! -e "/usr/share/phpmyadmin" ]; then
|
||||||
|
echo -e "Installing phpmyadmin manually!"
|
||||||
|
# Install phpmyadmin manually
|
||||||
|
cd "$patchDir"
|
||||||
|
wget -O "phpmyadmin.zip" -N "https://files.phpmyadmin.net/phpMyAdmin/4.9.1/phpMyAdmin-4.9.1-all-languages.zip"
|
||||||
|
unzip "phpmyadmin.zip"
|
||||||
|
cd "phpMyAdmin-4.9.1-all-languages"
|
||||||
|
if [ ! -d "/usr/share/phpmyadmin" ]; then
|
||||||
|
mkdir -p "/usr/share/phpmyadmin"
|
||||||
|
fi
|
||||||
|
cp -R ./* /usr/share/phpmyadmin
|
||||||
|
|
||||||
|
# Create database and user for phpmyadmin
|
||||||
|
generatePassword
|
||||||
|
phpmyadminMySQLUser="phpmyadmin_sys"
|
||||||
|
phpmyadminMySQLPass="$rPass"
|
||||||
|
|
||||||
|
# Create the database with the username and password and populate it with the policyd mysql
|
||||||
|
cd "$patchDir"
|
||||||
|
cp "$FIXDIR/api/create_mysql_db_user.tar.gz" "create_mysql_db_user.tar.gz"
|
||||||
|
tar -zxvf "create_mysql_db_user.tar.gz"
|
||||||
|
php -f create_mysql_db_user.php "phpmyadmin" "$phpmyadminMySQLUser" "$phpmyadminMySQLPass"
|
||||||
|
|
||||||
|
# Update the config to use the database info
|
||||||
|
cp "$FIXDIR/phpmyadmin/config.inc.php" "/usr/share/phpmyadmin"
|
||||||
|
sed -i "s#{PHPMYADMINUSER}#$phpmyadminMySQLUser#g" "/usr/share/phpmyadmin/config.inc.php"
|
||||||
|
sed -i "s#{PHPMYADMINPASS}#$phpmyadminMySQLPass#g" "/usr/share/phpmyadmin/config.inc.php"
|
||||||
|
fi
|
||||||
|
cd "$curDir"
|
||||||
|
}
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
###START OF SCRIPT MAIN CODE###
|
###START OF SCRIPT MAIN CODE###
|
||||||
###############################
|
###############################
|
||||||
|
@ -3160,6 +3205,9 @@ echo -e "Fixing apache2 umask issue if applicable!\n"
|
||||||
# Get rid of umask envvars entry
|
# Get rid of umask envvars entry
|
||||||
removeApacheUmask
|
removeApacheUmask
|
||||||
|
|
||||||
|
# Install PHPMyAdmin manually if needed
|
||||||
|
installPHPMyAdminManually
|
||||||
|
|
||||||
echo -e "Securing PHPMyAdmin Configuration!\n"
|
echo -e "Securing PHPMyAdmin Configuration!\n"
|
||||||
# Secure PHPMyAdmin Configuration to Prevent Root Logins Except for Local Connections
|
# Secure PHPMyAdmin Configuration to Prevent Root Logins Except for Local Connections
|
||||||
securePHPMyAdminConfiguration
|
securePHPMyAdminConfiguration
|
||||||
|
|
42
ehcp/fixes/phpmyadmin/config.inc.php
Normal file
42
ehcp/fixes/phpmyadmin/config.inc.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
// DB Settings
|
||||||
|
$dbuser='{PHPMYADMINUSER}';
|
||||||
|
$dbpass='{PHPMYADMINPASS}';
|
||||||
|
$basepath='';
|
||||||
|
$dbname='phpmyadmin';
|
||||||
|
$dbserver='localhost';
|
||||||
|
$dbport='';
|
||||||
|
$dbtype='mysql';
|
||||||
|
|
||||||
|
// Set the default server if there is no defined
|
||||||
|
if (!isset($cfg['Servers'])) {
|
||||||
|
$cfg['Servers'][1]['host'] = 'localhost';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the default values for $cfg['Servers'] entries
|
||||||
|
for ($i=1; (!empty($cfg['Servers'][$i]['host']) || (isset($cfg['Servers'][$i]['connect_type']) && $cfg['Servers'][$i]['connect_type'] == 'socket')); $i++) {
|
||||||
|
if (!isset($cfg['Servers'][$i]['auth_type'])) {
|
||||||
|
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||||
|
}
|
||||||
|
if (!isset($cfg['Servers'][$i]['host'])) {
|
||||||
|
$cfg['Servers'][$i]['host'] = 'localhost';
|
||||||
|
}
|
||||||
|
if (!isset($cfg['Servers'][$i]['connect_type'])) {
|
||||||
|
$cfg['Servers'][$i]['connect_type'] = 'tcp';
|
||||||
|
}
|
||||||
|
if (!isset($cfg['Servers'][$i]['compress'])) {
|
||||||
|
$cfg['Servers'][$i]['compress'] = false;
|
||||||
|
}
|
||||||
|
if (!isset($cfg['Servers'][$i]['extension'])) {
|
||||||
|
$cfg['Servers'][$i]['extension'] = 'mysql';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tweaked settings
|
||||||
|
$cfg['UploadDir'] = './upload';
|
||||||
|
$cfg['SaveDir'] = '';
|
||||||
|
|
||||||
|
$cfg['Servers'][1]['AllowRoot'] = FALSE;
|
||||||
|
include_once '/usr/share/phpmyadmin/rootip_whitelist_functions.php';
|
||||||
|
include '/usr/share/phpmyadmin/rootip_whitelist.php';
|
||||||
|
?>
|
|
@ -2725,6 +2725,52 @@ function updateMySQLModeVariableIfNeeded(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function packageCanBeInstalledFromRepo(){
|
||||||
|
#$1 is the package name
|
||||||
|
if [ ! -z "$1" ]; then
|
||||||
|
packageSearchResult=$(apt-cache policy "$1" | grep -o "Candidate:.*" | grep -o "[^Candidate: ].*")
|
||||||
|
if [ ! -z "$packageSearchResult" ] && [ "$packageSearchResult" != "(none)" ]; then
|
||||||
|
packageSearchedExists=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
packageSearchedExists=false
|
||||||
|
}
|
||||||
|
|
||||||
|
function installPHPMyAdminManually(){
|
||||||
|
curDir=$(pwd)
|
||||||
|
packageCanBeInstalledFromRepo "phpmyadmin"
|
||||||
|
if [ "$packageSearchedExists" = false ] && [ ! -e "/usr/share/phpmyadmin" ]; then
|
||||||
|
echo -e "Installing phpmyadmin manually!"
|
||||||
|
# Install phpmyadmin manually
|
||||||
|
cd "$patchDir"
|
||||||
|
wget -O "phpmyadmin.zip" -N "https://files.phpmyadmin.net/phpMyAdmin/4.9.1/phpMyAdmin-4.9.1-all-languages.zip"
|
||||||
|
unzip "phpmyadmin.zip"
|
||||||
|
cd "phpMyAdmin-4.9.1-all-languages"
|
||||||
|
if [ ! -d "/usr/share/phpmyadmin" ]; then
|
||||||
|
mkdir -p "/usr/share/phpmyadmin"
|
||||||
|
fi
|
||||||
|
cp -R ./* /usr/share/phpmyadmin
|
||||||
|
|
||||||
|
# Create database and user for phpmyadmin
|
||||||
|
generatePassword
|
||||||
|
phpmyadminMySQLUser="phpmyadmin_sys"
|
||||||
|
phpmyadminMySQLPass="$rPass"
|
||||||
|
|
||||||
|
# Create the database with the username and password and populate it with the policyd mysql
|
||||||
|
cd "$patchDir"
|
||||||
|
cp "$FIXDIR/api/create_mysql_db_user.tar.gz" "create_mysql_db_user.tar.gz"
|
||||||
|
tar -zxvf "create_mysql_db_user.tar.gz"
|
||||||
|
php -f create_mysql_db_user.php "phpmyadmin" "$phpmyadminMySQLUser" "$phpmyadminMySQLPass"
|
||||||
|
|
||||||
|
# Update the config to use the database info
|
||||||
|
cp "$FIXDIR/phpmyadmin/config.inc.php" "/usr/share/phpmyadmin"
|
||||||
|
sed -i "s#{PHPMYADMINUSER}#$phpmyadminMySQLUser#g" "/usr/share/phpmyadmin/config.inc.php"
|
||||||
|
sed -i "s#{PHPMYADMINPASS}#$phpmyadminMySQLPass#g" "/usr/share/phpmyadmin/config.inc.php"
|
||||||
|
fi
|
||||||
|
cd "$curDir"
|
||||||
|
}
|
||||||
|
|
||||||
#############################################################
|
#############################################################
|
||||||
# End Functions & Start Install #
|
# End Functions & Start Install #
|
||||||
#############################################################
|
#############################################################
|
||||||
|
@ -2860,6 +2906,8 @@ fixPopBeforeSMTP
|
||||||
#Fix apache2 umask issue
|
#Fix apache2 umask issue
|
||||||
#For some reason, new distros include umask 111 in apache2 envvars which really messes stuff up
|
#For some reason, new distros include umask 111 in apache2 envvars which really messes stuff up
|
||||||
removeApacheUmask
|
removeApacheUmask
|
||||||
|
# Install phpmyadmin manually if needed
|
||||||
|
installPHPMyAdminManually
|
||||||
# Secure PHPMyAdmin Configuration to Prevent Root Logins Except for Local Connections
|
# Secure PHPMyAdmin Configuration to Prevent Root Logins Except for Local Connections
|
||||||
securePHPMyAdminConfiguration
|
securePHPMyAdminConfiguration
|
||||||
#Change settings in php.ini to allow 50MB upload files, turn on displaying errors, and setting the error_reporting to something practical
|
#Change settings in php.ini to allow 50MB upload files, turn on displaying errors, and setting the error_reporting to something practical
|
||||||
|
|
Loading…
Reference in a new issue