187 lines
4.7 KiB
Markdown
187 lines
4.7 KiB
Markdown
# Service COFFRE
|
|
|
|
[TOC]
|
|
|
|
|
|
## Installation de Vaultwarden
|
|
|
|
**Pour la compilation du serveur, un minimum de 2.5Go de mémoire vive est requis (sans quoi la compilation échoue)**.
|
|
|
|
**Note : les opérations suivantes sont à faire avec l'utilisateur `admin666`.**
|
|
|
|
### Installation des dépendances
|
|
|
|
Installer des paquets `rustc` et `cargo` :
|
|
|
|
sudo apt install rustc cargo
|
|
|
|
### Compilation du serveur
|
|
|
|
Récupérer les sources :
|
|
|
|
cd ~
|
|
mkdir vaultwarden
|
|
git clone https://github.com/dani-garcia/vaultwarden ~/vaultwarden/vaultwarden
|
|
|
|
Choisir la bonne version à l'aide des tags :
|
|
|
|
git checkout <version>
|
|
|
|
Compiler le serveur avec Rust, en nettoyant bien avant :
|
|
|
|
cd vaultwarden/vaultwarden
|
|
cargo clean
|
|
cargo build --features sqlite --release
|
|
|
|
### Installation du serveur
|
|
|
|
Créer un utilisateur dédié :
|
|
|
|
sudo useradd -m -d /var/lib/vaultwarden vaultwarden
|
|
|
|
Installer le fichier de configuration par défaut :
|
|
|
|
sudo cp ~/vaultwarden/vaultwarden/.env.template /etc/vaultwarden.env
|
|
|
|
Installer le binaire :
|
|
|
|
sudo cp ~/vaultwarden/vaultwarden/target/release/vaultwarden /usr/bin/vaultwarden
|
|
sudo chmod +x /usr/bin/vaultwarden
|
|
|
|
Créer le dossier des données :
|
|
|
|
sudo mkdir /var/lib/vaultwarden/data
|
|
sudo chown -R vaultwarden:vaultwarden /var/lib/vaultwarden
|
|
|
|
|
|
|
|
### Création du fichier de service
|
|
|
|
Créer le fichier `/etc/systemd/system/vaultwarden.service` :
|
|
```
|
|
[Unit]
|
|
Description=Bitwarden Server (Powered by Vaultwarden)
|
|
Documentation=https://github.com/dani-garcia/vaultwarden
|
|
# If you use a database like mariadb,mysql or postgresql,
|
|
# you have to add them like the following and uncomment them
|
|
# by removing the `# ` before it. This makes sure that your
|
|
# database server is started before vaultwarden ("After") and has
|
|
# started successfully before starting vaultwarden ("Requires").
|
|
|
|
|
|
# Only sqlite
|
|
After=network.target
|
|
|
|
[Service]
|
|
# The user/group vaultwarden is run under. the working directory (see below) should allow write and read access to this user/group
|
|
User=vaultwarden
|
|
Group=vaultwarden
|
|
# The location of the .env file for configuration
|
|
EnvironmentFile=/etc/vaultwarden.env
|
|
# The location of the compiled binary
|
|
ExecStart=/usr/bin/vaultwarden
|
|
# Set reasonable connection and process limits
|
|
LimitNOFILE=1048576
|
|
LimitNPROC=64
|
|
# Isolate vaultwarden from the rest of the system
|
|
PrivateTmp=true
|
|
PrivateDevices=true
|
|
ProtectHome=true
|
|
ProtectSystem=strict
|
|
# Only allow writes to the following directory and set it to the working directory (user and password data are stored here)
|
|
WorkingDirectory=/var/lib/vaultwarden
|
|
ReadWriteDirectories=/var/lib/vaultwarden
|
|
# Allow vaultwarden to bind ports in the range of 0-1024
|
|
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
Recharger les services :
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
Redémarrer le service et rendre son démarrage automatique :
|
|
|
|
sudo systemctl start vaultwarden.service
|
|
sudo systemctl enable vaultwarden.service
|
|
|
|
## Mise à jour de Vaultwarden
|
|
|
|
Récupérer les commits dans le dépôt et on passe sur le tag de la dernière version (`<version>`) :
|
|
|
|
cd ~/vaultwarden/vaultwarden
|
|
git fetch
|
|
git checkout <version>
|
|
|
|
Compiler le serveur avec Rust, en nettoyant bien avant :
|
|
|
|
cargo clean
|
|
cargo build --features sqlite --release
|
|
|
|
Installer le binaire :
|
|
|
|
sudo cp ~/vaultwarden/vaultwarden/target/release/vaultwarden /usr/bin/vaultwarden
|
|
sudo chmod +x /usr/bin/vaultwarden
|
|
|
|
Redémarrer le service :
|
|
|
|
sudo systemctl restart vaultwarden.service
|
|
|
|
## Installation de l'interface web
|
|
|
|
Paramétrer la source pour la version la plus récente de nodejs :
|
|
|
|
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
|
|
|
Installer nodejs :
|
|
|
|
sudo apt install -y nodejs
|
|
sudo npm i npm@latest -g
|
|
|
|
Récupèrer les sources :
|
|
|
|
git clone https://github.com/dani-garcia/bw_web_builds ~/vaultwarden/webvault
|
|
|
|
Compiler :
|
|
|
|
cd ~/vaultwarden/webvault
|
|
make full
|
|
|
|
Installer l'interface web :
|
|
|
|
cd ~/vaultwarden/webvault
|
|
sudo cp -R builds/bw_web_<tag> /var/lib/vaultwarden/web-vault
|
|
|
|
Corriger les droits :
|
|
|
|
sudo chown -R vaultwarden:vaultwarden /var/lib/vaultwarden
|
|
|
|
## Mise à jour de l'interface web
|
|
|
|
Mettre à jour les dépendances :
|
|
|
|
sudo npm i npm@latest -g
|
|
|
|
Récupérer les commits dans le dépôt :
|
|
|
|
cd ~/vaultwarden/webvault
|
|
git pull
|
|
|
|
Compiler la dernière version de l'interface web :
|
|
|
|
cd ~/vaultwarden/webvault
|
|
make full
|
|
|
|
Lorsque demandé, insérer l'identifiant du tag le plus récent (dispo avec git tag).
|
|
|
|
Installer la version correspondant à `<tag>` :
|
|
|
|
sudo rm -r /var/lib/vaultwarden/web-vault
|
|
sudo cp -R ~/vaultwarden/webvault/builds/bw_web_<tag> /var/lib/vaultwarden/web-vault
|
|
|
|
Corriger les droits :
|
|
|
|
sudo chown -R vaultwarden:vaultwarden /var/lib/vaultwarden
|