What is Bitwarden?
Bitwarden is a free/freemium open-source password management service that stores sensitive information such as website credentials in an encrypted vault. The platform offers a variety of client applications including a web interface, desktop applications, browser extensions, mobile apps, and a command-line interface. Bitwarden offers a free cloud-hosted service as well as the ability to self-host. -https://en.wikipedia.org/wiki/Bitwarden
Installing Docker
- Log into the Linux based device
- Run the following commands in the terminal
# install prerequisites
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
# add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# install docker
sudo apt install docker-ce docker-compose containerd.io -y
# enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
# add the current user to the docker group
sudo usermod -aG docker $USER
# reauthenticate for the new group membership to take effect
su - $USER
Running Bitwarden Containers
NOTE: In order for Let's Encrypt to verify ownership of the DNS name, the host Docker is running from must be accessible via port 80 (http) and port 443 (https). For homelab users, this will normally involve port forwarding from the router to the certbot host, which is beyond the scope of this tutorial.
- Open a web browser and navigate to https://bitwarden.com/host/
- Enter an email address > Click the Submit button
- Copy the Installation ID and Key from the output for use later
- Continue with the following commands in a terminal window
# create a working directory
mkdir ~/docker/bitwarden -p
# create a bitwarden user account
sudo adduser bitwarden --disabled-password
# add the bitwarden user to the docker group
sudo usermod -aG docker bitwarden
# create bitwarden install directory
sudo mkdir /opt/bitwarden
# set permissions on the install directory
sudo chmod -R 700 /opt/bitwarden
# set ownership of install directory to bitwarden
sudo chown -R bitwarden:bitwarden /opt/bitwarden
# cd into the working directory
cd ~/docker/bitwarden
# download the bitwarden installation script
curl -Lso bitwarden.sh https://go.btwrdn.co/bw-sh
# make the install script executable
chmod 700 bitwarden.sh
# execute the installation script
./bitwarden.sh install - When prompted, enter a domain name for the Bitwarden installation
- Select if you'd like to use Let's Encrypt for SSL certificates
- Enter a database name to be used for the Bitwarden instance
- Enter the Installation ID obtained earlier
- Enter the Installation Key obtained earlier
- Select if you have an SSL certificate to use
- If no to the above, select if you'd like to generate a self-signed SSL certificate
- Continue with the following commands in a terminal window
# edit .env file
nano ~/docker/bitwarden/bwdata/env/global.override.env - Update the SMTP host configuration to use and optionally, add admin email addresses as shown below
globalSettings__mail__replyToEmail=no-reply@i12bretro.local
globalSettings__mail__smtp__host=smtp.i12bretro.local
globalSettings__mail__smtp__port=25
globalSettings__mail__smtp__ssl=false
globalSettings__mail__smtp__username=bitwarden@i12bretro.local
globalSettings__mail__smtp__password=
adminSettings__admins=i12bretro@i12bretro.local - Continue with the following commands in a terminal window
# restart bitwarden containers
~/docker/bitwarden/bitwarden.sh restart - Open a web browser and navigate to https://DNSorIP
- Click the Create Account button
- Complete the form by entering an Email Address, Name and Master Password > Click the Create Account button
- Log into Bitwarden using the email address and password set earlier
- Welcome to Bitwarden
Documentation: https://bitwarden.com/help/install-on-premise-linux/#post-install-configuration
Source: https://bitwarden.com/help/install-on-premise-linux/