Automated scrapers, vulnerability scanners, and credential-stuffing bots probe public websites around the clock. If you leave an admin login route exposed, bots test thousands of passwords per hour.
Defending the Admin Route
I layer three controls on the admin panel:
- Non-default admin URL: I move the real admin off
/admin/to a secret prefix so generic scans miss it. - Failed-login tracking with Django-Axes: I track failed attempts by client IP and username.
- Cool-off lockouts: I block an IP after consecutive failed logins before allowing new tries.
AXES_FAILURE_LIMIT = 5
AXES_COOLOFF_TIME = 1 # 1 hour lockout
AXES_LOCKOUT_CALLABLE = 'security.views.lockout_response'
AXES_IP_GETTER = 'security.utils.get_client_ip'
Parsing Reverse Proxy Headers
Behind Nginx, Caddy, or Docker Compose, requests arrive from the proxy's internal IP unless you read X-Forwarded-For right. A bad header setup can lock out your own proxy or let attackers spoof client IPs.
Configure your reverse proxy to strip forged headers and set the proxy hop count in Axes so lockouts hit the real client IP without blocking legitimate visitors.