diff options
-rw-r--r-- | README.md | 26 | ||||
-rw-r--r-- | etc/vaultwarden/vaultwarden (renamed from etc/bitwarden_rs/bitwarden_rs.env) | 4 | ||||
-rwxr-xr-x | mkosi.build | 12 | ||||
-rw-r--r-- | mkosi.default | 2 | ||||
-rw-r--r-- | mkosi.extra/etc/systemd/system/bitwarden_rs.service | 29 | ||||
-rw-r--r-- | mkosi.extra/etc/systemd/system/vaultwarden.service | 29 | ||||
-rw-r--r-- | mkosi.nspawn | 6 | ||||
-rwxr-xr-x | mkosi.postinst | 14 |
8 files changed, 61 insertions, 61 deletions
@@ -1,25 +1,25 @@ -# A mkosi-template for Bitwarden_RS +# A mkosi-template for Vaultwarden This is a mkosi-template for -[Bitwarden_RS](https://github.com/dani-garcia/bitwarden_rs). In order to set +[Vaultwarden](https://github.com/dani-garcia/vaultwarden). In order to set this up you need Mkosi >=5. To build this, run `sudo mkosi`. This will create a new container in -`/var/lib/machines` called `bitwarden-rs`. Next you should symlink the +`/var/lib/machines` called `vaultwarden`. Next you should symlink the `.nspawn`-config to `/etc/systemd/nspawn` using `sudo ln -s -/var/lib/machines/bitwarden-rs.nspawn /etc/systemd/nspawn/`. +/var/lib/machines/vaultwarden.nspawn /etc/systemd/nspawn/`. After that you need to create the folders we mount into the image. This is -`/etc/bitwarden_rs` and `/var/local/bitwarden_rs`. These should be owned by +`/etc/vaultwarden` and `/var/local/vaultwarden`. These should be owned by root, and have `700` set as permissions. -Then you need to copy `etc/bitwarden_rs/bitwarden_rs.env` to -`/etc/bitwarden_rs/`, and set all your variables. You also need to create a +Then you need to copy `etc/vaultwarden/vaultwarden.env` to +`/etc/vaultwarden/`, and set all your variables. You also need to create a database (using PostgreSQL). Lastly you need to set up a web-proxy - see the -[Bitwarden_RS wiki](https://github.com/dani-garcia/bitwarden_rs/wiki) for -[examples](https://github.com/dani-garcia/bitwarden_rs/wiki/Proxy-examples). +[vaultwarden wiki](https://github.com/dani-garcia/vaultwarden/wiki) for +[examples](https://github.com/dani-garcia/vaultwarden/wiki/Proxy-examples). -Now all you need to do is to run it - `machinectl start bitwarden-rs`. You can -drop into the container to troubleshoot using `machinectl shell bitwarden-rs`, -and you can view logs using `journalctl -M bitwarden-rs` from the host, or -`journalctl -u bitwarden_rs` from inside the container. +Now all you need to do is to run it - `machinectl start vaultwarden`. You can +drop into the container to troubleshoot using `machinectl shell vaultwarden`, +and you can view logs using `journalctl -M vaultwarden` from the host, or +`journalctl -u vaultwarden` from inside the container. diff --git a/etc/bitwarden_rs/bitwarden_rs.env b/etc/vaultwarden/vaultwarden index 79b93f4..91ba017 100644 --- a/etc/bitwarden_rs/bitwarden_rs.env +++ b/etc/vaultwarden/vaultwarden @@ -1,4 +1,4 @@ -## Bitwarden_RS Configuration File +## Vaultwarden Configuration File ## Uncomment any of the following lines to change the defaults ## Main data folder @@ -62,7 +62,7 @@ ## Enable WAL for the DB ## Set to false to avoid enabling WAL during startup. ## Note that if the DB already has WAL enabled, you will also need to disable WAL in the DB, -## this setting only prevents bitwarden_rs from automatically enabling it on start. +## this setting only prevents vaultwarden from automatically enabling it on start. ## Please read project wiki page about this setting first before changing the value as it can ## cause performance degradation or might render the service unable to start. # ENABLE_DB_WAL=true diff --git a/mkosi.build b/mkosi.build index 7453459..0fac659 100755 --- a/mkosi.build +++ b/mkosi.build @@ -8,16 +8,16 @@ export RUSTUP_HOME=/root/.rustup \ VAULT_VERSION=v2.15.1 mkdir /root/src && cd /root/src -git clone https://github.com/dani-garcia/bitwarden_rs.git +git clone https://github.com/dani-garcia/vaultwarden.git ## get vault ## -mkdir /root/src/bitwarden_rs -cd /root/src/bitwarden_rs +mkdir /root/src/vaultwarden +cd /root/src/vaultwarden curl -L https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz | tar xz -cd /root/src/bitwarden_rs +cd /root/src/vaultwarden ## Setting up rust for build ## @@ -34,11 +34,11 @@ cargo --version rustc --version -## building bitwarden_rs ## +## building vaultwarden ## cargo build --features postgresql --release ## move stuff ## mv web-vault ${DESTDIR}/ -mv target/release/bitwarden_rs ${DESTDIR}/ +mv target/release/vaultwarden ${DESTDIR}/ diff --git a/mkosi.default b/mkosi.default index 989f36a..5e7b9a7 100644 --- a/mkosi.default +++ b/mkosi.default @@ -6,7 +6,7 @@ Mirror=http://no.archive.ubuntu.com/ubuntu [Output] Format=directory -Output=/var/lib/machines/bitwarden-rs +Output=/var/lib/machines/vaultwarden [Packages] WithNetwork=yes diff --git a/mkosi.extra/etc/systemd/system/bitwarden_rs.service b/mkosi.extra/etc/systemd/system/bitwarden_rs.service deleted file mode 100644 index c6d3322..0000000 --- a/mkosi.extra/etc/systemd/system/bitwarden_rs.service +++ /dev/null @@ -1,29 +0,0 @@ -[Unit] -Description=Bitwarden Server (Rust Edition) -Documentation=https://github.com/dani-garcia/bitwarden_rs -After=network.target - -[Service] -# The user/group bitwarden_rs is run under. the working directory (see below) should allow write and read access to this user/group -User=bitwarden_rs -Group=bitwarden_rs -# The location of the .env file for configuration -EnvironmentFile=/etc/bitwarden_rs/bitwarden_rs.env -# The location of the compiled binary -ExecStart=/usr/local/bin/bitwarden_rs -# Set reasonable connection and process limits -LimitNOFILE=1048576 -LimitNPROC=64 -# Isolate bitwarden_rs 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/bitwarden_rs -ReadWriteDirectories=/var/lib/bitwarden_rs -# Allow bitwarden_rs to bind ports in the range of 0-1024 -AmbientCapabilities=CAP_NET_BIND_SERVICE - -[Install] -WantedBy=multi-user.target diff --git a/mkosi.extra/etc/systemd/system/vaultwarden.service b/mkosi.extra/etc/systemd/system/vaultwarden.service new file mode 100644 index 0000000..6000845 --- /dev/null +++ b/mkosi.extra/etc/systemd/system/vaultwarden.service @@ -0,0 +1,29 @@ +[Unit] +Description=Vaultwarden Server (Rust Edition) +Documentation=https://github.com/dani-garcia/vaultwarden +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/vaultwarden.env +# The location of the compiled binary +ExecStart=/usr/local/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 diff --git a/mkosi.nspawn b/mkosi.nspawn index 0bcb14d..6990d4c 100644 --- a/mkosi.nspawn +++ b/mkosi.nspawn @@ -1,5 +1,5 @@ [Exec] -Hostname=bitwarden-rs +Hostname=vaultwarden ResolvConf=copy-host Timezone=copy NoNewPrivileges=yes @@ -8,8 +8,8 @@ LinkJournal=try-host [Files] PrivateUsersChown=true -BindReadOnly=/etc/bitwarden_rs/bitwarden_rs.env -Bind=/var/local/bitwarden_rs/data:/var/lib/bitwarden_rs/data +BindReadOnly=/etc/vaultwarden/vaultwarden.env +Bind=/var/local/vaultwarden/data:/var/lib/vaultwarden/data [Network] VirtualEthernet=no diff --git a/mkosi.postinst b/mkosi.postinst index f2624e1..e475e99 100755 --- a/mkosi.postinst +++ b/mkosi.postinst @@ -14,12 +14,12 @@ echo "deb http://no.archive.ubuntu.com/ubuntu ${RELEASE}-security main universe" echo "deb http://no.archive.ubuntu.com/ubuntu ${RELEASE}-updates main universe" >> /etc/apt/sources.list apt-get update && apt-get --yes full-upgrade && apt-get --yes autoremove -# set up bitwarden -mv /bitwarden_rs /usr/local/bin/ || echo "building" +# set up vaultwarden +mv /vaultwarden /usr/local/bin/ || echo "building" -mkdir /var/lib/bitwarden_rs /etc/bitwarden_rs -useradd -d /var/lib/bitwarden_rs --system bitwarden_rs -chown -R bitwarden_rs: /var/lib/bitwarden_rs /etc/bitwarden_rs -chmod 700 /var/lib/bitwarden_rs /etc/bitwarden_rs +mkdir /var/lib/vaultwarden /etc/vaultwarden +useradd -d /var/lib/vaultwarden --system vaultwarden +chown -R vaultwarden: /var/lib/vaultwarden /etc/vaultwarden +chmod 700 /var/lib/vaultwarden /etc/vaultwarden -systemctl enable bitwarden_rs +systemctl enable vaultwarden |