django-honeyguard Documentation
django-honeyguard is a Django application that provides honeypot security mechanisms to detect and log bot attacks on fake admin login pages. It implements timing-based attack detection, hidden field honeypots, and comprehensive logging.
Features
Hidden Honeypot Fields: Detect bots by monitoring hidden form fields that humans shouldn’t fill
Timing Attack Detection: Identify suspiciously fast or slow form submissions
Multiple CMS Support: Fake login pages for Django admin and WordPress
Comprehensive Logging: Database, console, and email logging of all attacks
Risk Assessment: Automatic calculation of risk scores for each attack
Admin Interface: Enhanced Django admin with filters, actions, and analytics
Configuration Validation: Early detection of configuration errors at startup
Quick Start
Install the package:
pip install django-honeyguard
Add to your
INSTALLED_APPS:
INSTALLED_APPS = [
# ...
"django_honeyguard",
]
Configure in your
settings.py:
HONEYGUARD = {
"EMAIL_RECIPIENTS": ["admin@example.com"],
"ENABLE_CONSOLE_LOGGING": True,
}
Include URLs (option A) or use views directly (option B):
# Option A: Include all URLs
urlpatterns = [
path("", include("django_honeyguard.urls")),
]
# Option B: Use individual views directly
from django_honeyguard.views import FakeDjangoAdminView
urlpatterns = [
path("admin/", FakeDjangoAdminView.as_view()),
]
Run migrations:
python manage.py migrate
Contents
- Installation
- Configuration
- Examples
- Basic Setup Example
- Using Individual Views
- Using Both Views Separately
- Basic Setup Example
- Custom Honeypot View Example
- Signal Handler Example
- Management Command Example
- API Integration Example
- Middleware Integration Example
- Testing Example
- Log Analysis Example
- Custom Admin Action Example
- Email Template Customization Example
- API Reference
- Contributing
- Changelog
Running Documentation Locally
Create a virtual environment and install requirements:
python -m venv .venv && source .venv/bin/activate pip install -r docs/requirements.txt
Build HTML docs:
cd docs && make html
Open
docs/_build/html/index.htmlin your browser.