Skip to content

Small Docker image based on Alpine Linux that will allow you to update a list of IPs based on their hostnames

Notifications You must be signed in to change notification settings

trebsoj/docker-cloudflare-ip-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker - Cloudflare IP List (watcher)

Small Docker image based on Alpine Linux that will allow you to update a list of IPs based on their hostnames.

https://hub.docker.com/r/trebsoj/cloudflare-ip-list

Usage (docker run)

docker run \
    -e ACCOUNT_ID=[YOUR_ACCOUNT_ID] \
    -e LIST_ID=[YOUR_LIST_ID] \
    -e TOKEN=[YOUR_TOKEN] \
    -e HOSTNAMES="docker.com example.com" \
    -e CHECK_INTERVAL_SECONDS=60 \
    trebsoj/cloudflare-ip-list

In fields HOSTNAMES and CHECK_INTERVAL_SECONDS in the previous code they are only examples.

Usage (docker compose)

name: cloudflare-ip-list
services:
    cloudflare-ip-list:
        image: trebsoj/cloudflare-ip-list:latest
        container_name: cloudflare-ip-list
        restart: always
        environment:
            - ACCOUNT_ID=[YOUR_ACCOUNT_ID]
            - LIST_ID=[YOUR_LIST_ID]
            - TOKEN=[YOUR_TOKEN]
            - HOSTNAMES=docker.com example.com
            - CHECK_INTERVAL_SECONDS=60

In fields HOSTNAMES and CHECK_INTERVAL_SECONDS in the previous code they are only examples.

Environments

  • Required ACCOUNT_ID : Your CloudFlare account ID.
  • Required LIST_ID : List ID that you want to update.
  • Required TOKEN : Your CloudFlare scoped API token.
  • Required HOSTNAMES : List of hostnames, separated by a white space.
  • Required CHECK_INTERVAL_SECONDS : Seconds between check.

Create new API token

To create a CloudFlare API token for your DNS zone go to https://dash.cloudflare.com/profile/api-tokens and follow these steps:

  1. Click Create Token
  2. Provide the token a name, for example, docker-cloudflare-ip-list
  3. Grant the token the following permissions:
    • Permissions - Account Filter Lists - Edit
    • Account Resources - All accounts
    • Continue to summary
  4. Complete the wizard and copy the generated token into the TOKEN variable for the container.

Create new list

To create a new list in Cloudflare follow these steps:

  1. Go to List Menu: List menu
  2. Set Type=IP.
  3. Set name of list.
  4. Save.

Get Account and List ID

We can easily obtain these 2 identifiers from the browser's URL.

In the previous menu, if you click on the list edition: List menu

The browser URL will look something like this:

  • https://dash.cloudflare.com/ACCOUNT_ID/configurations/lists/LIST_ID

About

Small Docker image based on Alpine Linux that will allow you to update a list of IPs based on their hostnames

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published