Metadata-Version: 2.4
Name: xeolux-securitykit
Version: 0.1.0
Summary: Package de sécurité Django configurable via interface web
Author-email: Xeolux <contact@xeolux.com>
License: MIT License
        
        Copyright (c) 2026 Xeolux
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/xeolux/xeolux-securitykit
Project-URL: Repository, https://github.com/xeolux/xeolux-securitykit
Project-URL: Issues, https://github.com/xeolux/xeolux-securitykit/issues
Keywords: django,security,middleware,protection,firewall,ddos
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Security
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=4.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-django; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Dynamic: license-file

# xeolux-securitykit

Package de sécurité Django configurable depuis une interface web `/securitykit/`.

## Présentation

`xeolux-securitykit` est un package Django professionnel permettant de protéger une application web de façon granulaire et configurable, sans toucher au code métier.

### Fonctionnalités principales

- **Fake 404 configurable** : masquer n'importe quelle route avec une vraie réponse HTTP 404
- **Interface `/securitykit/`** : gestion complète depuis le navigateur
- **Règles par route** : politiques d'accès par URL
- **Whitelist / Blacklist IP** : contrôle des IP autorisées ou bloquées
- **Rate limiting** : limitation des requêtes par IP/route/utilisateur
- **Protection admin** : cacher `/admin/` aux non-autorisés
- **Strict mode** : mode de protection renforcé avec unlock par code email
- **Anti-abus applicatif** : détection bots, bruteforce, scan de routes
- **Headers de sécurité** : renforcement automatique des headers HTTP
- **Gestion des clés API** : création et révocation depuis l'interface
- **Diagnostics Django** : vérification de la configuration de sécurité

---

## Installation

```bash
pip install xeolux-securitykit
```

### Configuration `settings.py`

```python
INSTALLED_APPS = [
    # ...
    "xeolux_securitykit",
]

MIDDLEWARE = [
    # Placer en début de liste pour intercepter toutes les requêtes
    "xeolux_securitykit.middleware.XeoluxSecurityMiddleware",
    # ...
    "django.middleware.security.SecurityMiddleware",
    # ...
]

XEOLUX_SECURITYKIT = {
    "ENABLED": True,
    "DEFAULT_RESPONSE": "fake_404",
    "FAKE_404_TEMPLATE": "xeolux_securitykit/fake_404.html",
    "SECURITYKIT_PATH": "/securitykit/",
    "STRICT_UNLOCK_PATH": "/whitelistkit/unlockstrictmode/",
    "SELF_PROTECTION_ENABLED": True,
    "SUPERUSER_ONLY": True,
    "LOCKOUT_SAFETY_ENABLED": True,
    "STRICT_MODE_ENABLED": True,
    "ANTI_DDOS_ENABLED": True,
    "EMAIL_SUPER_ADMINS": True,
}
```

### Configuration `urls.py`

```python
from django.urls import path, include

urlpatterns = [
    # ...
    path("securitykit/", include("xeolux_securitykit.urls")),
]
```

### Migration

```bash
python manage.py migrate xeolux_securitykit
```

---

## Commandes de management

```bash
# Diagnostics complets
python manage.py securitykit_check

# Désactiver le strict mode depuis le terminal (secours)
python manage.py securitykit_unlock

# Activer le strict mode manuellement
python manage.py securitykit_strict_on

# Désactiver le strict mode manuellement
python manage.py securitykit_strict_off

# Exporter la configuration
python manage.py securitykit_export_config --output config.json

# Importer une configuration
python manage.py securitykit_import_config --input config.json
```

---

## Accès à l'interface

Accessible sur `/securitykit/` — nécessite d'être superuser.

Pour déverrouiller le strict mode depuis le navigateur :
`/whitelistkit/unlockstrictmode/`

---

## Architecture des modules

Le package est organisé en 50 modules couvrant :

| Catégorie | Modules |
|---|---|
| Interface | dashboard, ui, self_protection |
| Moteur | rules_engine, condition_engine, response_engine |
| Accès | ip_whitelist, ip_blacklist, access_policies |
| Fake 404 | fake_404, fake_response |
| Admin | stealth_admin, admin_secret_url |
| API | api_guard, api_key_manager, webhook_guard |
| Rate limit | rate_limit, bruteforce_protection, slow_down |
| Headers | security_headers, csp_manager, cookie_guard |
| Formulaires | form_guard, honeypot, csrf_guard |
| Strict mode | strict_mode, strict_unlock, anti_ddos |
| Diagnostics | settings_checker, safe_defaults |

---

## Avertissement

Ce package protège au niveau **applicatif Django**. Il ne peut pas bloquer un DDoS réseau massif. Pour une protection réseau, utilisez un WAF ou un CDN en amont (Cloudflare, Nginx, etc.).

---

## Licence

MIT — Copyright 2026 Xeolux
