Bitwarden -> haproxy (pfsense) encryption problem

I’m pretty new to real networking, moving from from ‘twiddle until it works’ to understanding and predicting how things will work.

Currently, I’m working to set up reverse proxy for a few services I want to expose publicly. They’re on proxmox, on a VLAN, with their own pfSense interface. DNS works for both subnets.

I’m having trouble reverse proxying Bitwarden. I watched all of @LTS_Tom’s most excellent videos on haproxy, including troubleshooting.

Where I am:

  • Internal CA works well (quite familiar with that)
  • LetsEncrypt wildcard domain cert works fine (*.example.com)
  • Bitwarden’s nginx has a self-signed cert, and runs on 443 (10.10.1.15:443).
  • I can access bitwarden internally via IP and via URL (like internal.example.home.arpa).
  • haproxy health check works - Bitwarden is active.
  • created a reverse proxy test server (10.10.1.14:80). haproxy forwards them properly; 'https://proxytest.example.com` works with the trusted LetsEncrypt certificate.

What I’ve done:

  • backend for bitwarden is ssl, but no checks. Health check is HTTP GET. Otherwise, the backend is defaults.
  • frontend for all is bound to WAN interface. The frontend cert is properly chosen. The frontend works (see proxytest.example.com) above.

What doesn’t work:

  • passwords.example.com seems to get to the Bitwarden server. Bitwarden’s nginx returns: 400 Bad Request “The plain HTTP request was sent to HTTPS port”.

I’m not clear why a plain request is being sent to the Bitwarden server. The server is configured for Encrypt (SSL) but SSL Checks are not enabled.

Side issue: The pfsense System Logs > Packages > haproxy logs are blank. I can’t see any logging for haproxy.

What am I missing?

That error implies you are sending an HTTP not an HTTPS request to the internal bitwarden server.

Is there a straightforward way to verify the encryption state of the return traffic?

Here are the setting I have for my self hosted bitwarden.

Server list

Table

Mode Name Forwardto Address Port Encrypt(SSL) SSL checks Weight Actions
active thewarden Address+Port: 192.168.2.4 443 yes no

The current sticking point is firewall rules, which I’m still learning.

2 LAN subnets: 10.71.73.0/24 and 10.10.1.0/24

haproxy is unable to forward traffic to 10.10.1.0/24 servers, responding with 503.

Seems I have to figure out how pfsense controls traffic leaving haproxy on interface.

I run OMV so i’m not familiar with Proxmox, but have you tried running your vaultwarden server on a different port? That is how I have mine set up and it worked from the first try. I am new to pfsense(been running for 6-8 months now) and currently use HAproxy. I’m sending port XXXX external on my local net to port 80 in the docker container.

I finally got this to work. I was attempting to use an ACME wildcard cert for the host. When I made the server-specific cert, no more 503.

This openssl command was helpful - from Tom’s original video @ 21:26:

openssl s_client -servername <REPLACE WITH HOSTNAME like server.example.com> -host <REPLACE WITH PUBLIC IP ADDRESS like 1.2.3.4> -port 443 < /dev/null | grep subject-CN

It displays the subject of the certificate returned by the server, which is HAProxy in this scenario.