<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://agora.nasqueron.org/index.php?action=history&amp;feed=atom&amp;title=Template%3ANote</id>
	<title>Template:Note - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://agora.nasqueron.org/index.php?action=history&amp;feed=atom&amp;title=Template%3ANote"/>
	<link rel="alternate" type="text/html" href="https://agora.nasqueron.org/index.php?title=Template:Note&amp;action=history"/>
	<updated>2026-04-21T13:31:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0-alpha</generator>
	<entry>
		<id>https://agora.nasqueron.org/index.php?title=Template:Note&amp;diff=2184&amp;oldid=prev</id>
		<title>Ptdradmin: Created page with &quot;= Installation et configuration d&#039;Anubis avec Nginx =  == Vue d&#039;ensemble ==  Anubis est un Web AI Firewall qui protège vos applications web contre les bots malveillants. Ce guide détaille l&#039;installation complète d&#039;Anubis en frontal de Nginx avec communication par socket UNIX.  === Architecture ===  &lt;pre&gt; Client → Nginx (HTTPS) → Anubis (socket UNIX) → Application backend &lt;/pre&gt;  === Prérequis ===  * Système Linux (RHEL 10, Debian, Ubuntu ou similaire) * Accès...&quot;</title>
		<link rel="alternate" type="text/html" href="https://agora.nasqueron.org/index.php?title=Template:Note&amp;diff=2184&amp;oldid=prev"/>
		<updated>2025-12-18T10:53:44Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Installation et configuration d&amp;#039;Anubis avec Nginx =  == Vue d&amp;#039;ensemble ==  Anubis est un Web AI Firewall qui protège vos applications web contre les bots malveillants. Ce guide détaille l&amp;#039;installation complète d&amp;#039;Anubis en frontal de Nginx avec communication par socket UNIX.  === Architecture ===  &amp;lt;pre&amp;gt; Client → Nginx (HTTPS) → Anubis (socket UNIX) → Application backend &amp;lt;/pre&amp;gt;  === Prérequis ===  * Système Linux (RHEL 10, Debian, Ubuntu ou similaire) * Accès...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Installation et configuration d&amp;#039;Anubis avec Nginx =&lt;br /&gt;
