1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-16 04:12:53 +01:00
Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs
Datei suchen
2018-07-06 13:30:02 -07:00
docker Move settings out of web-vault 2018-04-26 23:40:38 +01:00
libs/jsonwebtoken Updated dependencies and removed some warnings from jsonwebtoken 2018-06-01 15:34:26 +02:00
migrations Improved two factor auth 2018-06-01 15:08:03 +02:00
src Log posible errors when attaching file 2018-07-06 17:23:12 +02:00
.dockerignore Fixed docker build and implemented automatic creation of JWT signing keys on platforms with OpenSSL (it needs to be on the PATH) 2018-02-17 01:13:02 +01:00
.env Improved configuration and documented options. Implemented option to disable web vault and to disable the use of bitwarden's official icon servers 2018-06-12 21:09:42 +02:00
.gitignore Move settings out of web-vault 2018-04-26 23:40:38 +01:00
Cargo.lock Updated dependencies and rust version 2018-06-29 23:18:19 +02:00
Cargo.toml Updated dependencies and rust version 2018-06-29 23:18:19 +02:00
diesel.toml Updated dependencies and created 'rust-toolchain', to mark a working nightly to rustup users, and hopefully avoid some nightly breakage. 2018-06-12 17:30:36 +02:00
Dockerfile Install CA certificates to make HTTPS connections work 2018-07-01 17:40:02 +02:00
LICENSE.txt Upload and download attachments, and added License file 2018-02-15 00:40:34 +01:00
README.md updated readme to include information about creating backups 2018-07-06 13:30:02 -07:00
Rocket.toml Document configuration a bit and increase JSON size limit to 10MB 2018-06-29 23:11:15 +02:00
rust-toolchain Updated dependencies and rust version 2018-06-29 23:18:19 +02:00

Bitwarden_RS

This project is an unofficial implementation of the Bitwarden Core Server written in Rust.

(Note: This project is not associated with the Bitwarden project nor 8bit Solutions LLC.)

Build/Run

This project can be built and deployed in two ways:

Docker Setup (Easy)

Install Docker to your system and then, from the project root, run:

# Build the docker image:
docker build -t bitwarden_rs .

# Run the docker image with a docker volume:
docker run --name bitwarden_rs -t --rm -v bw_data:/data -p 80:80 bitwarden_rs

Then visit http://localhost:80

Manual Setup (Advanced)

Dependencies

  • Rust nightly (strongly recommended to use rustup)
  • OpenSSL (should be available in path, install through your system's package manager or use the prebuilt binaries)
  • NodeJS (required to build the web-vault, (install through your system's package manager or use the prebuilt binaries)

Install the web-vault

Download the latest official release from the releases page and extract it.

Modify web-vault/settings.Production.json to look like this:

{
  "appSettings": {
    "apiUri": "/api",
    "identityUri": "/identity",
    "iconsUri": "/icons",
    "stripeKey": "",
    "braintreeKey": ""
  }
}

Then, run the following from the web-vault directory:

npm install
npx gulp dist:selfHosted

Finally copy the contents of the web-vault/dist folder into the bitwarden_rs/web-vault folder.

Running

cargo run

Then visit http://localhost:80

Configuration

The available configuration options are documented in the default .env file, and they can be modified by uncommenting the desired options in that file or by setting their respective environment variables.

Note: the environment variables override the values set in the .env file.

Disabling user registrations

To disable user registrations, you can uncomment the SIGNUPS_ALLOWED line in the .env file and change the value to false.

You could also set the SIGNUPS_ALLOWED environment variable. To do that when using Docker, add the following line to the end of the docker run command:

-e SIGNUPS_ALLOWED=false

Changing the API request size limit

By default the API calls are limited to 10MB. This should be sufficient for most cases, however if you want to support large imports, this might be limiting you. On the other hand you might want to limit the request size to something smaller than that to prevent API abuse and possible DOS attack, especially if running with limited resources.

To set the limit, you can use the ROCKET_LIMITS variable. Example here shows 10MB limit for posted json in the body (this is the default):

-e ROCKET_LIMITS={json=10485760}

Enabling HTTPS

To enable HTTPS, you need to configure the ROCKET_TLS option, the same way as SIGNUPS_ALLOWED.

The values to the option must follow the format:

ROCKET_TLS={certs="/path/to/certs.pem",key="/path/to/key.pem"}

Where:

  • certs: a path to a certificate chain in PEM format
  • key: a path to a private key file in PEM format for the certificate in certs

How to recreate database schemas (for developers)

Install diesel-cli with cargo:

cargo install diesel_cli --no-default-features --features sqlite-bundled

Make sure that the correct path to the database is in the .env file.

If you want to modify the schemas, create a new migration with:

diesel migration generate <name>

Modify the *.sql files, making sure that any changes are reverted in the down.sql file.

Apply the migrations and save the generated schemas as follows:

diesel migration redo

# This step should be done automatically when using diesel-cli > 1.3.0
# diesel print-schema > src/db/schema.rs

Backing up your Vault

The official bitwarden backup documentation can be found here: https://help.bitwarden.com/article/backup-on-premise/

There are 3 folders that need to be backed up in the official install. In the bitwarden_rs install, the default docker setting will have all 3 of these folders in same location: /data/. Backing up this one folder will backup your sqlite database, key files and attachments.

Note that the official bitwarden install uses a MySQL database which is automatically backed up nightly. This is not the case with the bitwarden_rs. Instead you should use a backup program to create incremental backups.