Skip to content
habiwanPublic

About

docker portainer stack for local wireguard + duckdns + adguard home + vaultwarden

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

23 Commits

Folders and files

Repository files navigation

habiwan's vpnstack ideas

                    ..       *#=*::
                 +@@@@@#.     ::...::.
       #%@@%#+:-#@@@@@@@@+.
     @@@@@@@@@*#==*%@@@@**+
    %@@@@@@@@@=.
    +#@@@@@@@@%.      .%@@@@%=.
    .=*@@@@@@@@@@@@@@#@@@@@@@@%*:
     .+#%%@@@@@@@@@@@@@@@@@@@@@@%+-.
      :+#%##*--. ..::::::.   . .-##*:
       =%@%##+..=*#@@@@@@%%@@@@@@@@%*-
        +%@%%@@+::=*%%%%+-:=@@@@@%###-
         -***%@%#+: .. .+@@@@@@@%#**+:
          :=+**#@@@@@@@@@@@@@@@@#*++-.
           .-**%@@@@@@@@@@@@@@@@#*-.
              -++*%@@@@@@@@@@%#*=.
                 .-=*##*#*=-:.

A Docker / Portainer stack for self-hosting a remote-access and home-lab networking setup—originally built around WireGuard, DuckDNS, AdGuard Home, and Nginx Proxy Manager (NPM), and later adapted to include Vaultwarden and Tailscale TLS certificates after ISP router restrictions.

What this gives you is a way to reach your home LAN when you are away (including over mobile data) without wrestling with manual certificate renewals or complex reverse-proxy setups.


Original Stack: WireGuard + DuckDNS + AdGuard Home + NPM

Use this flow if your ISP and router allow port forwarding and custom DNS settings.

  1. Create a free account at duckdns.org.
  2. Claim a subdomain (for example, example.duckdns.org) and note both your domain and token.
  3. Install Docker on your target machine or VM (a dedicated Linux VM on Proxmox VE or a Raspberry Pi works well).
  4. Install Portainer CE following the Portainer CE Linux Docker guide.
  5. Open Portainer at https://<YOUR_VM_IP>:9443/ and create your local admin account.
  6. Go to Stacks → Add stack, name the stack (for example, vpnstack), and paste your vpnstack.yaml compose definition.

    ARM / SBC Note: If running on ARM hardware such as a Raspberry Pi or Apple Silicon, verify image tags rather than blindly assuming x86-64 :latest images will match.

  7. Open Advanced Mode (stack.env) and populate your environment variables:
    • Set your DuckDNS domain and token.
    • Set your local router IP for global DNS.
    • Set your DuckDNS domain (example.duckdns.org) where public/DDNS hostname is expected.
  8. Deploy the stack.
  9. Configure the web UIs:
    • WireGuard / WGDashboard: http://<YOUR_VM_IP>:10086 — create an admin user and bring up wg0.
    • Nginx Proxy Manager: http://<YOUR_VM_IP>:81 — create an admin user and configure subdomain proxy hosts (such as app.your-domain.duckdns.org) with Let's Encrypt certificates.
    • AdGuard Home: http://<YOUR_VM_IP>:82 — complete initial setup and create an admin user.
  10. Forward ports on your router to <YOUR_VM_IP>:
    • 51820 — WireGuard VPN
    • 80 — Nginx Proxy Manager (HTTP)
    • 443 — Nginx Proxy Manager (HTTPS)
  11. In your router's DHCP/DNS settings, set primary DNS to <YOUR_VM_IP> (AdGuard Home) and secondary DNS to a fallback such as 1.1.1.1.

Update: ISP Lockdown Workaround (Vodafone UK Hub 7 & Tailscale)

On routers such as the Vodafone UK Hub 7, features that make the classic DuckDNS + NPM + router-wide AdGuard setup seamless can be locked down:

  • Port forwarding on low/common ports (80, 443, 53, 8080, 8443) may be blocked.
  • Router-level local DNS overrides may be disabled.

Even if NPM DNS-01 challenges with a DuckDNS token still issue certificates, without port forwarding or router-enforced DNS you would have to maintain local hosts entries or manually configure DNS on every client. Using Tailscale avoids paying for a custom domain + Cloudflare setup or fighting locked-down router NAT/DNS rules.

Running Vaultwarden with Tailscale HTTPS Certificates

Vaultwarden expects HTTPS in production/browser contexts. Instead of exposing ports or running NPM/DuckDNS, you can issue a Tailscale TLS certificate for your machine's MagicDNS name and mount it into Vaultwarden's data volume:

  1. Create a free Tailscale account.
  2. Check your tailnet DNS name in the Tailscale DNS Admin Console.
  3. Install and authenticate Tailscale on your host (for example, a Raspberry Pi 5).
  4. Generate the TLS certificate and key:
    sudo tailscale cert <your_machine>.<your_tailnet>.ts.net
  5. Start and stop the stack once so Docker creates the named volume (vpnstack_vw-data), then create a certs directory inside it:
    sudo mkdir -p /var/lib/docker/volumes/vpnstack_vw-data/_data/certs
  6. Copy the generated certificate and key files into /var/lib/docker/volumes/vpnstack_vw-data/_data/certs/ and set readable permissions:
    sudo chmod 644 /var/lib/docker/volumes/vpnstack_vw-data/_data/certs/*
  7. Connect your client devices to Tailscale and open Vaultwarden over HTTPS via your tailnet hostname. Access stays restricted to your authenticated tailnet while Tailscale is active.

Generating an Admin Token Hash for Vaultwarden

To protect /admin, generate an Argon2 password hash using Vaultwarden's CLI:

docker run --rm -it vaultwarden/server /vaultwarden hash

Multi-Site Tailscale vs. WireGuard Stack

  • Two locations (for example, UK + Spain): Running Tailscale on endpoints at both sites gives you mesh routing and exit/subnet options between locations without needing router port forwards.
  • Centralized WireGuard control: Keep the WireGuard container stack and forward your chosen WireGuard port (51820 by default) when you want direct WireGuard tunnel management. For AdGuard Home without router DNS control, set the AdGuard IP manually on specific devices that need it.

Stretch Goal: Local Headscale in the Same Stack

A future goal is adding a self-hosted Headscale service to this stack so WireGuard and a Tailscale-compatible control plane can coexist locally without depending on an external Tailscale account. Past attempts ran into configuration friction, so local MagicDNS/DERP/tailnet behavior remains a work in progress to test and document here once reliable.

About

docker portainer stack for local wireguard + duckdns + adguard home + vaultwarden

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors