2.4 KiB
2.4 KiB
Portal Auth Admin Dashboard
Web dashboard to view and edit the portal_auth database. Only users with role admin in the users table can log in.
Setup
-
Copy
.env.exampleto.envand set:DB_AUTH_HOST,DB_AUTH_PORT,DB_AUTH_NAME,DB_AUTH_USER,DB_AUTH_PASSWORD(same as your portal auth DB)SECRET_KEY(random string for session signing)
-
Install dependencies:
pip install -r requirements.txt -
Run the app:
python app.pyBy default it listens on
http://0.0.0.0:5000.
Features
- Login: Admin only (role =
admin,is_active= true). Passwords verified with bcrypt (or legacy salt:hash). - Dashboard: Links to each table.
- Users: View all; create new user; edit role (admin/support) and active flag; change password.
- Sessions: View active sessions; revoke (delete) a session.
- Auth logs: View only (append-only log).
- API tokens: View; activate/deactivate; delete.
Deployment to Auth LXC (10.110.60.210)
From your machine (with SSH access to the server):
./deploy/deploy.sh
This will:
- Rsync app files to
/opt/portal-auth-dashboardonroot@10.110.60.210 - Create a Python venv and install dependencies (including gunicorn)
- Create
.envfromdeploy/.env.serverif missing (you must edit it on the server to setDB_AUTH_PASSWORDandSECRET_KEY) - Install and start the systemd unit
portal-auth-dashboard(listens on port 5000)
After first deploy, on the server set the real credentials:
ssh root@10.110.60.210
nano /opt/portal-auth-dashboard/.env # set DB_AUTH_PASSWORD and SECRET_KEY
systemctl restart portal-auth-dashboard
Dashboard URL: http://10.110.60.210:5000
Manual deploy (if the script is not used)
On the server (Debian):
apt-get update && apt-get install -y python3-venv python3-pip rsync
mkdir -p /opt/portal-auth-dashboard
From your machine, sync the project (excluding .env, venv, .git), then on the server:
cd /opt/portal-auth-dashboard
python3 -m venv venv && ./venv/bin/pip install -r requirements.txt
cp deploy/.env.server .env # then edit .env
cp deploy/portal-auth-dashboard.service /etc/systemd/system/
systemctl daemon-reload && systemctl enable --now portal-auth-dashboard
Production notes
Run behind a reverse proxy (e.g. nginx) with HTTPS. Set SECRET_KEY and ensure the app can reach the Auth DB (on the same host use DB_AUTH_HOST=127.0.0.1).