Skip to content

Latest commit

 

History

History
41 lines (34 loc) · 1.1 KB

File metadata and controls

41 lines (34 loc) · 1.1 KB

Setup Cloudflare

1. Create a list

  1. Go to https://dash.cloudflare.com
  2. Manage account -> Configurations -> Lists
  3. Create new list:
    • Identifier: public_ips
  4. Go to the newly created list and grab the Account ID and List ID from the url: https://dash.cloudflare.com/<Account ID>/configurations/lists/<List ID>

2. Create a WAF rule

  1. Go to https://dash.cloudflare.com
  2. Websites -> Domain -> Security -> WAF
  3. Create new rule:
    • Rule name: Block when the IP address is not ours
    • Action: Block
    • Expression:
      (http.host eq "sub.domain.com" and not ip.src in $public_ips)
      

Docker

1. Prerequisites

  1. Copy docker-compose.example.yml to docker-compose.yml
  2. Edit docker-compose.yml and fill in the Account ID and List ID from the step above. For the Auth Email and Auth Key, go to https://dash.cloudflare.com/profile/api-tokens and grab the Global API Key.

2. Build (optional)

docker compose build
docker compose push

3. Deploy

docker compose up -d

Run job manually

docker compose exec job php job.php