mastercactapus / caddy2-proxyprotocol

Apache License 2.0
59 stars 11 forks source link

Need help concerning adding custom Caddy modules #10

Open FDF1337 opened 2 years ago

FDF1337 commented 2 years ago

After reading the section "Adding custom Caddy modules" on https://hub.docker.com/_/caddy i still don't know how i can build a new caddy binary with the plugin caddy2-proxyprotocol inside.

As i understood the documentation i should do the following:

FROM caddy:<version>-builder AS builder

RUN xcaddy build \
    --with github.com/mastercactapus/caddy2-proxyprotocol.git

FROM caddy:<version>

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

But i dont know where and how.

My Caddy environment is running in a docker container and managed by a docker-compose.yml file. The docker components (vaultwarden, caddy) are working well. With the component fail2ban i've still difficulties (registering but not banning the ip address) but this is offtopic here.

My motivation to include the "caddy2-proxyprotocol" plugin is to protect my vaultwarden vault from potentially brute force attackers. If i understand well this plugin is able to provide the real ip address to fail2ban (which is also included in a docker container) so it can ban the right ip address. At this moment fail2ban is getting a private ip address (172.x.x.x) from the container instead which will cause a DOS for the "normal" user.

How can i build a new caddy binary inside a docker container? Please help, i'm new in docker and i also don't have any "go" know-how. Thank you.

jpbaril commented 2 years ago

@FDF1337 Did you figure it by now ? If not, you put that in a "Dockerfile" file. And then you use the "build" docker command to create your custom Caddy docker image. And if you finally figured it, how did it go? I'm trying to do same as you. I thought the plugin from https://github.com/kirsch33/realip was what I needed but now it seems it's more likely that I need plugin from here.

gc-ss commented 2 years ago

@FDF1337 @jpbaril are either/both of you still blocked on this?