mirror of
https://github.com/myronblair/novacpx
synced 2026-06-30 17:50:41 -05:00
dbc5a01de9
#4: Postfix virtual mailbox config (virtual_mailbox_domains/maps, vmail user, maildir at /var/mail/vhosts/%d/%n). Dovecot SQL backend pointed at novacpx.email_accounts with SHA512-CRYPT passdb and per-domain Maildir userdb. #5: BIND9 confirmed working — dig @localhost resolves testdomain1.com correctly. #6: Certbot 2.9.0 confirmed installed; domains.document_root wired; infrastructure ready for live domain issuance (testdomain1.com not publicly resolvable so dry-run expected to fail). #7: Fixed all broken user-panel API queries — missing tables (databases, ftp_accounts, ssl_certs, cron_jobs, php_configs, notifications) created; `databases` reserved-word backtick-quoted across DatabaseManager+endpoints; domains.php is_primary→type=main, doc_root→document_root column fixes; DNSManager::createZone call signature fixed; stats/account auto-resolves account_id for user role. #8: assert_account_access() helper added to api/index.php; reseller ownership check wired into email, ftp, databases, domains, dns, ssl endpoints. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46 lines
1.6 KiB
Bash
Executable File
46 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# nova-db.sh — Quick DB access on NovaCPX VM
|
|
# Usage: bash nova-db.sh [query] (run query and return result)
|
|
# bash nova-db.sh (open interactive MySQL shell)
|
|
# bash nova-db.sh --tables (list all tables with row counts)
|
|
# bash nova-db.sh --users (list all panel users)
|
|
# bash nova-db.sh --reset-admin <newpass> (reset admin password)
|
|
|
|
PVE1_HOST="orbisne.fortiddns.com"
|
|
PVE1_PASS="Joker1974!!!"
|
|
VM_IP="10.48.200.110"
|
|
VM_PASS="Joker1974!!!"
|
|
SSH_OPTS="-o StrictHostKeyChecking=no -o ConnectTimeout=10"
|
|
DB="novacpx"
|
|
|
|
vm_mysql() {
|
|
sshpass -p "$PVE1_PASS" ssh $SSH_OPTS root@$PVE1_HOST \
|
|
"sshpass -p '$VM_PASS' ssh $SSH_OPTS root@$VM_IP 'mysql $DB -e \"$1\"'"
|
|
}
|
|
|
|
case "${1:-}" in
|
|
--tables)
|
|
echo "Tables in $DB:"
|
|
vm_mysql "SELECT table_name, table_rows FROM information_schema.tables WHERE table_schema='$DB' ORDER BY table_name;" 2>&1
|
|
;;
|
|
--users)
|
|
echo "Panel users:"
|
|
vm_mysql "SELECT id, username, email, role, status, created_at FROM users ORDER BY id;" 2>&1
|
|
;;
|
|
--reset-admin)
|
|
[[ -z "${2:-}" ]] && { echo "Usage: $0 --reset-admin <newpassword>"; exit 1; }
|
|
NEWPASS="$2"
|
|
HASH=$(php8.3 -r "echo password_hash('$NEWPASS', PASSWORD_BCRYPT);" 2>/dev/null)
|
|
vm_mysql "UPDATE users SET password='$HASH' WHERE username='admin';" 2>&1
|
|
echo "Admin password reset to: $NEWPASS"
|
|
;;
|
|
"")
|
|
echo "Opening MySQL shell on $DB..."
|
|
sshpass -p "$PVE1_PASS" ssh -t $SSH_OPTS root@$PVE1_HOST \
|
|
"sshpass -p '$VM_PASS' ssh -t $SSH_OPTS root@$VM_IP 'mysql $DB'"
|
|
;;
|
|
*)
|
|
vm_mysql "$*" 2>&1
|
|
;;
|
|
esac
|