Replies: 4 comments
|
You can mount host path or prepare a script to inject the updated files into the caddyfile, it should recognize and reload. Let mw know if everything goes flawlessy! TIA |
|
Hi @flyboy1, here is the typical setup. Mount services:
caddy-waf:
image: ghcr.io/fabriziosalmi/caddy-waf:latest
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- ./rules.json:/app/rules.json
- ./ip_blacklist.json:/app/ip_blacklist.json
- ./dns_blacklist.json:/app/dns_blacklist.json
- caddy_data:/data
- caddy_config:/config
ports:
- "80:80"
- "443:443"
volumes:
caddy_data:
caddy_config:For auto-updating blacklists, two patterns work well:
Full Docker reference: docs/docker.md. |
|
Will the Image be the new way to install it with docker? docker.md still states building it yourself? |
|
Hi @flyboy1, @donserdal — apologies for how long this took, and thank you both for the patience. @donserdal was right to push back. The image I pointed at in April did not exist: nothing in this repository ever built or published one, so that compose file could not have worked. It exists now. docker pull ghcr.io/fabriziosalmi/caddy-waf:0.3.10Published on release tags for linux/amd64 and linux/arm64. Available tags are Mounting your filesTo @flyboy1's original question — mount the JSON and blacklist files individually, as files rather than directories, so editing them on the host survives the container being recreated: services:
caddy-waf:
image: ghcr.io/fabriziosalmi/caddy-waf:0.3.10
ports:
- "8080:8080"
volumes:
- ./Caddyfile:/app/Caddyfile:ro
- ./rules.json:/app/rules.json
- ./ip_blacklist.txt:/app/ip_blacklist.txt
- ./dns_blacklist.txt:/app/dns_blacklist.txtOn auto-updating the blacklists: the WAF watches those paths and reloads them when they change, so a cron job that rewrites the file on the host is enough — no container restart needed. One caveat, and please read it before wiring up that cron. Hot reload deadlocked the server on every release before v0.3.9: the reload path blocked while holding a lock every request needs, so the process silently stopped answering. A job rewriting a blacklist on a schedule would have been the fastest way to hit it. Fixed now, but do not run that setup on an older build. Also worth knowing
Several defects in the blacklist path were found and fixed today, published as GHSA-w6gv-76q4-prqg. Start from v0.3.10. |
Uh oh!
There was an error while loading. Please reload this page.
How to get files from /app as Volume Mounts so i can edit rules.json or ip_blacklist.json in Host folder and don't loose changes?
Exists some best practice to auto update blacklist files on using docker container?
Best regards
Franky
All reactions