1. The problem I’m having:
I want to make caddy invisible to port scanners. On shodan, only port 80 is being shown as active, but on sites that check if my ports are open it says both 80 and 443 are open. I want to make it so that if a request is sent to anything other than a subdomain caddy just doesn’t do anything (to make it look like there’s nothing on the port). Currently I’m using abort on requests to :80 and :443 but that only makes shodan report “No data returned” while claiming only port 80 is open. I know security through obscurity is a bad idea, but this will at least take a huge target off my back.
2. Error messages and/or full log output:
n/a
3. Caddy version:
v2.9.0-beta.3
4. How I installed and ran Caddy:
Installed/ran caddy through docker-compose and Caddyfile
a. System environment:
Raspberry Pi 5 running latest version of Raspbian
b. Command:
docker compose up
c. Service/unit/compose file:
services:
caddy:
build: .
restart: unless-stopped
ports:
- 80:80
- 443:443
- 443:443/udp
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./site:/srv
- caddy_data:/data
- caddy_config:/config
networks:
- caddyout
volumes:
caddy_data: null
caddy_config: null
networks:
caddyout:
external: true
d. My complete Caddy config:
{
servers {
trusted_proxies static 192.168.0.0/24
}
}
(authentikgate) {
header /* {
-Server
}
reverse_proxy /outpost.goauthentik.io/* http://authentikserver:9000
forward_auth http://authentikserver:9000 {
uri /outpost.goauthentik.io/auth/caddy
copy_headers X-Authentik-Username X-Authentik-Groups X-Authentik-Entitlements X-Authentik-Email X-Authentik-Name X-Authentik-Uid X-Authentik-Jwt X-Authenti>
}
}
internal.redacted.com {
route /authtest {
import authentikgate
respond "You are authorized"
}
respond "Hello, world!"
}
freshrss.redacted.com {
route {
import authentikgate
reverse_proxy freshrss:80
}
route /api* {
reverse_proxy freshrss:80
}
}
authorize.redacted.com {
reverse_proxy authentikserver:9000
}
adguard.redacted.com {
route {
import authentikgate
reverse_proxy adguardhome:81
}
}
uploader.redacted.com {
encode gzip
route {
import authentikgate
reverse_proxy zipline:3000
}
}
ai.redacted.com {
route {
import authentikgate
reverse_proxy 192.168.0.39:3000 {
header_up Host {host}
header_up X-Real-IP {remote}
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-For {remote}
}
}
}
jellyfin.redacted.com {
route {
import authentikgate
reverse_proxy 192.168.0.39:8096
}
}
:80, :443 {
abort
}