**Motivations:** - Complete documentation for dashboard, domains, ports and environment configuration - Add new services (ClamAV API, Watermark API) to the infrastructure - Enhance dashboard with new pages and improved functionality - Improve deployment scripts and service configurations **Root causes:** - Missing comprehensive documentation for infrastructure setup - Need for antivirus scanning service integration - Need for watermark service integration - Dashboard required additional pages and features **Correctifs:** - Added comprehensive documentation in docs/ (DASHBOARD.md, DOMAINS_AND_PORTS.md, ENVIRONMENT.md) - Updated systemd service files with proper environment variables - Enhanced nginx proxy configuration script - Updated maintenance documentation **Evolutions:** - Added new ClamAV API service (api-clamav) for file scanning - Added new Watermark API service (api-filigrane) for document watermarking - Enhanced signet-dashboard with new learn.html page - Improved dashboard UI with better styles and navigation - Enhanced app.js with new functionality and better error handling - Updated API documentation page with complete endpoint descriptions - Added deployment scripts for watermark and nginx configuration - Updated hash and UTXO lists with latest data - Enhanced server.js with new routes and improved Bitcoin RPC integration **Pages affectées:** - docs/DASHBOARD.md: New comprehensive dashboard documentation - docs/DOMAINS_AND_PORTS.md: New infrastructure domains and ports documentation - docs/ENVIRONMENT.md: New environment variables documentation - docs/MAINTENANCE.md: Updated maintenance procedures - docs/README.md: Updated main documentation - signet-dashboard/public/app.js: Enhanced with new features - signet-dashboard/public/styles.css: Improved styling - signet-dashboard/public/index.html: Enhanced main page - signet-dashboard/public/learn.html: New educational page - signet-dashboard/public/api-docs.html: Enhanced API documentation - signet-dashboard/public/hash-list.html: Updated hash list page - signet-dashboard/public/utxo-list.html: Updated UTXO list page - signet-dashboard/public/join-signet.html: Updated join signet page - signet-dashboard/src/server.js: Enhanced server with new routes - signet-dashboard/start.sh: Updated startup script - signet-dashboard/signet-dashboard.service: Updated systemd service - api-anchorage/anchorage-api.service: Updated systemd service - api-faucet/faucet-api.service: Updated systemd service - configure-nginx-proxy.sh: Enhanced nginx configuration script - add-watermark-certificate.sh: New watermark certificate script - deploy-watermark-nginx.sh: New deployment script - api-clamav/: New ClamAV API service - api-filigrane/: New Watermark API service - hash_list.txt, utxo_list.txt: Updated with latest data - anchor_count.txt: Updated anchor count
147 lines
2.6 KiB
Markdown
147 lines
2.6 KiB
Markdown
# API ClamAV - Antivirus pour Certificator
|
|
|
|
API de scan antivirus utilisant ClamAV pour vérifier les fichiers avant traitement.
|
|
|
|
## Port
|
|
|
|
**Port fixe : 3023**
|
|
|
|
Le port est défini de manière fixe dans le code et ne peut pas être modifié.
|
|
|
|
## Domaine
|
|
|
|
- **Production :** `antivir.certificator.4nkweb.com`
|
|
|
|
## Installation
|
|
|
|
### Prérequis
|
|
|
|
1. ClamAV doit être installé et configuré sur le serveur
|
|
2. Le daemon ClamAV (`clamd`) doit être en cours d'exécution sur le port 3310 (par défaut)
|
|
|
|
### Installation des dépendances
|
|
|
|
```bash
|
|
cd api-clamav
|
|
npm install
|
|
```
|
|
|
|
### Configuration
|
|
|
|
Créer un fichier `.env` (optionnel) :
|
|
|
|
```env
|
|
CLAMAV_HOST=localhost
|
|
CLAMAV_PORT=3310
|
|
CLAMAV_TIMEOUT=30000
|
|
LOG_LEVEL=info
|
|
NODE_ENV=production
|
|
```
|
|
|
|
## Démarrage
|
|
|
|
### Manuel
|
|
|
|
```bash
|
|
./start.sh
|
|
```
|
|
|
|
### Service systemd
|
|
|
|
```bash
|
|
sudo cp clamav-api.service /etc/systemd/system/
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable clamav-api
|
|
sudo systemctl start clamav-api
|
|
```
|
|
|
|
Vérifier le statut :
|
|
|
|
```bash
|
|
sudo systemctl status clamav-api
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
### GET /health
|
|
|
|
Vérifie l'état de santé de l'API.
|
|
|
|
**Réponse :**
|
|
```json
|
|
{
|
|
"ok": true,
|
|
"service": "clamav-api",
|
|
"version": "1.0.0",
|
|
"timestamp": "2026-01-24T12:00:00.000Z"
|
|
}
|
|
```
|
|
|
|
### POST /api/scan/buffer
|
|
|
|
Scanne un buffer de données (base64) pour détecter les virus.
|
|
|
|
**Body :**
|
|
```json
|
|
{
|
|
"data": "base64_encoded_data",
|
|
"filename": "document.pdf" // optionnel
|
|
}
|
|
```
|
|
|
|
**Réponse (fichier propre) :**
|
|
```json
|
|
{
|
|
"clean": true,
|
|
"infected": false,
|
|
"viruses": [],
|
|
"filename": "document.pdf",
|
|
"size": 12345
|
|
}
|
|
```
|
|
|
|
**Réponse (fichier infecté) :**
|
|
```json
|
|
{
|
|
"clean": false,
|
|
"infected": true,
|
|
"viruses": ["Trojan.Example"],
|
|
"filename": "document.pdf",
|
|
"size": 12345
|
|
}
|
|
```
|
|
|
|
**Codes de statut :**
|
|
- `200` : Scan réussi (fichier propre ou infecté)
|
|
- `400` : Requête invalide
|
|
- `503` : Service ClamAV indisponible
|
|
- `500` : Erreur interne
|
|
|
|
## Intégration
|
|
|
|
Cette API est utilisée par :
|
|
- `api-filigrane` : Scan des fichiers avant traitement
|
|
- `api-anchorage` : (si nécessaire dans le futur)
|
|
|
|
## Mode dégradé
|
|
|
|
Si ClamAV n'est pas disponible, l'API retourne une erreur 503. Les services qui utilisent cette API peuvent choisir de continuer en mode dégradé (comme `api-filigrane`) ou de rejeter la requête.
|
|
|
|
## Sécurité
|
|
|
|
- Le service systemd utilise `NoNewPrivileges=true` et `PrivateTmp=true`
|
|
- Les fichiers sont scannés en mémoire (pas de fichiers temporaires sur disque)
|
|
- Limite de taille : 100MB par défaut
|
|
|
|
## Logs
|
|
|
|
Les logs sont envoyés vers `journald` via le service systemd :
|
|
|
|
```bash
|
|
sudo journalctl -u clamav-api -f
|
|
```
|
|
|
|
## Auteur
|
|
|
|
Équipe 4NK
|