Back to articles
Security & Anti-DDoS

Deploy Vaultwarden for Enterprise with Maximum Security Using End-to-End HTTPS via Let's Encrypt

This guide details deploying Vaultwarden, an open-source Bitwarden-compatible password manager, on an enterprise environment with maximum security through end-to-end HTTPS using...

DPTCloud Engineering5 min read
Deploy Vaultwarden for Enterprise with Maximum Security Using End-to-End HTTPS via Let's Encrypt

Image credit: Tumisu · Pixabay Content License

This guide details deploying Vaultwarden, an open-source Bitwarden-compatible password manager, on an enterprise environment with maximum security through end-to-end HTTPS using Let's Encrypt certificates. It covers VPS setup, reverse proxy configuration, automated certificate issuance and renewal, and system protection via firewall, regular updates, and access controls. Vaultwarden enables secure storage of passwords, login credentials, and sensitive data, accessible anywhere via web or mobile apps, ensuring high security through HTTPS and end-to-end authentication.

Requirements and Environment Preparation

To deploy Vaultwarden, you need a VPS (recommended using Cloud VPS at DPTCloud with L3/L4/L7 Anycast Anti-DDoS and 99.98% SLA as in network security infrastructure), Linux OS (Ubuntu 20.04+ or Debian 11+), and root access. You also need a valid domain name (e.g., vaultwarden.yourcompany.com) pointing to the VPS IP. Before starting, update the system and install required tools:

sudo apt update && sudo apt upgrade -y
sudo apt install docker.io docker-compose -y

Let's Encrypt certificates are issued and managed automatically via the ACME protocol using Traefik or Nginx with the acme.sh plugin. This deployment ensures end-to-end HTTPS is set up without manual configuration, reducing error risk and protecting data in transit.

Deploy Vaultwarden with Traefik and Let's Encrypt

To deploy Vaultwarden securely, use Docker Compose with Traefik as a reverse proxy to automate Let's Encrypt certificate issuance and renewal. Create a docker-compose.yml file with the following content:

version: '3.8'
services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: unless-stopped
    environment:
      - ROCKET_ADDRESS=0.0.0.0
      - ROCKET_PORT=80
      - DOMAIN=https://vaultwarden.yourcompany.com
      - SIGNUPS_ALLOWED=false
      - ADMIN_TOKEN=your_admin_token
      - LOG_LEVEL=info
    volumes:
      - ./data:/data
    networks:
      - vaultwarden-net
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.vaultwarden.rule=Host(`vaultwarden.yourcompany.com`)"
      - "traefik.http.routers.vaultwarden.entrypoints=websecure"
      - "traefik.http.routers.vaultwarden.tls=true"
      - "traefik.http.routers.vaultwarden.tls.certresolver=letsencrypt"
      - "traefik.http.routers.vaultwarden.service=vaultwarden"
      - "traefik.http.services.vaultwarden.loadbalancer.server.port=80"
  traefik:
    image: traefik:latest
    container_name: traefik
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./traefik:/etc/traefik
    command:
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.letsencrypt.acme.email=your-email@example.com"
      - "--certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/acme.json"
      - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
      - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
    networks:
      - vaultwarden-net
networks:
  vaultwarden-net:
    driver: bridge

Replace [email protected] with a valid email for Let's Encrypt notifications. The domain vaultwarden.yourcompany.com must resolve to the VPS IP. The traefik/traefik.yml file must be configured to enable the ACME HTTP challenge. After starting, Traefik will automatically issue the Let's Encrypt certificate and renew it every 60 days.

Additional Security Setup

To enhance security, perform the following steps:

  • Firewall: Install ufw and open required ports (80, 443, 22). Example: sudo ufw allow 80,443/tcp.
  • Access Control: Set SIGNUPS_ALLOWED=false to allow only administrators to create new accounts. Use ADMIN_TOKEN to access the admin interface.
  • Regular Updates: Monitor Vaultwarden's latest version and update regularly using docker-compose pull and docker-compose up -d.
  • Data Backup: Back up the /data directory regularly. Consider integrating with automated backup solutions from VPS to home NAS using Kopia and SFTP as described in this guide.

Verification and Testing

After deployment, verify functionality by accessing https://vaultwarden.yourcompany.com in a browser. The admin interface should appear if the ADMIN_TOKEN is correct. Check the HTTPS certificate using tools like SSL Labs to confirm Let's Encrypt is issued and no security issues exist.

To verify certificate renewal, run the following command on the VPS:

sudo docker-compose logs traefik | grep "Certificates managed"

Certificates are automatically renewed if they expire in less than 30 days. If errors occur, check Traefik logs and ensure the domain resolves correctly.

Troubleshooting

If access fails, check the following:

  • Does the domain point to the correct VPS IP? Use nslookup vaultwarden.yourcompany.com.
  • Is Traefik running and detecting the Vaultwarden service? Check logs with docker-compose logs traefik.
  • Is the Let's Encrypt certificate rejected due to HTTP challenge errors? Ensure port 80 is open and not blocked by the firewall.
  • Are Docker and Docker Compose versions compatible with all features? Use the latest versions.

For certificate-related issues, delete the acme.json file in the traefik directory and restart Traefik to reissue the certificate.

References

DPTCloud Tier III Infrastructure

Recommended NVMe Cloud VPS Plans to Deploy This Setup

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02

VPS-2E

94.600 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 2 GB
  • SSD: 30 GB NVMe
ECO · vn-02Recommended

VPS-3E

170.500 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 4 GB
  • SSD: 50 GB NVMe
BASIC · vn-01Recommended

VPS-05

457.600 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478