&lt;br /&gt;
== Vue d&amp;#039;ensemble ==&lt;br /&gt;
&lt;br /&gt;
Anubis est un Web AI Firewall qui protège vos applications web contre les bots malveillants. Ce guide détaille l&amp;#039;installation complète d&amp;#039;Anubis en frontal de Nginx avec communication par socket UNIX.&lt;br /&gt;
&lt;br /&gt;
=== Architecture ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Client → Nginx (HTTPS) → Anubis (socket UNIX) → Application backend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Prérequis ===&lt;br /&gt;
&lt;br /&gt;
* Système Linux (RHEL 10, Debian, Ubuntu ou similaire)&lt;br /&gt;
* Accès root/sudo&lt;br /&gt;
* Nginx installé et configuré&lt;br /&gt;
* Application backend fonctionnelle (ex: sur port 8080)&lt;br /&gt;
* Certificats SSL/TLS (optionnel mais recommandé)&lt;br /&gt;
&lt;br /&gt;
== Installation d&amp;#039;Anubis ==&lt;br /&gt;
&lt;br /&gt;
=== Méthode 1 : Compilation depuis les sources (RHEL/CentOS) ===&lt;br /&gt;
&lt;br /&gt;
==== Étape 1 : Installer les dépendances ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo dnf install -y git golang nodejs npm&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Étape 2 : Installer esbuild globalement ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo npm install -g esbuild&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Vérifier les versions installées :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
go version      # go1.25.3 ou supérieur&lt;br /&gt;
node --version  # v22.16.0 ou supérieur&lt;br /&gt;
npm --version   # 10.9.2 ou supérieur&lt;br /&gt;
esbuild --version # 0.27.2 ou supérieur&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Étape 3 : Cloner le dépôt Anubis ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /opt&lt;br /&gt;
sudo git clone https://github.com/TecharoHQ/anubis.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Étape 4 : Corriger les permissions ====&lt;br /&gt;
&lt;br /&gt;
Note| Le clonage avec sudo crée des fichiers appartenant à root. Il faut corriger cela :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo chown -R $USER:$USER /opt/anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Étape 5 : Installer les dépendances npm ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /opt/anubis&lt;br /&gt;
sudo npm install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Étape 6 : Générer le code et compiler ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /opt/anubis&lt;br /&gt;
rm -rf bin var           # Nettoyer les anciens builds&lt;br /&gt;
go mod download          # Télécharger les dépendances Go&lt;br /&gt;
go generate ./...        # Générer le code&lt;br /&gt;
go build -o var/anubis cmd/anubis/main.go  # Compiler&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Warning| Ces commandes doivent être exécutées &amp;#039;&amp;#039;&amp;#039;sans sudo&amp;#039;&amp;#039;&amp;#039; pour éviter les problèmes de permissions.&lt;br /&gt;
&lt;br /&gt;
Vérifier que le binaire a été créé :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls -l var/anubis&lt;br /&gt;
# Devrait afficher : -rwxr-xr-x. 1 user user 52659096 Dec 17 14:46 var/anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Étape 7 : Installer le binaire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo cp var/anubis /usr/bin/anubis&lt;br /&gt;
sudo chmod 755 /usr/bin/anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Vérifier l&amp;#039;installation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/usr/bin/anubis --version&lt;br /&gt;
# Devrait afficher : Anubis devel&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Méthode 2 : Installation via paquet .deb (Debian/Ubuntu) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo apt update&lt;br /&gt;
curl -OL https://github.com/TecharoHQ/anubis/releases/download/v1.19.1/anubis_1.19.1_linux_amd64.deb&lt;br /&gt;
sudo apt install ./anubis_1.19.1_linux_amd64.deb&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration d&amp;#039;Anubis ==&lt;br /&gt;
&lt;br /&gt;
=== Étape 1 : Créer le répertoire de configuration ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo mkdir -p /etc/anubis&lt;br /&gt;
sudo mkdir -p /run/anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Étape 2 : Créer le fichier de configuration principal ===&lt;br /&gt;
&lt;br /&gt;
Créer &amp;lt;code&amp;gt;/etc/anubis/site.env&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo tee /etc/anubis/site.env &amp;lt;&amp;lt;EOF&lt;br /&gt;
# Écoute sur socket UNIX&lt;br /&gt;
ANUBIS_LISTEN_ADDR=/run/anubis/site.sock&lt;br /&gt;
BIND_NETWORK=unix&lt;br /&gt;
SOCKET_MODE=0666&lt;br /&gt;
&lt;br /&gt;
# Backend cible (votre application)&lt;br /&gt;
ANUBIS_BACKEND=http://127.0.0.1:8080&lt;br /&gt;
TARGET=http://127.0.0.1:8080&lt;br /&gt;
&lt;br /&gt;
# Domaine du site&lt;br /&gt;
ANUBIS_SITE_DOMAIN=example.com&lt;br /&gt;
&lt;br /&gt;
# Mode de fonctionnement&lt;br /&gt;
ANUBIS_MODE=proxy&lt;br /&gt;
&lt;br /&gt;
# Fichier de politiques&lt;br /&gt;
POLICY_FNAME=/etc/anubis/site.botPolicies.yaml&lt;br /&gt;
&lt;br /&gt;
# Niveau de difficulté du challenge (1-5)&lt;br /&gt;
DIFFICULTY=3&lt;br /&gt;
&lt;br /&gt;
# Logging&lt;br /&gt;
LOG_LEVEL=info&lt;br /&gt;
&lt;br /&gt;
# Workers&lt;br /&gt;
WORKERS=2&lt;br /&gt;
&lt;br /&gt;
# Servir robots.txt&lt;br /&gt;
SERVE_ROBOTS_TXT=true&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Étape 3 : Créer le fichier de politiques anti-bots ===&lt;br /&gt;
&lt;br /&gt;
Créer &amp;lt;code&amp;gt;/etc/anubis/site.botPolicies.yaml&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo tee /etc/anubis/site.botPolicies.yaml &amp;lt;&amp;lt;EOF&lt;br /&gt;
version: 1&lt;br /&gt;
policies:&lt;br /&gt;
  - name: default&lt;br /&gt;
    rules:&lt;br /&gt;
      - type: allow&lt;br /&gt;
        bot: human&lt;br /&gt;
      - type: challenge&lt;br /&gt;
        bot: unknown&lt;br /&gt;
        difficulty: 3&lt;br /&gt;
      - type: block&lt;br /&gt;
        bot: malicious&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Étape 4 : Définir les permissions ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo chmod 644 /etc/anubis/site.env&lt;br /&gt;
