github avandeputte/haproxy-manager v2.5.0-beta.1
2.5.0-beta.1: Cloudflare services limited to countries

pre-releaseone hour ago

2.5.0-beta.1: Cloudflare services limited to countries

A beta, for nodes with Also offer beta versions ticked under Updates.

A service published through the Cloudflare Tunnel can now be limited to visitors from some countries. Visitors from anywhere else are stopped by Cloudflare's Firewall before they reach the tunnel. The guide has it under Limiting a service to countries.

  • In the service form, the Cloudflare section has a new field, Only from these countries: two-letter codes such as US or US CA GB. Empty means everywhere, as before.
  • At Apply the zone gets one Firewall custom rule, haproxy-manager: services limited to countries, that covers every limited service in the zone. It is written before the service's route, updated when the lists change, and removed when no service in the zone is limited any more, or at Disconnect.
  • The API token needs Zone WAF: Edit for this, on top of what it has. Nothing else needs it. Test the token now says in which zones the token has the right.

Worth knowing:

  • Your own Firewall rules are left alone, and keep running first. The Free plan allows five custom rules in a zone; this uses one of them, however many services it covers.
  • Tick Through Cloudflare only as well. The country is checked at Cloudflare, so a visitor who reaches the node's own port directly is not checked. Saving a limited service without it says so.
  • Paths and wildcards are told apart: shop.example.com and shop.example.com/admin can be limited to different countries.
  • A country is a guess from the visitor's address: a VPN gets around it. Tor (T1) and unknown (XX) are blocked unless listed. A code that is not one, such as UK, is refused when saving, with a hint that it is GB.

Tested

Against a real Cloudflare account and zone, on the container image: a service limited to another country blocked with Cloudflare's Sorry, you have been blocked page; the visitor's own country added, then let through; the limit removed and the rule gone; two services on one host with different countries (/ blocked, /admin and /admin/x let through); a wildcard host blocked; Disconnect removing the rule, the routes and the records. The zone's existing custom rule was the same afterwards, by id, version and content. A token with Zone WAF on one zone only was told so.

Not tried: a systemd host, a cluster, a zone on a paid plan, a service with a sign-in and countries together on the real account (covered by the tests only).

Don't miss a new haproxy-manager release

NewReleases is sending notifications on new releases.