Files
proxmox/docs/04-configuration/CLOUDFLARE_API_SETUP.md
defiQUG cb47cce074 Complete markdown files cleanup and organization
- Organized 252 files across project
- Root directory: 187 → 2 files (98.9% reduction)
- Moved configuration guides to docs/04-configuration/
- Moved troubleshooting guides to docs/09-troubleshooting/
- Moved quick start guides to docs/01-getting-started/
- Moved reports to reports/ directory
- Archived temporary files
- Generated comprehensive reports and documentation
- Created maintenance scripts and guides

All files organized according to established standards.
2026-01-06 01:46:25 -08:00

2.9 KiB

Cloudflare API Setup - Quick Start

Automated Configuration via API

This will configure both tunnel routes and DNS records automatically using the Cloudflare API.


Step 1: Get Cloudflare API Credentials

  1. Go to: https://dash.cloudflare.com/profile/api-tokens
  2. Click Create Token
  3. Use Edit zone DNS template OR create custom token with:
    • ZoneDNSEdit
    • AccountCloudflare TunnelEdit
  4. Copy the token

Option B: Global API Key (Legacy)

  1. Go to: https://dash.cloudflare.com/profile/api-tokens
  2. Scroll to API Keys section
  3. Click View next to "Global API Key"
  4. Copy your Email and Global API Key

Step 2: Set Up Credentials

Interactive Setup:

cd /home/intlc/projects/proxmox
./scripts/setup-cloudflare-env.sh

Or manually create .env file:

cat > .env <<EOF
CLOUDFLARE_API_TOKEN="your-api-token-here"
DOMAIN="d-bis.org"
TUNNEL_TOKEN="eyJhIjoiNTJhZDU3YTcxNjcxYzVmYzAwOWVkZjA3NDQ2NTgxOTYiLCJ0IjoiMTBhYjIyZGEtOGVhMy00ZTJlLWE4OTYtMjdlY2UyMjExYTA1IiwicyI6IlptRXlOMkkyTVRrdE1EZzFNeTAwTkRBNExXSXhaalF0Wm1KaE5XVmpaVEEzTVdGbCJ9"
EOF

chmod 600 .env

Step 3: Run Configuration Script

cd /home/intlc/projects/proxmox
./scripts/configure-cloudflare-api.sh

What it does:

  1. Gets zone ID for d-bis.org
  2. Gets account ID
  3. Extracts tunnel ID from token
  4. Configures 4 tunnel routes (rpc-http-pub, rpc-ws-pub, rpc-http-prv, rpc-ws-prv)
  5. Creates/updates 4 DNS CNAME records
  6. Enables proxy on all DNS records

What Gets Configured

Tunnel Routes:

  • rpc-http-pub.d-bis.orghttps://192.168.11.251:443
  • rpc-ws-pub.d-bis.orghttps://192.168.11.251:443
  • rpc-http-prv.d-bis.orghttps://192.168.11.252:443
  • rpc-ws-prv.d-bis.orghttps://192.168.11.252:443

DNS Records:

  • All 4 endpoints → CNAME → <tunnel-id>.cfargotunnel.com (🟠 Proxied)

Troubleshooting

"Could not determine account ID"

Add to .env:

CLOUDFLARE_ACCOUNT_ID="your-account-id"

Get account ID from: Cloudflare Dashboard → Right sidebar → Account ID

"API request failed"

  • Verify API token has correct permissions
  • Check token is not expired
  • Verify domain is in your Cloudflare account

"Zone not found"

  • Verify domain d-bis.org is in your Cloudflare account
  • Or set CLOUDFLARE_ZONE_ID in .env

Verify Configuration

After running the script:

  1. Check Tunnel Routes:

    • Zero Trust → Networks → Tunnels → Your Tunnel → Configure
    • Should see 4 public hostnames
  2. Check DNS Records:

    • DNS → Records
    • Should see 4 CNAME records (🟠 Proxied)
  3. Test Endpoints:

    curl https://rpc-http-pub.d-bis.org/health
    

Files Created

  • .env - Your API credentials (keep secure!)
  • Scripts are in: scripts/configure-cloudflare-api.sh