ba64342702
phpMyAdmin login was broken because phpmyadmin_install.sh never wired the private phpMyAdmin copy into the web server: no Apache Alias was registered via DirectAdmin CustomBuild, so the SSO redirect target was unreachable. Add configure_apache_alias()/apply_apache_alias() (Alias + Directory blocks, ./build rewrite_confs, httpd reload), detect the real Apache group instead of hardcoding diradmin:diradmin, stop silently swallowing chown/chmod failures, and verify an optional SHA256 for the downloaded phpMyAdmin tarball. Extend phpmyadmin_health_check.sh to detect a missing/incorrect Apache alias and to probe HTTP reachability. Security hardening: scope temporary phpMyAdmin SSO MySQL roles to 127.0.0.1 instead of '%', tighten SSO ticket file permissions to 0640 (they contain a plaintext MySQL password), and log MySQL connection failures for diagnosis instead of swallowing them silently. Bump version to 1.2.12 and rebuild the release archive.
56 lines
2.1 KiB
Bash
56 lines
2.1 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
fail() {
|
|
echo "FAIL: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
case "$(basename "$PLUGIN_DIR")" in
|
|
alt-mysql|src) ;;
|
|
*) fail "plugin directory name is neither alt-mysql nor src" ;;
|
|
esac
|
|
grep -Fxq "name=alt-mysql" "$PLUGIN_DIR/plugin.conf" || fail "plugin.conf name is not alt-mysql"
|
|
grep -Fxq "id=alt-mysql" "$PLUGIN_DIR/plugin.conf" || fail "plugin.conf id is not alt-mysql"
|
|
grep -Fxq "version=1.2.12" "$PLUGIN_DIR/plugin.conf" || fail "plugin.conf version is not 1.2.12"
|
|
grep -Fq "return '/CMD_PLUGINS/alt-mysql';" "$PLUGIN_DIR/exec/lib/AppContext.php" \
|
|
|| fail "AppContext base URL is not alt-mysql"
|
|
grep -Fq "\$pluginId = 'alt-mysql';" "$PLUGIN_DIR/exec/lib/DirectAdminUser.php" \
|
|
|| fail "DirectAdmin plugin allow/deny id is not alt-mysql"
|
|
|
|
[ -x "$PLUGIN_DIR/scripts/install_db.sh" ] || fail "install_db.sh is not executable in scripts/"
|
|
[ ! -e "$PLUGIN_DIR/scripts/install-alt-mariadb.sh" ] || fail "install-alt-mariadb.sh still exists in plugin scripts/"
|
|
[ ! -e "$PLUGIN_DIR/../mysql-installer/install_db.sh" ] || fail "install_db.sh exists outside plugin scripts/"
|
|
[ ! -e "$PLUGIN_DIR/../mysql-installer/install-alt-mariadb.sh" ] || fail "install-alt-mariadb.sh still exists outside plugin scripts/"
|
|
|
|
BAD_REFS="$(
|
|
old_plugin_path="/usr/local/directadmin/plugins/"'mysql'
|
|
old_cmd_path="/CMD_PLUGINS/"'mysql'
|
|
find "$PLUGIN_DIR" -type f \
|
|
! -path '*/tests/plugin_identity_test.sh' \
|
|
! -path '*/data/*' \
|
|
-exec grep -HnE "$old_plugin_path|$old_cmd_path" {} + || true
|
|
)"
|
|
[ -z "$BAD_REFS" ] || {
|
|
printf '%s\n' "$BAD_REFS" >&2
|
|
fail "old DirectAdmin plugin path references remain"
|
|
}
|
|
|
|
LEGACY_REFS="$(
|
|
legacy_sudoers="/etc/sudoers.d/directadmin-"'mysql'"-plugin"
|
|
legacy_cron="/etc/cron.d/"'mysql'"-jobs"
|
|
legacy_csf="/etc/csf/"'mysql'"-plugin.allow"
|
|
find "$PLUGIN_DIR" -type f \
|
|
! -path '*/tests/plugin_identity_test.sh' \
|
|
! -path '*/data/*' \
|
|
-exec grep -HnE "$legacy_sudoers|$legacy_cron|$legacy_csf" {} + || true
|
|
)"
|
|
[ -z "$LEGACY_REFS" ] || {
|
|
printf '%s\n' "$LEGACY_REFS" >&2
|
|
fail "legacy mysql plugin artifact references remain"
|
|
}
|
|
|
|
echo "plugin_identity_test: OK"
|