**Motivations:** - Export Signet and mining wallet backups to git with only 2 versions kept - Document and add backup/restore scripts for signet and mining wallet **Correctifs:** - Backup-to-git uses SSH URL for passwordless cron; copy timestamped files only; prune to 2 versions; remove *-latest from backup repo **Evolutions:** - data/backup-to-git-cron.sh: daily export to git.4nkweb.com/4nk/backup - save-signet-datadir-backup.sh, restore-signet-from-backup.sh, export-mining-wallet.sh, import-mining-wallet.sh - features/backup-to-git-daily-cron.md, docs/MAINTENANCE.md backup section - .gitignore: data/backup-to-git.log **Pages affectées:** - .gitignore, data/backup-to-git-cron.sh, docs/MAINTENANCE.md, features/backup-to-git-daily-cron.md - save-signet-datadir-backup.sh, restore-signet-from-backup.sh, export-mining-wallet.sh, import-mining-wallet.sh - Plus autres fichiers modifiés ou non suivis déjà présents dans le working tree
240 lines
9.2 KiB
Markdown
240 lines
9.2 KiB
Markdown
# Domaines et Ports - Infrastructure Certificator
|
||
|
||
**Auteur** : Équipe 4NK
|
||
**Date** : 2026-01-24
|
||
**Version** : 1.0
|
||
|
||
## Vue d'Ensemble
|
||
|
||
Ce document liste tous les domaines, ports et services de l'infrastructure Certificator Bitcoin Signet.
|
||
|
||
## Domaines et Services
|
||
|
||
### Domaines Principaux
|
||
|
||
| Domaine | Service | Port Local | Description |
|
||
|---------|---------|------------|-------------|
|
||
| `anchorage.certificator.4nkweb.com` | API d'Ancrage | 3010 | API REST pour ancrer des documents (machine bitcoin 192.168.1.105) |
|
||
| `certificator.4nkweb.com` | API LeCoffre Anchor | 3004 | API REST LeCoffre pour ancrer (machine prod 192.168.1.103) |
|
||
| `watermark.certificator.4nkweb.com` | API Filigrane | 3022 | API REST pour ajouter des filigranes et ancrer |
|
||
| `antivir.certificator.4nkweb.com` | API ClamAV | 3023 | API REST pour scanner les fichiers (antivirus) |
|
||
| `dashboard.certificator.4nkweb.com` | Dashboard | 3020 | Interface web de supervision |
|
||
| `faucet.certificator.4nkweb.com` | API Faucet | 3021 | API REST pour distribuer des sats |
|
||
| `mempool.4nkweb.com` | Mempool | 3015 | Explorateur de blockchain Bitcoin (machine bitcoin 192.168.1.105) |
|
||
| `skeleton.certificator.4nkweb.com` | Website skeleton | 3024 | Site squelette iframe UserWallet |
|
||
| `data.certificator.4nkweb.com` | Website data | 3025 | Iframe data (non clés), site ↔ data ↔ userwallet |
|
||
|
||
### Écoute des services : IPv4 uniquement, flux reçus du proxy (192.168.1.100)
|
||
|
||
Les services backend écoutent en **IPv4 uniquement** (pas d’écoute sur `[::]`) et n’acceptent les flux que **reçus de la machine proxy (192.168.1.100)** :
|
||
|
||
- **Bind** : chaque service écoute sur l’adresse IPv4 de sa machine (`DASHBOARD_HOST=192.168.1.105` sur bitcoin, `FAUCET_API_HOST=192.168.1.103` sur prod, etc.).
|
||
- **Restriction à la source** : si `ALLOWED_SOURCE_IP=192.168.1.100` est défini, toute requête dont la source n’est pas le proxy est rejetée (403).
|
||
|
||
Voir `features/services-ecoute-ipv4-proxy.md` et `docs/ENVIRONMENT.md`.
|
||
|
||
### Configuration Nginx
|
||
|
||
Tous les domaines sont routés via le proxy Nginx sur le serveur `192.168.1.100` (proxy).
|
||
|
||
**Configuration du proxy :**
|
||
- Point d'entrée unique : `4nk.myftp.biz` (DynDNS)
|
||
- Routage HTTPS vers les services backend appropriés
|
||
- Certificats SSL/TLS : Let's Encrypt (renouvellement automatique)
|
||
|
||
## Ports Fixes
|
||
|
||
### Ports des APIs (Fixés dans les services systemd)
|
||
|
||
| Port | Service | API | Fichier de Service |
|
||
|------|---------|-----|-------------------|
|
||
| 3010 | API d'Ancrage | `api-anchorage` | `api-anchorage/anchorage-api.service` |
|
||
| 3020 | Dashboard | `signet-dashboard` | `signet-dashboard/signet-dashboard.service` |
|
||
| 3021 | API Faucet | `api-faucet` | `api-faucet/faucet-api.service` |
|
||
| 3022 | API Filigrane | `api-filigrane` | `api-filigrane/filigrane-api.service` |
|
||
| 3023 | API ClamAV | `api-clamav` | `api-clamav/clamav-api.service` |
|
||
| 3024 | Website skeleton | `website-skeleton` | `website-skeleton/website-skeleton.service` |
|
||
| 3025 | Website data | `website-data` | (à définir, ex. `website-data/website-data.service`) |
|
||
|
||
**Important :** Les ports 3010, 3020, 3021, 3022, 3023, 3024 sont fixes et définis dans les fichiers de service systemd. Ils ne peuvent pas être modifiés sans modifier les services.
|
||
|
||
### Ports Bitcoin Core
|
||
|
||
| Port | Protocole | Service | Description |
|
||
|------|-----------|---------|-------------|
|
||
| 38332 | TCP | RPC | Interface JSON-RPC pour contrôler le nœud |
|
||
| 38333 | TCP/UDP | P2P | Réseau peer-to-peer Bitcoin Signet |
|
||
| 28332 | TCP | ZMQ | Publication des blocs bruts |
|
||
| 28333 | TCP | ZMQ | Publication des transactions brutes |
|
||
| 28334 | TCP | ZMQ | Publication des hash de blocs |
|
||
|
||
### Ports Mempool
|
||
|
||
| Port | Protocole | Service | Description |
|
||
|------|-----------|---------|-------------|
|
||
| 3015 | HTTP/HTTPS | Web | Interface web Mempool (exposé via nginx) |
|
||
| 8999 | HTTP | API | Mempool Backend API (interne) |
|
||
|
||
## Services Systemd
|
||
|
||
Tous les services sont configurés avec systemd pour un redémarrage automatique.
|
||
|
||
### Liste des Services
|
||
|
||
```bash
|
||
# Vérifier le statut de tous les services
|
||
sudo systemctl status anchorage-api
|
||
sudo systemctl status signet-dashboard
|
||
sudo systemctl status faucet-api
|
||
sudo systemctl status filigrane-api
|
||
sudo systemctl status clamav-api
|
||
sudo systemctl status website-skeleton
|
||
```
|
||
|
||
### Commandes de Gestion
|
||
|
||
```bash
|
||
# Démarrer un service
|
||
sudo systemctl start <service-name>
|
||
|
||
# Arrêter un service
|
||
sudo systemctl stop <service-name>
|
||
|
||
# Redémarrer un service
|
||
sudo systemctl restart <service-name>
|
||
|
||
# Voir les logs
|
||
sudo journalctl -u <service-name> -f
|
||
|
||
# Activer au démarrage
|
||
sudo systemctl enable <service-name>
|
||
|
||
# Désactiver au démarrage
|
||
sudo systemctl disable <service-name>
|
||
```
|
||
|
||
## Architecture Réseau
|
||
|
||
```
|
||
Internet
|
||
│
|
||
├─→ 4nk.myftp.biz (DynDNS)
|
||
│ └─→ 192.168.1.100 (proxy) - Point d'entrée unique
|
||
│ │
|
||
│ ├─→ anchorage.certificator.4nkweb.com → 192.168.1.105:3010 (API Anchorage Bitcoin)
|
||
│ ├─→ certificator.4nkweb.com → 192.168.1.103:3004 (API LeCoffre Anchor)
|
||
│ ├─→ watermark.certificator.4nkweb.com → 192.168.1.103:3022 (API Filigrane)
|
||
│ ├─→ antivir.certificator.4nkweb.com → 192.168.1.103:3023 (API ClamAV)
|
||
│ ├─→ dashboard.certificator.4nkweb.com → 192.168.1.105:3020 (Dashboard, machine bitcoin)
|
||
│ ├─→ skeleton.certificator.4nkweb.com → 192.168.1.105:3024 (Website skeleton)
|
||
│ ├─→ faucet.certificator.4nkweb.com → 192.168.1.103:3021 (API Faucet)
|
||
│ └─→ mempool.4nkweb.com → 192.168.1.105:3015 (Mempool, machine bitcoin)
|
||
```
|
||
|
||
## Vérification des Ports
|
||
|
||
### Vérifier qu'un port est en écoute
|
||
|
||
```bash
|
||
# Vérifier un port spécifique
|
||
sudo ss -tlnp | grep :3010
|
||
|
||
# Vérifier tous les ports des APIs
|
||
sudo ss -tlnp | grep -E ':(3010|3020|3021|3022|3023|3024)'
|
||
```
|
||
|
||
### Tester la connectivité
|
||
|
||
```bash
|
||
# Tester depuis le serveur
|
||
curl http://localhost:3010/health
|
||
curl -s http://localhost:3020/api/blockchain/info | head -c 200 # Dashboard : pas de /health
|
||
curl http://localhost:3021/health
|
||
curl http://localhost:3022/health
|
||
curl http://localhost:3023/health
|
||
|
||
# Tester depuis l'extérieur (via domaine)
|
||
curl https://anchorage.certificator.4nkweb.com/health
|
||
curl https://certificator.4nkweb.com/health
|
||
curl -s https://dashboard.certificator.4nkweb.com/api/blockchain/info | head -c 200
|
||
```
|
||
|
||
## Certificats SSL/TLS
|
||
|
||
Tous les domaines utilisent des certificats Let's Encrypt gérés automatiquement par Certbot.
|
||
|
||
### Vérifier les certificats
|
||
|
||
```bash
|
||
# Sur le serveur proxy (192.168.1.100)
|
||
sudo certbot certificates
|
||
|
||
# Vérifier un certificat spécifique
|
||
openssl s_client -connect certificator.4nkweb.com:443 -servername certificator.4nkweb.com
|
||
```
|
||
|
||
### Renouvellement
|
||
|
||
Le renouvellement est automatique via Certbot. Pour forcer un renouvellement :
|
||
|
||
```bash
|
||
sudo certbot renew
|
||
```
|
||
|
||
## DNS
|
||
|
||
Tous les domaines utilisent des enregistrements CNAME pointant vers `4nk.myftp.biz` (DynDNS).
|
||
|
||
**Exemple de configuration DNS (Gandi) :**
|
||
```
|
||
anchorage.certificator.4nkweb.com. 3600 IN CNAME 4nk.myftp.biz.
|
||
certificator.4nkweb.com. 3600 IN CNAME 4nk.myftp.biz.
|
||
watermark.certificator.4nkweb.com. 3600 IN CNAME 4nk.myftp.biz.
|
||
antivir.certificator.4nkweb.com. 3600 IN CNAME 4nk.myftp.biz.
|
||
dashboard.certificator.4nkweb.com. 3600 IN CNAME 4nk.myftp.biz.
|
||
faucet.certificator.4nkweb.com. 3600 IN CNAME 4nk.myftp.biz.
|
||
```
|
||
|
||
## APIs d'Ancrage
|
||
|
||
Il existe deux APIs d'ancrage distinctes :
|
||
|
||
### 1. API d'Ancrage Bitcoin (`anchorage.certificator.4nkweb.com`)
|
||
|
||
- **Domaine :** `anchorage.certificator.4nkweb.com`
|
||
- **Machine :** 192.168.1.105 (bitcoin)
|
||
- **Port :** 3010
|
||
- **Service systemd :** `anchorage-api`
|
||
- **Répertoire :** `/home/ncantu/Bureau/code/bitcoin/api-anchorage`
|
||
- **Bitcoin RPC :** 127.0.0.1:38332 (Bitcoin Core dans Docker sur la même machine)
|
||
- **Description :** API principale pour ancrer des documents sur Bitcoin Signet
|
||
|
||
### 2. API LeCoffre Anchor (`certificator.4nkweb.com`)
|
||
|
||
- **Domaine :** `certificator.4nkweb.com`
|
||
- **Machine :** 192.168.1.103 (prod)
|
||
- **Port :** 3004
|
||
- **Service :** Processus Node.js dans `/srv/4NK/certificator.4nkweb.com/lecoffre-anchor-api`
|
||
- **Bitcoin RPC :** localhost:18443 (Bitcoin Core sur machine distante)
|
||
- **Description :** API LeCoffre pour ancrer des documents (service séparé)
|
||
|
||
**Important :** Pour l'API d'ancrage Bitcoin principale, utiliser `anchorage.certificator.4nkweb.com` qui pointe vers la machine bitcoin (192.168.1.105).
|
||
|
||
## Notes Importantes
|
||
|
||
1. **Ports fixes** : Tous les ports des APIs sont fixes et définis dans les services systemd. Ne pas modifier sans mettre à jour les services.
|
||
|
||
2. **Redémarrage automatique** : Tous les services sont configurés avec `Restart=always` pour un redémarrage automatique en cas d'échec.
|
||
|
||
3. **Sécurité** : Les services utilisent `NoNewPrivileges=true` et `PrivateTmp=true` pour une meilleure sécurité.
|
||
|
||
4. **Logs** : Tous les logs sont envoyés vers `journald` et peuvent être consultés avec `journalctl`.
|
||
|
||
5. **Environnement** : Les variables d'environnement (ports, hosts) sont définies dans les fichiers de service systemd.
|
||
|
||
## Références
|
||
|
||
- [Documentation Infrastructure Cloud 4NK](../Infrastructure_Cloud_4NK.md) (si disponible)
|
||
- [Documentation Maintenance](./MAINTENANCE.md)
|
||
- [Documentation Environnement](./ENVIRONMENT.md)
|