diff options
| author | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-07-02 22:58:56 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-07-02 22:58:56 +0900 |
| commit | 88be3b3f503d4674d764a7265edb2d4e380ae738 (patch) | |
| tree | 0018d96f2a683f7e025327cba51c28249122f53c /proxy/renew-cert.sh | |
| parent | 2854b063b4cea071be2e90eb059fef095c26d9a1 (diff) | |
Add HTTPS forward proxy service (Squid on port 8443)
- proxy/: Squid container with HTTPS port, Basic auth from vpn/users.conf
- caddy/Caddyfile: add proxy.yyamashita.com block (RSA cert for compat)
- git/hooks: add proxy/deploy.sh to post-receive hook
- CLAUDE.md: document proxy setup and client config
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'proxy/renew-cert.sh')
| -rw-r--r-- | proxy/renew-cert.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/proxy/renew-cert.sh b/proxy/renew-cert.sh new file mode 100644 index 0000000..8924d9b --- /dev/null +++ b/proxy/renew-cert.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")" + +DOMAIN="proxy.yyamashita.com" +CADDY_DIR="/app/infra/caddy" +CADDY_CERT_BASE="/data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/${DOMAIN}/${DOMAIN}" + +echo "証明書を更新中..." +mkdir -p certs + +if ! docker compose -f "$CADDY_DIR/docker-compose.yml" exec -T caddy \ + cat "${CADDY_CERT_BASE}.crt" > certs/server.crt; then + echo "Error: 証明書の取得に失敗しました。Caddyfile に ${DOMAIN} が設定されているか確認してください。" + exit 1 +fi +docker compose -f "$CADDY_DIR/docker-compose.yml" exec -T caddy \ + cat "${CADDY_CERT_BASE}.key" > certs/server.key +chmod 600 certs/server.key + +echo "証明書を更新しました。" +bash "$(pwd)/deploy.sh" |
