↓ Skip to main content

Lessons Learned: Bitwarden SSH Keys, Armbian DNS Conflicts, and Vaultwarden with Tailscale Serve

In a previous post (Migrating to Bitwarden: Solving Cross-Platform Passwords, TOTP, and Vault Security), I explored managing credentials across platforms. Bitwarden introduced a built-in SSH key management feature that allows generating and accessing SSH key pairs directly. While this sounds like a great multi-device solution, it introduces potential security trade-offs.

Relying heavily on CLI tools can expose systems to supply-chain vulnerabilities (similar to the Bitwarden CLI Impersonation Attack). To stay secure, I opted to generate my SSH keys manually, store them as files, and manage permissions explicitly.


1. The SSH Permission Gotcha
#

When creating public key (*.ed25519.pub) and setting up authorized_keys, default permissions are often too permissive (such as 644). SSH strictly requires restrictive permissions to function securely.

To fix this, lock down both files to 600:

chmod 600 ~/.ssh/authorized_keys # server
chmod 600 ~/.ssh/*.ed25519.pub   # client

With password authentication disabled and Tailscale SSH configured, I figured everything would remain accessible. Unfortunately, the moment I updated authorized_keys, I realise Tailscale SSH stalled and timed out, locking me out completely.


2. The Bluetooth Keyboard Trap
#

Being locked out meant I had to resort to physical access with a monitor and keyboard. That led to another unexpected lesson:

  • My cheap wireless keyboard/mouse combo (connected via a USB dongle) refused to respond in the Linux CLI login prompt.
  • In contrast, a wired Logitech K120 USB keyboard worked immediately.

This mirrored my past experience with macOS FileVault: Bluetooth keyboard doesn’t work during initial boot, where Bluetooth keyboards fail during initial boot until logged in. Keeping a trusty wired USB keyboard around for headless server recovery is an absolute lifesaver.


3. Resolving the Tailscale & AdGuard Home DNS Conflict
#

Once logged in locally and with temporary password login restored, I attempted to update Tailscale using sudo tailscale update, which threw the following error:

fetching latest tailscale version: Get “https://pkgs.tailscale.com/stable/?mode=json&os=linux": dial tcp: lookup pkgs.tailscale.com on [fd7a:115c:a1e0::53]:53: dial udp [fd7a:115c:a1e0::53]:53: connect: network is unreachable

This issue traced back to previous modifications made when setting up AdGuard Home (Running AdGuard Home via Docker on Armbian), where systemd-resolved was altered to free up port 53.

To restore normal system DNS and get Tailscale working again, I reverted the configuration:

  1. Stop the container:
    sudo docker compose down
  2. Reset resolved.conf: Remove custom modifications and restore default settings in /etc/systemd/resolved.conf (re-enabling the stub listener and resetting upstream DNS).
  3. Stop Tailscale:
    sudo systemctl stop tailscaled
  4. Restore the standard resolv.conf symlink:
    sudo rm -f /etc/resolv.conf
    sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
  5. Restart systemd-resolved and Tailscale:
    sudo systemctl restart systemd-resolved
    sudo systemctl start tailscaled
    sudo tailscale up

4. Why I Dropped AdGuard Home on Armbian
#

While AdGuard Home is fantastic for blocking ads, running it alongside standard Linux networking services creates severe constraints:

  • Port 53 Requirement: Routers and operating systems hardcode DNS traffic to port 53. AdGuard Home must bind directly to port 53 on its host.
  • No Custom Port Support: Consumer routers (such as ASUS, TP-Link, or Netgear) typically throw an invalid format error if you try to specify a custom port like 192.168.0.50:5353. Operating systems similarly lack native text boxes for custom DNS ports.

Because there is no simple way to run a local DNS blocker on a non-standard port without specialized local proxy software on every client device, I decided to decommission AdGuard Home on this shared Armbian server. Keeping the core Linux system stable and unhindered took priority.


5. Self-Hosting Vaultwarden with Tailscale Serve
#

Presentation is on: Tailscale Introduction Slides ↗

Even though I moved away from AdGuard Home, I still wanted a robust, self-hosted alternative for password management. Vaultwarden offers an ideal lightweight solution, and combining it with Tailscale Serve provides secure private access without opening ports to the public internet.

Step 1: Set Up Vaultwarden via Docker
#

Create a compose.yaml file based on the Vaultwarden GitHub repository:

services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: unless-stopped
    environment:
      DOMAIN: "https://your-device.your-tailnet.ts.net"
    volumes:
      - ./vw-data/:/data/
    ports:
      - "127.0.0.1:8000:80"

It can find your device’s Tailnet domain in the Tailscale admin console, or by running tailscale serve first to inspect the generated URL:

sudo tailscale serve --bg --https=8080 8000
tailscale-serve-example

Once the domain is added to compose.yaml, start the container in the background:

sudo docker compose up -d

Step 2: Configure Tailscale Serve
#

Expose local port 8000 securely to private tailnet on HTTPS port 8080:

sudo tailscale serve --bg --https=8080 8000

When running this for the first time, Tailscale will prompt about enabling Serve/Funnel:

tailscale-serve

(Note: Tailscale Funnel is not needed here since we want to keep the server strictly private to tailnet— It can skip enabling Funnel).

Step 3: Import Vault Data
#

  1. Export the vault data from previous provider (Settings > Vault Options > Export > JSON (Unencrypted)).
  2. Open browser, navigate to Tailscale Serve URL (https://your-device.your-tailnet.ts.net:8080), and create account.
  3. Import the unencrypted JSON export file to restore all records.

Step 4: Client Login Configuration
#

When logging into the Vaultwarden browser extension or mobile app:

  1. Select the Self-hosted login option:
    login-option
  2. Enter your Tailscale Tailnet URL including the port (e.g., https://your-device.your-tailnet.ts.net:8080):
    tailscale-server-url
  3. Log in with your credentials:
    login-vaultwarden

Unlike the official Bitwarden server (which locks certain features behind a paid subscription), Vaultwarden includes built-in TOTP and 2FA code generation out of the box for free, making it an exceptional self-hosted password manager.

Step 5: Lock Down Signups and Invitations
#

Once personal account is created and data is imported, it is best practice to disable new registrations and invitations so no unauthorized accounts can be created.

Update compose.yaml to include SIGNUPS_ALLOWED and INVITATIONS_ALLOWED under environment:

services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: unless-stopped
    environment:
      DOMAIN: "https://your-device.your-tailnet.ts.net"
      SIGNUPS_ALLOWED: "false"
      INVITATIONS_ALLOWED: "false"
    volumes:
      - ./vw-data/:/data/
    ports:
      - "127.0.0.1:8000:80"

Apply the changes by recreating the container:

sudo docker compose up -d

and

sudo tailscale serve --bg --https=8080 8000