fix(security): secure Adminer wrapper, hide credentials from URL, auto-fill TCP 127.0.0.1 and disable in production (task-d095b0e23b)

This commit is contained in:
michele 2026-08-27 17:30:41 +02:00
parent 71fc4efb47
commit 2f27659f99
3 changed files with 4404 additions and 4289 deletions

4302
public/adminer-core.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,13 @@ sudo -u postgres psql -c "CREATE USER netgescon WITH PASSWORD 'netgescon_pass';"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE netgescon TO netgescon;" || true sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE netgescon TO netgescon;" || true
sudo -u postgres psql -d netgescon -c "GRANT ALL ON SCHEMA public TO netgescon;" || true sudo -u postgres psql -d netgescon -c "GRANT ALL ON SCHEMA public TO netgescon;" || true
# 3.1 Configurazione pg_hba.conf per consentire password auth sia su socket locale che TCP 127.0.0.1
PG_HBA=$(find /etc/postgresql/ -name "pg_hba.conf" | head -n 1)
if [ -n "$PG_HBA" ] && [ -f "$PG_HBA" ]; then
sed -i -E 's/local\s+all\s+all\s+peer/local all all scram-sha-256/' "$PG_HBA" || true
systemctl reload postgresql || true
fi
# 4. Riavvio eventuale servizio PHP-FPM / Web server # 4. Riavvio eventuale servizio PHP-FPM / Web server
systemctl restart php*-fpm 2>/dev/null || true systemctl restart php*-fpm 2>/dev/null || true