sudo chmod 644 /etc/anubis/site.botPolicies.yaml&lt;br /&gt;
sudo chown -R root:root /etc/anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration du service Systemd ==&lt;br /&gt;
&lt;br /&gt;
=== Créer le fichier de service ===&lt;br /&gt;
&lt;br /&gt;
Pour une &amp;#039;&amp;#039;&amp;#039;instance unique&amp;#039;&amp;#039;&amp;#039;, créer &amp;lt;code&amp;gt;/etc/systemd/system/anubis.service&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo tee /etc/systemd/system/anubis.service &amp;lt;&amp;lt;EOF&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Anubis Web AI Firewall&lt;br /&gt;
After=network.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
User=root&lt;br /&gt;
Group=root&lt;br /&gt;
WorkingDirectory=/opt/anubis&lt;br /&gt;
ExecStart=/usr/bin/anubis&lt;br /&gt;
Restart=always&lt;br /&gt;
RestartSec=5&lt;br /&gt;
EnvironmentFile=/etc/anubis/site.env&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pour des &amp;#039;&amp;#039;&amp;#039;instances multiples&amp;#039;&amp;#039;&amp;#039; (plusieurs sites), créer &amp;lt;code&amp;gt;/etc/systemd/system/anubis@.service&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo tee /etc/systemd/system/anubis@.service &amp;lt;&amp;lt;EOF&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Anubis Web AI Firewall - Instance %i&lt;br /&gt;
After=network.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
User=root&lt;br /&gt;
Group=root&lt;br /&gt;
EnvironmentFile=/etc/anubis/%i.env&lt;br /&gt;
ExecStart=/usr/bin/anubis&lt;br /&gt;
Restart=on-failure&lt;br /&gt;
RestartSec=5&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Activer et démarrer le service ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo systemctl daemon-reload&lt;br /&gt;
sudo systemctl enable anubis&lt;br /&gt;
sudo systemctl start anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pour les instances multiples :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo systemctl enable anubis@site&lt;br /&gt;
sudo systemctl start anubis@site&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vérifier le statut du service ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo systemctl status anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Le service devrait afficher :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
● anubis.service - Anubis Web AI Firewall&lt;br /&gt;
     Loaded: loaded&lt;br /&gt;
     Active: active (running)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vérifier les logs ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo journalctl -u anubis -f&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vérifier la création du socket ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls -l /run/anubis/site.sock&lt;br /&gt;
