Sign inSign up

anoikisnomads/caddy-ionos-dns

By anoikisnomads

Updated 3 months ago

Caddy 2 as reverse proxy with added DNS authentication module for IONOS

Image
0

10K+

anoikisnomads/caddy-ionos-dns repository overview

This is a Caddy 2 server intended to run as reverse proxy for self-hosted services with included DNS authentication and Let's Encrypt SSL certificates through the IONOS DNS API.

This allows valid SSL certificates without opening any port in your router, i.e. when you want to make your services accessible through a VPN network but not globally. Any other docker service that shares a network with this one can be targeted through the reverse proxy.

To get this to work you need both the prefix and the secret from your IONOS DNS API and include it in your Caddyfile:

# Caddyfile 
# snippet to get Let's Encrypt certificates through DNS authentication
(dnsauth) {
        tls {
                dns ionos [PREFIX].[SECRET]
        }
}

# rules for all subdomains of example.com
*.example.com {
        # apply the dnsauth snippet to make sure we have a valid SSL cert
        import dnsauth

        @wiki host wiki.example.com

        handle @wiki {
                reverse_proxy wiki_container_hostname:80
        }
}

A potential docker-compose.yml for this container looks like this:

version: "3.8"

services:
  caddy:
    image: anoikisnomads/caddy-ionos-dns:latest
    container_name: caddy
    hostname: caddy
    networks: 
      - reverseproxy # add other services to this network that you want to reverse-proxy to
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ~/caddy/data:/data    
      - ~/caddy/config/Caddyfile:/etc/caddy/Caddyfile
    restart: unless-stopped
networks:
  reverseproxy:
    external: true

Tag summary

Content type

Image

Digest

sha256:108f9cfef

Size

39.3 MB

Last updated

3 months ago

docker pull anoikisnomads/caddy-ionos-dns