15.07.2023

How to install Bitwarden on Linux Debian 11 server

What is Bitwarden?

Bitwarden stands as an advanced password management solution, enabling users to securely store and effectively manage their passwords. With its encrypted platform, it offers a reliable and protected means of storing login credentials, credit card details, secure notes, and other sensitive information. Bitwarden exhibits excellent compatibility, extending client support across diverse operating systems and devices, encompassing Windows, Linux, MacOS, web browsers, and mobile platforms. Notably, it empowers users to generate robust, one-of-a-kind passwords, effortlessly autofill login forms, and seamlessly synchronize data across multiple devices.

Emphasizing utmost security and privacy, Bitwarden leverages end-to-end encryption, ensuring exclusive access solely to the user. Furthermore, it encompasses supplementary features, including two-factor authentication and the ability to self-host the Bitwarden server, granting individuals complete control over their data. Bitwarden comes in both free and premium versions, with premium subscribers gaining access to enhanced features and additional options.

Why you need self hosted server with open-source password manager?

Modern password management services can be dangerous due to various security risks. Here are some reasons why:

To mitigate these risks, users should choose reputable password managers with a strong security track record, use two-factor authentication where possible, and regularly monitor their accounts for any suspicious activities. Additionally, maintaining offline backups of critical passwords can provide an extra layer of security.

Preparing the system for installation

Prior to installing the password manager, it is essential to update the system packages to ensure optimal performance and compatibility:

sudo apt update && apt upgrade

Install the Apache and Curl packages.

sudo apt install apache2 curl -y

Before proceeding with the Docker setup, it is necessary to configure the dependencies. Once the dependencies are in place, you can proceed with setting up Docker.

sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y

Include the GPG keys from Docker to enhance the security and integrity of the installation.

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

Add docker repository to your system.

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable && apt update"

Installing Docker

sudo apt install docker-ce docker-ce-cli containerd.io docker-compose

Next step will conclude in give permission to the user:

sudo usermod -aG docker *username*

Installing Bitwarden

The next step includes obtaining a hosting ID and key to proceed with the installation. Visit the Bitwarden website, enter your administrative email, and obtain the necessary details.

Download main component of ready to use server:

curl -Lso bitwarden.sh https://go.btwrdn.co/bw-sh

To set up BitWarden you need a normal script that you can open by running the command:

cat bitwarden.sh

BitWarden uses preinstalled configs, so after installing it you can check its functionality at once and after installing it you can configure it in the way you need:

The script needs to be made executable.

Use the command below to check the rights granted.

Install BitWarden using the installation script.

sudo ./bitwarden.sh install

Enter the required data. To make your server visible from the internet, enter your domain in the corresponding field. Otherwise, fill the field with "domain.org" and press Enter. Additionally, remember to fill out another field.

Great! The certificate has been obtained and now we can name the database:

Wait to install when all the containers are pulled up:

Once the installation is finished, proceed to enter the installation ID and key that you obtained earlier. Afterward, wait for the Diffie Hellman private key generation process to be completed.

The installation was successful.

Launching Bitwarden

Before we start, we need to configure the config. Let's configure it using any text editor.

nano ./bwdata/config.yml

To ensure a smooth experience with the web interface, you have the option to edit the port to a preferred value. But, if you have a separate server dedicated to the manager and other web resources that won't conflict, you can select to leave the default values as they are. This will help avoid any potential issues.

nano ./bwdata/docker/docker-compose.yml

To configure some Bitwarden functions that are not installed by the bitwarden.sh script, you can edit the environment file located at ~bwdata/env/global.override.env.

nano ~bwdata/env/global.override.env

By editing the environment file and updating these parameters, you can configure additional functions of Bradwarden according to your specific requirements, all parameters for filling are shown in the screenshot below. To fill in these items, you need raise the mail server. Do not forget to save the changes after editing the file using the keyboard shortcuts Ctrl+O and exit the text editor using Ctrl+X.

The password manager is started with a command.

sudo ./bitwarden.sh start

During the initial startup, please be patient as Bitwarden takes some time to create all the necessary components for it to function properly.

After successful start-up, a message will be displayed indicating that the web interface is ready.

Required! If you are not using IPv6, make sure to comment out the relevant lines in the nginx configuration:

nano ~/bwdata/nginx/default.conf

Comment out any lines that may be associated with IPv6, these are marked in blue in the screenshot:

To complete the initial setup of the DNS record, you will need to configure the A record at your domain registrar. In one field, specify your 3rd level domain, while in the other field, provide the IP address for the connection:

Navigate to the web interface using the server domain address.

When creating a user, it is essential to remember that the password associated with the account serves as the primary key to access all passwords. You have the option to leave a hint for the password to ensure it is not forgotten.

Send yourself a confirmation email to make your account work without restrictions! However, the limited functionality is also quite enough to work with. Create data objects in the main window:

The box with the fields is the profile you need to fill in:

The entry made is as follows:

Recommendation for setup

When it comes to upgrading a self-hosted server and ensuring compliance with regulatory requirements, consider the following steps:

Remember that compliance requirements can vary based on your specific industry, region, and the nature of your data. It is essential to consult legal and compliance experts to ensure that your self-hosted server meets all applicable regulatory requirements.

Conclusion

With this publication you will easily install Bitwarden and get it up and running for your needs.