# Devrait afficher : srwxrw-rw- 1 root root 0 Dec 17 14:46 /run/anubis/site.sock&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tester Anubis directement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl --unix-socket /run/anubis/site.sock http://anubis/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration de Nginx ==&lt;br /&gt;
&lt;br /&gt;
=== Étape 1 : Créer l&amp;#039;upstream Anubis ===&lt;br /&gt;
&lt;br /&gt;
Créer &amp;lt;code&amp;gt;/etc/nginx/conf.d/anubis-upstream.conf&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo tee /etc/nginx/conf.d/anubis-upstream.conf &amp;lt;&amp;lt;EOF&lt;br /&gt;
upstream anubis_backend {&lt;br /&gt;
    server unix:/run/anubis/site.sock;&lt;br /&gt;
    keepalive 32;&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Étape 2 : Configurer le virtual host ===&lt;br /&gt;
&lt;br /&gt;
Créer &amp;lt;code&amp;gt;/etc/nginx/sites-available/example.conf&amp;lt;/code&amp;gt; (ou &amp;lt;code&amp;gt;/etc/nginx/conf.d/example.conf&amp;lt;/code&amp;gt; sur RHEL) :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;nginx&amp;quot;&amp;gt;&lt;br /&gt;
# Redirection HTTP vers HTTPS&lt;br /&gt;
server {&lt;br /&gt;
    listen 80;&lt;br /&gt;
    listen [::]:80;&lt;br /&gt;
    server_name example.com www.example.com;&lt;br /&gt;
&lt;br /&gt;
    # Redirection permanente vers HTTPS&lt;br /&gt;
    return 301 https://$host$request_uri;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Configuration HTTPS avec Anubis&lt;br /&gt;
server {&lt;br /&gt;
    listen 443 ssl http2;&lt;br /&gt;
    listen [::]:443 ssl http2;&lt;br /&gt;
    server_name example.com www.example.com;&lt;br /&gt;
&lt;br /&gt;
    # Certificats SSL/TLS&lt;br /&gt;
    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;&lt;br /&gt;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;&lt;br /&gt;
&lt;br /&gt;
    # Paramètres SSL recommandés&lt;br /&gt;
    ssl_session_timeout 10m;&lt;br /&gt;
    ssl_session_cache shared:SSL:10m;&lt;br /&gt;
    ssl_protocols TLSv1.2 TLSv1.3;&lt;br /&gt;
    ssl_prefer_server_ciphers off;&lt;br /&gt;
    ssl_ciphers HIGH:!aNULL:!MD5;&lt;br /&gt;
&lt;br /&gt;
    # Headers de sécurité&lt;br /&gt;
    add_header X-Frame-Options DENY;&lt;br /&gt;
    add_header X-Content-Type-Options nosniff;&lt;br /&gt;
    add_header X-XSS-Protection &amp;quot;1; mode=block&amp;quot;;&lt;br /&gt;
    add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubDomains&amp;quot; always;&lt;br /&gt;
&lt;br /&gt;
    # Timeouts adaptés à Anubis&lt;br /&gt;
    proxy_read_timeout 180s;&lt;br /&gt;
    proxy_send_timeout 180s;&lt;br /&gt;
    proxy_connect_timeout 10s;&lt;br /&gt;
&lt;br /&gt;
    # Taille maximale des uploads&lt;br /&gt;
    client_max_body_size 10M;&lt;br /&gt;
&lt;br /&gt;
    # Proxy vers Anubis&lt;br /&gt;
    location / {&lt;br /&gt;
        proxy_http_version 1.1;&lt;br /&gt;
        proxy_set_header Host $host;&lt;br /&gt;
        proxy_set_header X-Real-IP $remote_addr;&lt;br /&gt;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;br /&gt;
        proxy_set_header X-Forwarded-Proto $scheme;&lt;br /&gt;
        proxy_set_header Connection &amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
        proxy_pass http://anubis_backend;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Étape 3 : Activer le site (Debian/Ubuntu) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo ln -s /etc/nginx/sites-available/example.conf /etc/nginx/sites-enabled/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note|Sur RHEL/CentOS, le fichier dans &amp;lt;code&amp;gt;/etc/nginx/conf.d/&amp;lt;/code&amp;gt; est automatiquement actif.&lt;br /&gt;
&lt;br /&gt;
=== Étape 4 : Tester et recharger Nginx ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Tester la configuration&lt;br /&gt;
sudo nginx -t&lt;br /&gt;
&lt;br /&gt;
# Si OK, recharger Nginx&lt;br /&gt;
sudo systemctl reload nginx&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Vérification du déploiement ==&lt;br /&gt;
&lt;br /&gt;
=== 1. Vérifier qu&amp;#039;Anubis fonctionne ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo systemctl status anubis&lt;br /&gt;
sudo journalctl -u anubis -n 50&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Vérifier le socket UNIX ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls -l /run/anubis/site.sock&lt;br /&gt;
sudo ss -xlp | grep anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3. Vérifier Nginx ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo systemctl status nginx&lt;br /&gt;
sudo nginx -t&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 4. Test d&amp;#039;accès via navigateur ===&lt;br /&gt;
&lt;br /&gt;
Ouvrir &amp;lt;code&amp;gt;https://example.com&amp;lt;/code&amp;gt; dans un navigateur. Vous devriez :&lt;br /&gt;
&lt;br /&gt;
# Voir le challenge Anubis si c&amp;#039;est la première visite&lt;br /&gt;
# Être redirigé vers votre application après validation&lt;br /&gt;
# Voir le header &amp;lt;code&amp;gt;X-Anubis-Status&amp;lt;/code&amp;gt; dans les réponses HTTP&lt;br /&gt;
&lt;br /&gt;
=== 5. Test avec curl ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Test complet de la chaîne&lt;br /&gt;
curl -I https://example.com&lt;br /&gt;
&lt;br /&gt;
# Devrait retourner un code 200 ou le challenge Anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 6. Vérifier les logs en temps réel ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Logs Anubis&lt;br /&gt;
sudo journalctl -u anubis -f&lt;br /&gt;
&lt;br /&gt;
# Logs Nginx&lt;br /&gt;
sudo tail -f /var/log/nginx/access.log&lt;br /&gt;
sudo tail -f /var/log/nginx/error.log&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Flux des requêtes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1. Client HTTPS → Nginx (port 443)&lt;br /&gt;
2. Nginx → Anubis (socket UNIX)&lt;br /&gt;
3. Anubis analyse la requête :&lt;br /&gt;
   - Fingerprint du client&lt;br /&gt;
   - Headers HTTP&lt;br /&gt;
   - Comportement&lt;br /&gt;
4. Anubis décide :&lt;br /&gt;
   - Challenge JS → Client doit résoudre&lt;br /&gt;
   - Allow → Passe au backend&lt;br /&gt;
   - Block → Requête bloquée&lt;br /&gt;
5. Backend traite la requête légitime&lt;br /&gt;
6. Backend → Anubis → Nginx → Client&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dépannage ==&lt;br /&gt;
&lt;br /&gt;
=== Le service Anubis ne démarre pas ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Vérifier les logs&lt;br /&gt;
sudo journalctl -u anubis -xe&lt;br /&gt;
&lt;br /&gt;
# Vérifier la configuration&lt;br /&gt;
cat /etc/anubis/site.env&lt;br /&gt;
&lt;br /&gt;
# Vérifier les permissions&lt;br /&gt;
ls -l /usr/bin/anubis&lt;br /&gt;
ls -ld /run/anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Le socket n&amp;#039;est pas créé ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Vérifier que le répertoire existe&lt;br /&gt;
sudo mkdir -p /run/anubis&lt;br /&gt;
&lt;br /&gt;
# Vérifier les permissions&lt;br /&gt;
sudo chmod 755 /run/anubis&lt;br /&gt;
&lt;br /&gt;
# Redémarrer Anubis&lt;br /&gt;
sudo systemctl restart anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Nginx ne peut pas se connecter au socket ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Vérifier les permissions du socket&lt;br /&gt;
ls -l /run/anubis/site.sock&lt;br /&gt;
&lt;br /&gt;
# Ajuster SOCKET_MODE dans site.env&lt;br /&gt;
SOCKET_MODE=0666&lt;br /&gt;
&lt;br /&gt;
# Redémarrer Anubis&lt;br /&gt;
sudo systemctl restart anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Erreur &amp;quot;permission denied&amp;quot; lors de la compilation ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Corriger la propriété des fichiers&lt;br /&gt;
sudo chown -R $USER:$USER /opt/anubis&lt;br /&gt;
&lt;br /&gt;
# Nettoyer et recompiler&lt;br /&gt;
cd /opt/anubis&lt;br /&gt;
rm -rf bin var&lt;br /&gt;
go generate ./...&lt;br /&gt;
go build -o var/anubis cmd/anubis/main.go&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Erreur &amp;quot;esbuild: command not found&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Réinstaller esbuild&lt;br /&gt;
sudo npm install -g esbuild&lt;br /&gt;
&lt;br /&gt;
# Vérifier l&amp;#039;installation&lt;br /&gt;
which esbuild&lt;br /&gt;
esbuild --version&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optimisations recommandées ==&lt;br /&gt;
&lt;br /&gt;
=== 1. Cache Anubis ===&lt;br /&gt;
&lt;br /&gt;
Ajouter dans &amp;lt;code&amp;gt;/etc/anubis/site.env&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
CACHE_SIZE=50000&lt;br /&gt;
CACHE_TTL=300&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Rate limiting ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
RATE_LIMIT_MODE=smart&lt;br /&gt;
FIREWALL_MODE=strict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3. Nginx keepalive ===&lt;br /&gt;
&lt;br /&gt;
Dans &amp;lt;code&amp;gt;anubis-upstream.conf&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;nginx&amp;quot;&amp;gt;&lt;br /&gt;
upstream anubis_backend {&lt;br /&gt;
    server unix:/run/anubis/site.sock;&lt;br /&gt;
    keepalive 64;&lt;br /&gt;
    keepalive_requests 1000;&lt;br /&gt;
    keepalive_timeout 60s;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 4. Logs structurés ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_LEVEL=info&lt;br /&gt;
LOG_FORMAT=json&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
=== Redémarrer Anubis ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo systemctl restart anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Recharger la configuration sans interruption ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Éditer la configuration&lt;br /&gt;
sudo nano /etc/anubis/site.env&lt;br /&gt;
&lt;br /&gt;
# Redémarrer le service&lt;br /&gt;
sudo systemctl restart anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mettre à jour Anubis ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Arrêter le service&lt;br /&gt;
sudo systemctl stop anubis&lt;br /&gt;
&lt;br /&gt;
# Compiler la nouvelle version&lt;br /&gt;
cd /opt/anubis&lt;br /&gt;
git pull&lt;br /&gt;
rm -rf bin var&lt;br /&gt;
go generate ./...&lt;br /&gt;
go build -o var/anubis cmd/anubis/main.go&lt;br /&gt;
&lt;br /&gt;
# Installer le nouveau binaire&lt;br /&gt;
sudo cp var/anubis /usr/bin/anubis&lt;br /&gt;
sudo chmod 755 /usr/bin/anubis&lt;br /&gt;
&lt;br /&gt;
# Redémarrer&lt;br /&gt;
sudo systemctl start anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sauvegarder la configuration ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo tar czf anubis-config-backup-$(date +%Y%m%d).tar.gz /etc/anubis/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sécurité ==&lt;br /&gt;
&lt;br /&gt;
=== Durcissement du service ===&lt;br /&gt;
&lt;br /&gt;
Éditer &amp;lt;code&amp;gt;/etc/systemd/system/anubis.service&amp;lt;/code&amp;gt; et ajouter :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[Service]&lt;br /&gt;
NoNewPrivileges=true&lt;br /&gt;
PrivateTmp=true&lt;br /&gt;
ProtectSystem=strict&lt;br /&gt;
ProtectHome=true&lt;br /&gt;
ReadWritePaths=/run/anubis&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firewall ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Bloquer l&amp;#039;accès direct au backend&lt;br /&gt;
sudo firewall-cmd --permanent --add-rich-rule=&amp;#039;rule family=&amp;quot;ipv4&amp;quot; source address=&amp;quot;0.0.0.0/0&amp;quot; port port=&amp;quot;8080&amp;quot; protocol=&amp;quot;tcp&amp;quot; reject&amp;#039;&lt;br /&gt;
sudo firewall-cmd --reload&lt;br /&gt;
&lt;br /&gt;
# Ou avec iptables&lt;br /&gt;
sudo iptables -A INPUT -p tcp --dport 8080 -s 127.0.0.1 -j ACCEPT&lt;br /&gt;
sudo iptables -A INPUT -p tcp --dport 8080 -j DROP&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Instances multiples ==&lt;br /&gt;
&lt;br /&gt;
Pour gérer plusieurs sites avec Anubis :&lt;br /&gt;
&lt;br /&gt;
=== 1. Créer des configurations séparées ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo cp /etc/anubis/site.env /etc/anubis/site2.env&lt;br /&gt;
sudo cp /etc/anubis/site.botPolicies.yaml /etc/anubis/site2.botPolicies.yaml&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Modifier les configurations ===&lt;br /&gt;
&lt;br /&gt;
Éditer &amp;lt;code&amp;gt;/etc/anubis/site2.env&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ANUBIS_LISTEN_ADDR=/run/anubis/site2.sock&lt;br /&gt;
ANUBIS_BACKEND=http://127.0.0.1:8081&lt;br /&gt;
ANUBIS_SITE_DOMAIN=example2.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3. Démarrer l&amp;#039;instance ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo systemctl enable anubis@site2&lt;br /&gt;
sudo systemctl start anubis@site2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 4. Créer l&amp;#039;upstream Nginx correspondant ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;nginx&amp;quot;&amp;gt;&lt;br /&gt;
upstream anubis_site2 {&lt;br /&gt;
    server unix:/run/anubis/site2.sock;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Monitoring ==&lt;br /&gt;
&lt;br /&gt;
=== Métriques Anubis ===&lt;br /&gt;
&lt;br /&gt;
Anubis expose des métriques (si configuré) :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Dans site.env&lt;br /&gt;
METRICS_ENABLED=true&lt;br /&gt;
METRICS_ADDR=127.0.0.1:9090&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Monitoring avec Prometheus ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
scrape_configs:&lt;br /&gt;
  - job_name: &amp;#039;anubis&amp;#039;&lt;br /&gt;
    static_configs:&lt;br /&gt;
      - targets: [&amp;#039;localhost:9090&amp;#039;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Références ==&lt;br /&gt;
&lt;br /&gt;
* [https://anubis.techaro.lol/docs/ Documentation officielle]&lt;br /&gt;
* [https://github.com/TecharoHQ/anubis Dépôt GitHub]&lt;br /&gt;
* [https://anubis.techaro.lol/docs/admin/configuration/ Configuration avancée]&lt;br /&gt;
&lt;br /&gt;
== Résumé des commandes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Installation&lt;br /&gt;
cd /opt&lt;br /&gt;
sudo git clone https://github.com/TecharoHQ/anubis.git&lt;br /&gt;
sudo chown -R $USER:$USER /opt/anubis&lt;br /&gt;
cd /opt/anubis&lt;br /&gt;
sudo npm install -g esbuild&lt;br /&gt;
go generate ./...&lt;br /&gt;
go build -o var/anubis cmd/anubis/main.go&lt;br /&gt;
sudo cp var/anubis /usr/bin/anubis&lt;br /&gt;
&lt;br /&gt;
# Configuration&lt;br /&gt;
sudo mkdir -p /etc/anubis /run/anubis&lt;br /&gt;
sudo nano /etc/anubis/site.env&lt;br /&gt;
sudo nano /etc/anubis/site.botPolicies.yaml&lt;br /&gt;
&lt;br /&gt;
# Service&lt;br /&gt;
sudo systemctl daemon-reload&lt;br /&gt;
sudo systemctl enable --now anubis&lt;br /&gt;
sudo systemctl status anubis&lt;br /&gt;
&lt;br /&gt;
# Nginx&lt;br /&gt;
sudo nginx -t&lt;br /&gt;
sudo systemctl reload nginx&lt;br /&gt;
&lt;br /&gt;
# Vérification&lt;br /&gt;
curl --unix-socket /run/anubis/site.sock http://anubis/&lt;br /&gt;
curl -I https://example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ptdradmin</name></author>
	</entry>
</feed>