====== Vaultwarden ====== Vaultwarden est une alternative open source à Bitwarden. L'avantage par rapport à Bitwarden est qu'il peut être auto hébergé et qu'il est compatible avec les applications Bitwarden. ===== Installation ===== On va l'installer via Docker compose. Créez un fichier docker-compose.yml et remplissez-le comme suit : services: vaultwarden: image: vaultwarden/server:latest container_name: vaultwarden restart: unless-stopped environment: - DOMAIN=https://domaine.fr - SIGNUPS_ALLOWED=false volumes: - ./vw-data:/data ports: - 127.0.0.1:8081:80 Modifiez le nom de domaine pour coller à celui que vous voulez utiliser. Si le port 8081 est déjà utilisé, vous pouvez en utiliser un autre. Lancez la commande suivante pour démarrer le docker : sudo docker compose up -d Passons à la configuration du reverse proxy. ===== Configuration de Apache ===== Créez un fichier de config et remplissez le comme suit en adaptant le nom de domaine et le port : ServerName domaine.fr Redirect / https://domaine.fr/ ServerName domaine.fr LogLevel warn CustomLog ${APACHE_LOG_DIR}/vaultwarden.access.log combined ErrorLog ${APACHE_LOG_DIR}/vaultwarden.error.log SSLEngine on SSLCertificateFile /etc/letsencrypt/live/domaine.fr/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/domaine.fr/privkey.pem ProxyPreserveHost On RequestHeader set X-Forwarded-Proto "https" RequestHeader set X-Forwarded-Port "443" # Reverse Proxy auf Vaultwarden (lokal) ProxyPass / http://127.0.0.1:8081/ nocanon ProxyPassReverse / http://127.0.0.1:8081/ # WebSocket für Live-Sync/Push ProxyPass "/notifications/hub" "ws://127.0.0.1:8081/notifications/hub" ProxyPassReverse "/notifications/hub" "ws://127.0.0.1:8081/notifications/hub" # intermediate configuration SSLProtocol -all +TLSv1.2 +TLSv1.3 SSLOpenSSLConfCmd Curves X25519:prime256v1:secp384r1 SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305 SSLHonorCipherOrder off SSLSessionTickets off # enable HTTP/2, if available Protocols h2 http/1.1 # HTTP Strict Transport Security (mod_headers is required) (63072000 seconds) Header always set Strict-Transport-Security "max-age=63072000" Header set X-Content-Type-Options "nosniff" Header set X-XSS-Protection "1; mode=block" Header unset X-Powered-By Header set Referrer-Policy: strict-origin-when-cross-origin Header set Permissions-Policy "accelerometer=(),battery=(),fullscreen=(self),geolocation=(),camera=(),ambient-light-sensor=(self),autoplay=(self)" Header set Content-Security-Policy "frame-ancestors 'self' *.domaine.fr; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self'; media-src 'self'; child-src 'self'; object-src 'self'; form-action 'self'; img-src 'self' * data:" Activez le vhost : sudo a2ensite domaine.conf Rechargez la config de Apache : sudo systemctl reload apache2 Il ne vous reste plus qu'à vous connecter et à créer un compte. Une fois que c'est fait, arrêtez le docker avec la commande sudo docker compose down Ouvrez le fichier docker-compose.yml et remplacez SIGNUPS_ALLOWED=true par SIGNUPS_ALLOWED=false pour désactiver les inscriptions. Puis redémarrez le docker : sudo docker compose up -d