v0.10.1 · updated · GitHub

Installation

Requirements: Go 1.25.13+ only if building from source. Releases ship static binaries (CGO_ENABLED=0) for Linux amd64/arm64/arm, macOS amd64/arm64 and Windows amd64/arm64. Verify each method right after install.

Quick verify (all methods)
The v0.9.0 release binary prints caddy-analyze version 0.9.0; source builds may show 0.9.0-dev. If you see command not found, check PATH or re-open the terminal. Use caddy-analyze doctor for a read-only installation report.

Linux / macOS — install.sh

Detects OS/arch, downloads tar.gz + checksums.txt, verifies SHA256 and optional cosign.

curl -sSfL https://raw.githubusercontent.com/lenny-ts/caddy-analyzer/main/install.sh | bash

Verify

caddy-analyze --version
which caddy-analyze
# expected: /usr/local/bin/caddy-analyze  and  version 0.9.0

If /usr/local/bin is not writable, the script uses sudo mv. The installer currently installs to /usr/local/bin; use the release archive or go install when you need a user-local location.

Windows — install.ps1

iwr -useb https://raw.githubusercontent.com/lenny-ts/caddy-analyzer/main/install.ps1 | iex

Verify

caddy-analyze --version
# close and re-open PowerShell if PATH was updated
Get-Command caddy-analyze | Format-List
# expected: Source  C:\Users\YOU\AppData\Local\caddy-analyze\caddy-analyze.exe
Note
Requires PowerShell 5.1+. The script prepends %LOCALAPPDATA%\caddy-analyze to your User PATH — reopen the terminal to pick it up.

Go toolchain

go install github.com/lenny-ts/caddy-analyzer/cmd/caddy-analyze@latest

Verify

caddy-analyze --version
# if "command not found", add Go bin to PATH:
export PATH="$HOME/go/bin:$PATH"
go env GOPATH
# expected: .../go/bin/caddy-analyze

Docker

No Go needed. Image: ghcr.io/lenny-ts/caddy-analyzer (Alpine, non-root caddy user).

Published starting with v0.8.1 for linux/amd64 and linux/arm64. Pin :v0.9.0 (or :0.9.0) for this release; :latest tracks stable releases only. Images older than v0.8.1 were not published.

docker pull ghcr.io/lenny-ts/caddy-analyzer:latest
# analyze a file
docker run --rm -v /var/log/caddy:/logs ghcr.io/lenny-ts/caddy-analyzer /logs/access.log
# stream from Docker
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/lenny-ts/caddy-analyzer docker://caddy

Verify

docker run --rm ghcr.io/lenny-ts/caddy-analyzer --version
docker images ghcr.io/lenny-ts/caddy-analyzer --format "{{.Tag}} {{.Size}}"

Build locally

Requires Git and Docker with BuildKit; Go runs inside the build container. Replace the host log directory below with your Caddy log directory.

git clone https://github.com/lenny-ts/caddy-analyzer.git
cd caddy-analyzer
docker build --build-arg VERSION=0.9.0-local -t caddy-analyzer:local .
docker run --rm caddy-analyzer:local --version
docker run --rm -v /var/log/caddy:/logs:ro caddy-analyzer:local /logs/access.log

The container runs as a non-root user: mounted logs must be readable by that user.

Pre-built binaries

Download from GitHub Releases. Each *.tar.gz (or .zip on Windows) contains caddy-analyze. Download checksums.txt and Cosign signature/certificate/bundle assets separately from the same release.

# Linux amd64 — the tag has v, the archive version does not
curl -sSfL https://github.com/lenny-ts/caddy-analyzer/releases/download/v0.9.0/caddy-analyzer_0.9.0_linux_amd64.tar.gz -o /tmp/caddy-analyzer_0.9.0_linux_amd64.tar.gz
curl -sSfL https://github.com/lenny-ts/caddy-analyzer/releases/download/v0.9.0/checksums.txt -o /tmp/checksums.txt
grep caddy-analyzer_0.9.0_linux_amd64.tar.gz /tmp/checksums.txt | (cd /tmp && sha256sum -c)
tar -xzf /tmp/caddy-analyzer_0.9.0_linux_amd64.tar.gz -C /tmp && sudo mv /tmp/caddy-analyze /usr/local/bin/

Verify

caddy-analyze --version
ls -l /usr/local/bin/caddy-analyze
# optional cosign: cosign verify-blob --certificate-identity ... --signature checksums.txt.sig checksums.txt

Systemd (guard daemon)

For guard as a service. Requires root for iptables.

sudo tee /etc/systemd/system/caddy-guard.service >/dev/null <<'EOF'
[Unit]
Description=caddy-analyzer Security Guard Daemon
Wants=network-online.target
After=network-online.target caddy.service
[Service]
Type=simple
ExecStart=/usr/local/bin/caddy-analyze guard --limit 50 --window 1m /var/log/caddy/access.log
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now caddy-guard

Verify

Default self-IP protection requires direct outbound HTTPS. For restricted-network servers, add --protect-self=false and explicit trusted --never-block addresses to ExecStart, then run sudo systemctl daemon-reload && sudo systemctl restart caddy-guard. Remote administrator addresses are separate from the server's automatically protected IPs.

systemctl status caddy-guard --no-pager
journalctl -u caddy-guard -n 20 --no-pager
# should show "guard started" and no "permission denied" on /var/log/caddy/access.log

Update

caddy-analyze update --check   # check without installing
caddy-analyze update           # install latest (cosign + SHA256 verified)
caddy-analyze update --version v0.9.0 --force  # pin / reinstall

Troubleshooting

  • curl: command not found → sudo apt-get install curl or use the binary download.
  • permission denied on log → sudo caddy-analyze … or sudo usermod -aG caddy $USER then re-login.
  • Corporate proxy → set https_proxy before curl.