Sync CrowdSec blacklists (ipset, nftables, or CrowdSec LAPI) to cloud firewall rules on GCP and Azure.
Ashwall watches a local blacklist source, creates matching deny rules in your cloud firewalls, and removes them when bans expire. State is tracked in Redis.
- Reads banned IPs from
ipset,nftables, or the CrowdSec decisions API - Reuses an existing cloud firewall/NSG rule when it still has capacity and enough Redis TTL; otherwise creates a new rule
- Stores ban metadata in Redis with TTLs matching the ban duration
- The unban service deletes orphaned cloud rules whose Redis keys have expired
- Go 1.23+
- Redis
- One of:
ipsetwith an active blacklist setnftwith an active blacklist set (e.g. CrowdSec nftables bouncer)- CrowdSec Local API reachable with a bouncer API key
- Credentials for the active cloud only (
CLOUD_PROVIDER=gceorazure)
Copy the templates from config/ to /opt:
sudo cp config/.env /opt/.env
sudo cp config/service-account.json /opt/service-account.jsonRuntime tuning lives in config/init.conf (installed to /opt/ashwall/config/init.conf).
Edit /opt/.env:
| Variable | Description |
|---|---|
CLOUD_PROVIDER |
gce/gcp or azure (optional; falls back to GCP/Azure IMDS auto-detect) |
GCP_PROJECT |
GCP project ID |
GCP_NETWORK |
VPC network path (e.g. global/networks/default) |
GCP_SERVICE_ACCOUNT_PATH |
Path to GCP service account JSON |
BLACKLIST_BACKEND |
ipset (default), nftables, or crowdsec |
IPSET_NAME |
Local ipset to watch (when backend is ipset) |
NFT_FAMILY |
nftables family, e.g. inet (when backend is nftables) |
NFT_TABLE |
nftables table, e.g. crowdsec |
NFT_SET |
nftables set, e.g. crowdsec-blacklists |
CROWDSEC_LAPI_URL |
CrowdSec LAPI base URL, e.g. http://127.0.0.1:8080 |
CROWDSEC_LAPI_KEY |
Bouncer API key from cscli bouncers add |
CROWDSEC_DECISION_TYPE |
Decision type filter (default ban) |
SUBSCRIPTION_ID |
Azure subscription ID |
RESOURCE_GROUP |
Azure resource group |
AZURE_CLIENT_ID |
Azure app (client) ID |
AZURE_TENANT_ID |
Azure tenant ID |
AZURE_CLIENT_SECRET |
Azure client secret |
REDIS_ADDR |
Redis address (localhost:6379) |
REDIS_PASSWORD |
Redis password (empty if none) |
REDIS_DB |
Redis DB index |
| Key | Description |
|---|---|
BANSCHEDULER_INTERVAL |
Ban poll interval (seconds) |
UNBANSCHEDULER_INTERVAL |
Orphan cleanup interval (seconds) |
BAN_DURATION |
Ban TTL in Redis / rule lifetime (seconds) |
MAX_IPS_PER_RULE |
Max IPs packed into one cloud rule before creating another |
REUSE_IF_TTL_LESS_THAN |
Reuse a rule only if its Redis TTL is at least this many seconds |
REDIS_BANRULE_KEY_PREFIX |
Redis key prefix for ban rules |
REDIS_BANNED_IP_KEY_PREFIX |
Redis key prefix for banned IPs |
| Feature | Azure NSG | GCP Firewall |
|---|---|---|
| Max IPs per rule | 4,000 | 256 CIDR blocks |
| Practical Ashwall default | 250 | 250 |
BLACKLIST_BACKEND=nftables
NFT_FAMILY=inet
NFT_TABLE=crowdsec
NFT_SET=crowdsec-blacklistsConfirm the set exists:
sudo nft list set inet crowdsec crowdsec-blacklistssudo cscli bouncers add ashwallBLACKLIST_BACKEND=crowdsec
CROWDSEC_LAPI_URL=http://127.0.0.1:8080
CROWDSEC_LAPI_KEY=<bouncer-api-key>
CROWDSEC_DECISION_TYPE=banAshwall polls /v1/decisions/stream?startup=true each ban cycle and syncs active IP/range decisions.
Fill in service-account.json with your GCP service account credentials.
NSG names are derived from the machine hostname prefix: {hostname}-nsg.
go build -o ashwall
chmod +x scripts/install.sh
sudo ./scripts/install.shThis installs the binary to /opt/ashwall and enables two systemd services:
ashwall-ban— watches the local blacklist and creates/updates cloud firewall rulesashwall-unban— deletes orphaned cloud rules after Redis TTLs expire
sudo systemctl status ashwall-ban ashwall-unban
sudo systemctl restart ashwall-ban ashwall-unban
sudo journalctl -u ashwall-ban -u ashwall-unban -fPrivate — all rights reserved.
