A production grade, Dockerized bitwarden_rs setup with NGINX, Certbot, and Fail2ban included.
- Clone repo to your server.
- Create
.env
files inbitwarden
andfail2ban
folders. - Populate
.env
files using the providetemplate.env
files. - Adjust volume source paths in all
docker-compose.yml
files. - Edit
default.conf
for NGINX to correctly represent your domain(s). Be sure to remove any unwanted server declarations. - Review the fail2ban settings under
fail2ban/data/jail.d/bitwarden.local
. Modify as desired. - Start the containers using
docker-compose up -d
in the following order: bitwarden, fail2ban, nginx-certbot.
Ensure your DNS is already updated with an A
record pointed to your server's IP.
- Locate container ID for NGINX using
docker ps -a
. - Run
docker exec -it CONTAINER_ID /bin/bash
. You should now be inside the container as root. - Run
certbot -d domain.com
to generate a cert for domain.com. Follow on-screen instructions to complete process. When asked, allow certbot to automatically update the NGINX config with new cert info. exit
from the container.- Done. If needed, you can run
docker-compose restart
in thenginx-certbot
folder to restart NGINX with the updated config.
- Add automated backups of your bitwarden_rs database using other projects like:
- Ensure your Bitwarden homepage cannot be accessed via the server's IP (e.g. https://IP). IPs can be easily scanned making your bitwarden_rs instance a more obvious target if it can be detected this way.
- Use a firewall for your VM.
- Deny all for SSH except your IP address.
- If possible and feasible for your use case, only allow HTTP/HTTPS to your IP address.
- If you're still using SSH login via password, reconsider hosting your own password manager :)