How to Setup Self Hosted Bitwarden [YouTube Release]

Additional Resources:

pfsense HA Proxy Video

Bitwarden install documentation

Bitwarden backup documentation

Connecting With Us

Lawrence Systems Shirts and Swag

►👕 https://teespring.com/stores/lawrence-technology-services

AFFILIATES & REFERRAL LINKS

Amazon Affiliate Store
:shopping_cart: Lawrence Systems's Amazon Page

Ubiquiti Affiliate
:shopping_cart: Ubiquiti Store United States

All Of Our Affiliates that help us out and can get you discounts!
:shopping_cart: https://www.lawrencesystems.com/partners-and-affiliates/

Gear we use on Kit
:shopping_cart: Kit

Try ITProTV free of charge and get 30% off!
:shopping_cart: Learn technology and pass IT certifications with ITProTV

Use OfferCode LTSERVICES to get 10% off your order at
:shopping_cart: Tech Supply Direct - Refurbished Tech at Unbeatable Prices

Digital Ocean Offer Code
:shopping_cart: DigitalOcean | Cloud Hosting for Builders

HostiFi UniFi Cloud Hosting Service
:shopping_cart: HostiFi - UniFi Cloud Hosting

Protect you privacy with a VPN from Private Internet Access
:shopping_cart: Buy VPN with Credit Card or PayPal | Private Internet Access

Patreon
:moneybag: lawrencesystems | creating Tech Tutorials & Reviews | Patreon

:stopwatch: Time Stamps :stopwatch:
00:00 :arrow_forward: Host to install Self Hosted Bitwarden
00:25 :arrow_forward: SSL & SMTP prerequisites
01:20 :arrow_forward: Let’s Encrypt
02:59 :arrow_forward: Install & Deploy On Linux Guide
03:57 :arrow_forward: Install docker, create Bitwarden user and paths
04:32 :arrow_forward: Bitwarden installation script
06:04 :arrow_forward: Host Installation ID
06:38 :arrow_forward: Setting SMTP and environment variable
07:53 :arrow_forward: Running Bitwarden
09:30 :arrow_forward: Browser Plugin Self hosted Settings
10:02 :arrow_forward: Admin Pages
11:14 :arrow_forward: Updating Bitwarden Server
12:12 :arrow_forward: Self Hosted Backups
12:55 :arrow_forward: Valutwarden

#bitwarden #passwordmanager #docker

Just an FYI Tom.
Using a custom db name, instead of the default one of, “vault”, causes a problem, in that, the database does not auto backup nightly as it’s supposed to.
Trying to use an environment variable, in the mssql.override.env does fix the issue temporarily, but when the machine/VM is restarted, the backup is created with another name.

If you set DATABASE=yourdbname in the ./bwdata/env/mssql.override.env file, it works till the VM is restarted.
Once the VM is restarted, for example, if you named your db, bw-vault, upon reboot the next backup would be named bw-vaultbw-vault, and it will extend the name further upon every reboot.

The issue has been raised here, Self hosted: MSSQL nightly backup isn't create for non-default DB name · Issue #1811 · bitwarden/server · GitHub, and also in another forum post on the bitwarden site.

The easiest fix right now, is to simply just use, “vault” as the db name, so nightly autobackups just work from the start.

I found this by randomly checking my backups were working, and when seeing they weren’t, I went searching on trying to find out why and how the fix it.

You can test the backup manually, by running, docker exec -i bitwarden-mssql /backup-db.sh and seeing the error.

I just created a new VM, installed bitwarden again, and used the default name of “vault”, imported my vault, and verified the backups work as intended now, so it’s probably recommended for the time being to use the default name of “vault”
Easy to do for self hosting for personal use, but for anyone with several users, this might be painful.

I installed bitwarden on a truenas core 12 running a VM Ubuntu 22.04 server. Having problems getting the mssql docker container to not crash.

Over the past few days I have learned more about docker. I figured out what volumes are mirrored from inside the container to the host file system.
The line in docker-compose.yml - …/mssql/data:/var/opt/mssql/data for mssql is causing mssql to crash every few seconds. When I remove the line, mssql runs fine and everything works.

I also found the log files for mssql. Here is what was in one of the log files.

Need some help figuring this out.

Tried adding user: root to the Docker-compose file. Tried setting all the host folders to root:root bitwarden:bitwarden and chmod 777 of the bwdata folder. Tried database_docker_volume: true in config.yml
tried reinstalling to bitwarden folder instead of rladelman771 folder
I even tried relocating the host side folder to another location.
Nothing besides removing the volume line for the data folder worked.

GNU nano 6.2 core.sqlservr.04_12_2023_21_52_25.47.txtThis program has encountered a fatal error and cannot continue running at Wed Apr 12 21:52:21 2023The following diagnostic information is available: Reason: 0x00000006 Message: Stack Overflow Address: 0x3fff9f611ee9 Stack Trace: file://package4/windows/system32/sqlpal.dll+0x000000000000E16F file://package4/windows/system32/sqlpal.dll+0x000000000000B879 file://package4/windows/system32/sqlpal.dll+0x000000000000B9AE file://package4/windows/system32/sqlpal.dll+0x0000000000011EE9 file://package4/windows/system32/sqlpal.dll+0x0000000000012217 file://package4/windows/system32/sqlpal.dll+0x0000000000202579 Modules: file://package4/windows/system32/sqlpal.dll=2783696C75EB41553CC5480CD7503AC51 Process: 47 - sqlservr Thread: 167 (application thread 0x1f8) Instance Id: b047929d-3ec7-45a0-812f-80050c9bb8b5 Crash Id: 1ee36857-f837-40d0-a580-b50f4686e8bf Build stamp: e5dea205d0938e2848fb2509856a7e8f30783e6d5f62d0c88355e288de0db89a Distribution: Ubuntu 20.04.4 LTS Processors: 16 Total Memory: 4110659584 bytes Timestamp: Wed Apr 12 21:52:21 2023 Last errno: 11Last errno text: Resource temporarily unavailable