205 lines
4.8 KiB
Markdown
205 lines
4.8 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)**.
|
|
|
|
### Installation des dépendances
|
|
|
|
Installation des paquets `rustc` et `cargo` :
|
|
|
|
sudo apt install rustc cargo
|
|
|
|
### Compilation du serveur
|
|
|
|
On récupère les sources :
|
|
|
|
cd ~
|
|
mkdir vaultwarden
|
|
git clone https://github.com/dani-garcia/vaultwarden ~/vaultwarden/vaultwarden
|
|
|
|
On choisit la bonne version à l'aide des tags :
|
|
|
|
git checkout <version>
|
|
|
|
On compile avec rust le serveur, en nettoyant bien avant :
|
|
|
|
cd vaultwarden/vaultwarden
|
|
cargo clean
|
|
cargo build --features sqlite --release
|
|
|
|
### Installation du serveur
|
|
|
|
Installation du fichier de configuration par défaut :
|
|
|
|
sudo cp ../../.env.template /etc/vaultwarden.env
|
|
|
|
Installation du binaire :
|
|
|
|
sudo cp vaultwarden /usr/bin/vaultwarden
|
|
|
|
Création du dossier des données :
|
|
|
|
sudo mkdir /var/lib/vaultwarden/data
|
|
|
|
Correction des droits :
|
|
|
|
sudo chmod +x /usr/bin/vaultwarden
|
|
sudo useradd -m -d /var/lib/vaultwarden vaultwarden
|
|
sudo chown -R vaultwarden:vaultwarden /var/lib/vaultwarden
|
|
|
|
### Création du fichier de service
|
|
|
|
On crée le fichier :
|
|
|
|
sudo nano /etc/systemd/system/vaultwarden.service
|
|
|
|
Avec le contenu suivant :
|
|
|
|
```
|
|
[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
|
|
```
|
|
|
|
On recharge les services
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
On démarre
|
|
|
|
sudo systemctl start vaultwarden.service
|
|
sudo systemctl enable vaultwarden.service
|
|
|
|
|
|
|
|
## Mise à jour de Vaultwarden
|
|
|
|
### Récupération des mises à jour
|
|
|
|
On récupère 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>
|
|
|
|
### Mise à jour du serveur
|
|
|
|
On compile avec rust le serveur, en nettoyant bien avant.
|
|
|
|
cargo clean
|
|
cargo build --features sqlite --release
|
|
|
|
|
|
On installe le binaire
|
|
|
|
sudo cp target/release/vaultwarden /usr/bin/vaultwarden
|
|
sudo chmod +x /usr/bin/vaultwarden
|
|
|
|
On redémarre le service
|
|
|
|
sudo systemctl restart vaultwarden.service
|
|
|
|
|
|
|
|
## Installation de l'interface web
|
|
|
|
### Installation des dépendances
|
|
|
|
On paramètre la source pour la version la plus récente de nodejs
|
|
|
|
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
|
|
|
On installe nodejs
|
|
|
|
sudo apt install -y nodejs
|
|
sudo npm i npm@latest -g
|
|
|
|
### Compiler la dernière version de l'interface web
|
|
|
|
On récupère les sources
|
|
|
|
git clone https://github.com/dani-garcia/bw_web_builds ~/vaultwarden/webvault
|
|
|
|
On compile
|
|
|
|
cd ~/vaultwarden/webvault
|
|
make full
|
|
|
|
### Installation de l'interface web
|
|
|
|
cd ~/vaultwarden/webvault
|
|
sudo cp -R builds/bw_web_<tag> /var/lib/vaultwarden/web-vault
|
|
|
|
Correction des droits
|
|
|
|
sudo chown -R vaultwarden:vaultwarden /var/lib/vaultwarden
|
|
|
|
## Mise à jour de l'interface web
|
|
|
|
### Mise à jour des dépendances
|
|
|
|
sudo npm i npm@latest -g
|
|
|
|
### Récupération des mises à jour
|
|
|
|
On récupère 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 l'interface web
|
|
|
|
On installe la version correspondant à `<tag>`
|
|
|
|
cd ~/vaultwarden/webvault
|
|
sudo rm -r /var/lib/vaultwarden/web-vault
|
|
sudo cp -R builds/bw_web_<tag> /var/lib/vaultwarden/web-vault
|
|
|
|
Correction des droits
|
|
|
|
sudo chown -R vaultwarden:vaultwarden /var/lib/vaultwarden
|