2018-12-15 21:22:21 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-11-09 16:56:34 +00:00
|
|
|
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
|
|
|
|
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
|
|
|
|
|
2018-12-15 21:22:21 +00:00
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
set -o pipefail
|
|
|
|
|
2019-11-09 16:56:34 +00:00
|
|
|
SCRIPT_PATH="$( cd "$(dirname "$0")" && pwd -P )"
|
|
|
|
DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
. "${SCRIPT_PATH}/../scripts/.lib.sh"
|
2018-12-15 21:22:21 +00:00
|
|
|
|
2019-11-09 16:56:34 +00:00
|
|
|
RETRIES=10
|
2019-02-03 00:51:16 +00:00
|
|
|
DISABLED_VERSIONS=("")
|
2018-12-18 19:29:51 +00:00
|
|
|
|
2018-12-15 21:58:29 +00:00
|
|
|
|
2019-11-09 16:56:34 +00:00
|
|
|
echo
|
|
|
|
echo "# --------------------------------------------------------------------------------------------------"
|
|
|
|
echo "# [Vendor] phpMyAdmin"
|
|
|
|
echo "# --------------------------------------------------------------------------------------------------"
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------------------------------------------------------
|
2019-11-21 08:43:00 +00:00
|
|
|
# Pre-check
|
2019-11-09 16:56:34 +00:00
|
|
|
# -------------------------------------------------------------------------------------------------
|
2018-12-15 21:58:29 +00:00
|
|
|
|
2019-11-21 08:43:00 +00:00
|
|
|
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
|
|
|
|
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
|
|
|
|
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
|
|
|
|
exit 0
|
2018-12-18 19:29:51 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2019-11-21 08:43:00 +00:00
|
|
|
# -------------------------------------------------------------------------------------------------
|
|
|
|
# ENTRYPOINT
|
|
|
|
# -------------------------------------------------------------------------------------------------
|
|
|
|
|
2018-12-18 19:29:51 +00:00
|
|
|
###
|
2019-11-21 08:43:00 +00:00
|
|
|
### Get required env values
|
2018-12-18 19:29:51 +00:00
|
|
|
###
|
2019-11-21 08:43:00 +00:00
|
|
|
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
|
2018-12-18 19:29:51 +00:00
|
|
|
|
|
|
|
|
2018-12-15 21:22:21 +00:00
|
|
|
###
|
|
|
|
### Retrieve URL for current PHP version.
|
|
|
|
### Older PHP versions are presented a link with a different version due to compatibility.
|
|
|
|
###
|
|
|
|
printf "[TEST] Retrieve phpMyAdmin URL"
|
2019-11-21 08:43:00 +00:00
|
|
|
if ! URL="$( run "\
|
|
|
|
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/index.php' \
|
|
|
|
| tac \
|
|
|
|
| tac \
|
|
|
|
| grep -Eo '/vendor/phpmyadmin-[.0-9]+/index\\.php'" \
|
|
|
|
"${RETRIES}" "" "0" )"; then
|
|
|
|
printf "\\r[FAILED] Retrieve phpMyAdmin URL\\n"
|
|
|
|
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}/index.php' || true"
|
|
|
|
exit 1
|
2018-12-15 21:22:21 +00:00
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] Retrieve phpMyAdmin URL: %s\\n" "${URL}"
|
2018-12-15 21:22:21 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2019-01-29 17:02:31 +00:00
|
|
|
####
|
|
|
|
#### Ensure given phpMyAdmin version works
|
|
|
|
####
|
|
|
|
#
|
|
|
|
#printf "[TEST] Fetch ${URL}"
|
|
|
|
## 1st Try
|
|
|
|
#if ! curl -sS localhost${URL} | tac | tac | grep -Eiq "welcome to.+phpMyAdmin"; then
|
|
|
|
# # 2nd Try
|
|
|
|
# sleep 1
|
|
|
|
# if ! curl -sS localhost${URL} | tac | tac | grep -Eiq "welcome to.+phpMyAdmin"; then
|
|
|
|
# # 3rd Try
|
|
|
|
# sleep 1
|
|
|
|
# if ! curl -sS localhost${URL} | tac | tac | grep -Eiq "welcome to.+phpMyAdmin"; then
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[FAIL] Fetch ${URL}\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
# curl -sS localhost/${URL} || true
|
|
|
|
# curl -sSI localhost/${URL} || true
|
|
|
|
# exit 1
|
|
|
|
# else
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[OK] Fetch ${URL} (3 rounds)\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
# fi
|
|
|
|
# else
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[OK] Fetch ${URL} (2 rounds)\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
# fi
|
|
|
|
#else
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[OK] Fetch ${URL} (1 round)\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
#fi
|
|
|
|
#
|
|
|
|
#
|
|
|
|
####
|
|
|
|
#### Login
|
|
|
|
####
|
|
|
|
#
|
|
|
|
#TOKEN=
|
|
|
|
#printf "[TEST] Retrieve phpMyAdmin login page"
|
|
|
|
#while true; do
|
|
|
|
# # Try again until it succeeds
|
|
|
|
# if ! CONTENT="$( curl -sS -c cookie.txt localhost${URL} )"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "e"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Extract the token
|
|
|
|
# if ! TOKEN="$( echo "${CONTENT}" \
|
|
|
|
# | grep -Eo "name=\"token\" value=\".+\"" \
|
|
|
|
# | head -1 \
|
|
|
|
# | grep -Eo "value=\".+\"" \
|
|
|
|
# | sed -e 's/^value="//g' -e 's/"$//g' )"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "w"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '!'
|
|
|
|
# if echo "${TOKEN}" | grep -q "!"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "!"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '&'
|
|
|
|
# if echo "${TOKEN}" | grep -q "&"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "&"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '?'
|
|
|
|
# if echo "${TOKEN}" | grep -q "?"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "?"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '"'
|
|
|
|
# if echo "${TOKEN}" | grep -q "\""; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "\""
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '
|
|
|
|
# if echo "${TOKEN}" | grep -q "'"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "'"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '@'
|
|
|
|
# if echo "${TOKEN}" | grep -q "@"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "@"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '\'
|
|
|
|
# if echo "${TOKEN}" | grep -q "\\\\"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "\\"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '='
|
|
|
|
# if echo "${TOKEN}" | grep -q "="; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "="
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '`'
|
|
|
|
# if echo "${TOKEN}" | grep -q "\`"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "\`"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '+'
|
|
|
|
# if echo "${TOKEN}" | grep -q "+"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "+"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain ';'
|
|
|
|
# if echo "${TOKEN}" | grep -q ";"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf ";"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '%'
|
|
|
|
# if echo "${TOKEN}" | grep -q "%"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "%%"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain ']'
|
|
|
|
# if echo "${TOKEN}" | grep -q "\]"; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "\]"
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '['
|
|
|
|
# if echo "${TOKEN}" | grep -q "\["; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf "\["
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
# # Ensure Token does not contain '$'
|
|
|
|
# if echo "${TOKEN}" | grep -q '\$'; then
|
|
|
|
# rm -f cookie.txt
|
|
|
|
# printf '\$'
|
|
|
|
# continue;
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# # All set
|
|
|
|
# break
|
|
|
|
#done
|
2019-11-21 08:43:00 +00:00
|
|
|
#printf "\\r[OK] Retrieve phpMyAdmin login page\r\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#printf "[TEST] Exract phpMyAdmin login token"
|
|
|
|
#if ! TOKEN="$( echo "${CONTENT}" \
|
|
|
|
# | grep -Eo "name=\"token\" value=\".+\"" \
|
|
|
|
# | head -1 \
|
|
|
|
# | grep -Eo "value=\".+\"" \
|
|
|
|
# | sed -e 's/^value="//g' -e 's/"$//g' )"; then
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[FAIL] Exract phpMyAdmin login token\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
# rm -f cookie.txt || true
|
|
|
|
# echo "${CONTENT}"
|
|
|
|
# exit 1
|
|
|
|
#fi
|
2019-11-21 08:43:00 +00:00
|
|
|
#printf "\\r[OK] Exract phpMyAdmin login token: \"%s\"\\n" "${TOKEN}"
|
2019-01-29 17:02:31 +00:00
|
|
|
#
|
|
|
|
#printf "[TEST] Extract phpMyAdmin login session"
|
|
|
|
#if ! SESSION="$( echo "${CONTENT}" \
|
|
|
|
# | grep -Eo "name=\"set_session\" value=\"[A-Fa-f0-9]+\"" \
|
|
|
|
# | grep -Eo "value=\"[A-Fa-f0-9]+\"" \
|
|
|
|
# | sed -e 's/^value="//g' -e 's/"$//g' )"; then
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[OK] Extract phpMyAdmin login session (not available)\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
# SESSION=""
|
|
|
|
#else
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[OK] Extract phpMyAdmin login session: \"%s\"\\n" "${SESSION}"
|
2019-01-29 17:02:31 +00:00
|
|
|
#fi
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#printf "[TEST] Submit phpMyAdmin POST login"
|
|
|
|
## 1st Try
|
|
|
|
#if ! curl -sS -c cookie.txt -b cookie.txt -d "pma_username=root&pma_password=&server=1&target=index.php&token=${TOKEN}&set_session=${SESSION}" localhost${URL}; then
|
|
|
|
# # 2nd Try
|
|
|
|
# sleep 1
|
|
|
|
# if ! curl -sS -c cookie.txt -b cookie.txt -d "pma_username=root&pma_password=&server=1&target=index.php&token=${TOKEN}&set_session=${SESSION}" localhost${URL}; then
|
|
|
|
# # 3rd Try
|
|
|
|
# sleep 1
|
|
|
|
# if ! curl -sS -c cookie.txt -b cookie.txt -d "pma_username=root&pma_password=&server=1&target=index.php&token=${TOKEN}&set_session=${SESSION}" localhost${URL}; then
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[FAIL] Submit phpMyAdmin POST login\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
# curl -sS -c cookie.txt -b cookie.txt localhost/${URL} || true
|
|
|
|
# curl -sSI -c cookie.txt -b cookie.txt localhost/${URL} || true
|
|
|
|
# rm -f cookie.txt || true
|
|
|
|
# exit 1
|
|
|
|
# else
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[OK] Submit phpMyAdmin POST login (3 rounds)\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
# fi
|
|
|
|
# else
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[OK] Submit phpMyAdmin POST login (2 rounds)\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
# fi
|
|
|
|
#else
|
2019-11-21 08:43:00 +00:00
|
|
|
# printf "\\r[OK] Submit phpMyAdmin POST login (1 round)\\n"
|
2019-01-29 17:02:31 +00:00
|
|
|
#fi
|
2018-12-16 14:31:22 +00:00
|
|
|
|
2019-11-21 08:43:00 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
### Evaluate if we're logged in
|
|
|
|
###
|
2018-12-16 14:31:22 +00:00
|
|
|
printf "[TEST] Evaluate successful phpMyAdmin login"
|
2019-11-21 08:43:00 +00:00
|
|
|
if [ "$( run "\
|
|
|
|
curl -sS --fail -c cookie.txt -b cookie.txt 'http://localhost:${HOST_PORT_HTTPD}${URL}' \
|
|
|
|
| tac \
|
|
|
|
| tac \
|
|
|
|
| grep -Ec '(Databases<.+SQL<.+Status<.+Users<.+Export<)|(\"User accounts\")'" \
|
|
|
|
"${RETRIES}" "" "0" )" != "1" ]; then
|
|
|
|
printf "\\r[FAIL] Evaluate successful phpMyAdmin login\\n"
|
|
|
|
run "curl -sS -c cookie.txt -b cookie.txt 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
|
|
|
|
run "curl -sS -I -c cookie.txt -b cookie.txt 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
|
|
|
|
rm -f cookie.txt || true
|
|
|
|
exit 1
|
2018-12-16 14:31:22 +00:00
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] Evaluate successful phpMyAdmin login\\n"
|
2018-12-16 14:31:22 +00:00
|
|
|
fi
|
|
|
|
rm -f cookie.txt || true
|
2019-01-30 01:07:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
###
|
2019-01-30 12:20:40 +00:00
|
|
|
### Configuration File
|
2019-01-30 01:07:56 +00:00
|
|
|
###
|
|
|
|
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
|
|
|
DVLBOXPATH="${SCRIPTPATH}/../../"
|
2019-01-30 12:20:40 +00:00
|
|
|
CONFIGPATH="${DVLBOXPATH}/.devilbox/www/htdocs${URL%index\.php}config.inc.php"
|
2019-01-30 01:07:56 +00:00
|
|
|
|
2019-01-30 12:20:40 +00:00
|
|
|
printf "[TEST] config.inc.php exists"
|
|
|
|
if [ ! -f "${CONFIGPATH}" ]; then
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[FAIL] config.inc.php exists: no\\n"
|
2019-01-30 01:07:56 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php exists: yes\\n"
|
2019-01-30 12:20:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# error_reporting(-1);
|
|
|
|
printf "[TEST] config.inc.php check: error_reporting(-1);"
|
2019-11-21 08:43:00 +00:00
|
|
|
if ! grep -E "^error_reporting\\(-1\\);" "${CONFIGPATH}" >/dev/null; then
|
|
|
|
printf "\\r[FAIL] config.inc.php check: error_reporting(-1);\\n"
|
|
|
|
if ! grep 'error_reporting' "${CONFIGPATH}"; then
|
|
|
|
cat "${CONFIGPATH}"
|
|
|
|
fi
|
2019-01-30 12:20:40 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php check: error_reporting(-1);\\n"
|
2019-01-30 12:20:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# $cfg['TempDir'] = '/tmp';
|
|
|
|
printf "[TEST] config.inc.php check: \$cfg['TempDir'] = '/tmp';"
|
2019-11-21 08:43:00 +00:00
|
|
|
if ! grep -E "^\\\$cfg\\['TempDir'\\][[:space:]]*=[[:space:]]*'/tmp';" "${CONFIGPATH}" >/dev/null; then
|
|
|
|
printf "\\r[FAIL] config.inc.php check: \$cfg['TempDir'] = '/tmp';\\n"
|
|
|
|
if ! grep 'TempDir' "${CONFIGPATH}"; then
|
|
|
|
cat "${CONFIGPATH}"
|
|
|
|
fi
|
2019-01-30 12:20:40 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php check: \$cfg['TempDir'] = '/tmp';\\n"
|
2019-01-30 12:20:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# $cfg['CheckConfigurationPermissions'] = false;
|
|
|
|
printf "[TEST] config.inc.php check: \$cfg['CheckConfigurationPermissions'] = false;"
|
2019-11-21 08:43:00 +00:00
|
|
|
if ! grep -E "^\\\$cfg\\['CheckConfigurationPermissions'\\][[:space:]]*=[[:space:]]*false;" "${CONFIGPATH}" >/dev/null; then
|
|
|
|
printf "\\r[FAIL] config.inc.php check: \$cfg['CheckConfigurationPermissions'] = false;\\n"
|
|
|
|
if ! grep 'CheckConfigurationPermissions' "${CONFIGPATH}"; then
|
|
|
|
cat "${CONFIGPATH}"
|
|
|
|
fi
|
2019-01-30 12:20:40 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php check: \$cfg['CheckConfigurationPermissions'] = false;\\n"
|
2019-01-30 12:20:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# $cfg['blowfish_secret'] = '...'
|
|
|
|
printf "[TEST] config.inc.php check: \$cfg['blowfish_secret'] = '...';"
|
2019-11-21 08:43:00 +00:00
|
|
|
if ! grep -E "^\\\$cfg\\['blowfish_secret'\\][[:space:]]*=[[:space:]]*'.{32,}';" "${CONFIGPATH}" >/dev/null; then
|
|
|
|
printf "\\r[FAIL] config.inc.php check: \$cfg['blowfish_secret'] = '...';\\n"
|
|
|
|
if ! grep 'blowfish_secret' "${CONFIGPATH}"; then
|
|
|
|
cat "${CONFIGPATH}"
|
|
|
|
fi
|
2019-01-30 12:20:40 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php check: \$cfg['blowfish_secret'] = '...';\\n"
|
2019-01-30 12:20:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# $cfg['SendErrorReports'] = 'never';
|
|
|
|
printf "[TEST] config.inc.php check: \$cfg['SendErrorReports'] = 'never';"
|
2019-11-21 08:43:00 +00:00
|
|
|
if ! grep "^\\\$cfg\\['SendErrorReports'\\][[:space:]]*=[[:space:]]*'never';" "${CONFIGPATH}" >/dev/null; then
|
|
|
|
printf "\\r[FAIL] config.inc.php check: \$cfg['SendErrorReports'] = 'never';\\n"
|
|
|
|
if ! grep 'SendErrorReports' "${CONFIGPATH}"; then
|
|
|
|
cat "${CONFIGPATH}"
|
|
|
|
fi
|
2019-01-30 12:20:40 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php check: \$cfg['SendErrorReports'] = 'never';\\n"
|
2019-01-30 12:20:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# $cfg['Servers'][$i]['host'] = 'mysql';
|
|
|
|
printf "[TEST] config.inc.php check: \$cfg['Servers'][\$i]['host'] = 'mysql';"
|
2019-11-21 08:43:00 +00:00
|
|
|
if ! grep "^\\\$cfg\\['Servers'\\]\\[\$i\\]\\['host'\\][[:space:]]*=[[:space:]]*'mysql';" "${CONFIGPATH}" >/dev/null; then
|
|
|
|
printf "\\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['host'] = 'mysql';\\n"
|
|
|
|
if ! grep 'Servers' "${CONFIGPATH}" | grep 'host'; then
|
|
|
|
cat "${CONFIGPATH}"
|
|
|
|
fi
|
2019-01-30 12:20:40 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['host'] = 'mysql';\\n"
|
2019-01-30 12:20:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# $cfg['Servers'][$i]['connect_type'] = 'tcp';
|
|
|
|
printf "[TEST] config.inc.php check: \$cfg['Servers'][\$i]['connect_type'] = 'tcp';"
|
2019-11-21 08:43:00 +00:00
|
|
|
if ! grep "^\\\$cfg\\['Servers'\\]\\[\$i\\]\\['connect_type'\\][[:space:]]*=[[:space:]]*'tcp';" "${CONFIGPATH}" >/dev/null; then
|
|
|
|
printf "\\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['connect_type'] = 'tcp';\\n"
|
|
|
|
if ! grep 'Servers' "${CONFIGPATH}" | grep 'connect_type'; then
|
|
|
|
cat "${CONFIGPATH}"
|
|
|
|
fi
|
2019-01-30 12:20:40 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['connect_type'] = 'tcp';\\n"
|
2019-01-30 12:20:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# $cfg['Servers'][$i]['compress'] = false;
|
|
|
|
printf "[TEST] config.inc.php check: \$cfg['Servers'][\$i]['compress'] = false;"
|
2019-11-21 08:43:00 +00:00
|
|
|
if ! grep "^\\\$cfg\\['Servers'\\]\\[\$i\\]\\['compress'\\][[:space:]]*=[[:space:]]*false;" "${CONFIGPATH}" >/dev/null; then
|
|
|
|
printf "\\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['compress'] = false;\\n"
|
|
|
|
if ! grep 'Servers' "${CONFIGPATH}" | grep 'compress'; then
|
|
|
|
cat "${CONFIGPATH}"
|
|
|
|
fi
|
2019-01-30 12:20:40 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['compress'] = false;\\n"
|
2019-01-30 12:20:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# $cfg['Servers'][$i]['AllowNoPassword'] = true;
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "[TEST] config.inc.php check: \$cfg['Servers'][\$i]['AllowNoPassword'] = false;"
|
|
|
|
if ! grep "^\\\$cfg\\['Servers'\\]\\[\$i\\]\\['AllowNoPassword'\\][[:space:]]*=[[:space:]]*true;" "${CONFIGPATH}" >/dev/null; then
|
|
|
|
printf "\\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['AllowNoPassword'] = true;\\n"
|
|
|
|
if ! grep 'Servers' "${CONFIGPATH}" | grep 'AllowNoPassword'; then
|
|
|
|
cat "${CONFIGPATH}"
|
|
|
|
fi
|
2019-01-30 12:20:40 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2019-11-21 08:43:00 +00:00
|
|
|
printf "\\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['AllowNoPassword'] = true;\\n"
|
2019-01-30 01:07:56 +00:00
|
|
|
fi
|