Skip to content

Commit 5e8f53c

Browse files
authored
Add security best practices for Logpush dedicated egress IP proxy zone (#27241)
* Add security best practices for Logpush dedicated egress IP proxy zone * Fix broken link to service tokens documentation
1 parent 4f2e67f commit 5e8f53c

File tree

1 file changed

+64
-0
lines changed
  • src/content/docs/logs/logpush/logpush-job/enable-destinations

1 file changed

+64
-0
lines changed

src/content/docs/logs/logpush/logpush-job/enable-destinations/egress-ip.mdx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,67 @@ The following example shows how to set up logpush and Dedicated CDN Egress IPs t
7676
- Configuration: Select dataset, job name, filters, and fields. Refer to the [Logpush documentation](/logs/logpush/) for more details.
7777

7878
2. Check destination to confirm if the logs are received.
79+
80+
## 5. Secure your proxy zone endpoint
81+
82+
The proxy zone hostname is publicly resolvable, but traffic passes through Cloudflare's edge where you can apply security controls. Use the following best practices to protect your endpoint.
83+
84+
### Add a secret header with WAF validation
85+
86+
Add a secret token as an HTTP header in your Logpush job, then create a WAF rule to block requests without it. This is the recommended approach for most deployments.
87+
88+
**Configure Logpush with a secret header**
89+
90+
Any URL parameter starting with `header_` becomes an HTTP header in the request. When creating or updating your Logpush job, add the secret header to your destination URL:
91+
92+
```txt
93+
https://logpush.yourdestinationendpoint.com?header_X-Logpush-Secret=YOUR_RANDOM_SECRET_TOKEN
94+
```
95+
96+
Generate a strong random token using `openssl rand -hex 32`.
97+
98+
**Create a WAF custom rule**
99+
100+
In the proxy zone, go to **Security** > **WAF** > **Custom rules** and create a rule to block requests without the correct secret header.
101+
102+
- **Expression:**
103+
```txt
104+
(http.host eq "logpush.yourdestinationendpoint.com" and all(http.request.headers["x-logpush-secret"][*] ne "YOUR_RANDOM_SECRET_TOKEN"))
105+
```
106+
- **Action:** Block
107+
108+
### Add ASN-based filtering
109+
110+
For defense in depth, add a rule to only allow traffic from Cloudflare's ASN. Logpush traffic originates from Cloudflare's network (ASN 13335 or 132892).
111+
112+
- **Expression:**
113+
```txt
114+
(http.host eq "logpush.yourdestinationendpoint.com" and not ip.geoip.asnum in {13335 132892})
115+
```
116+
- **Action:** Block
117+
118+
:::note
119+
ASN filtering alone is insufficient because other Cloudflare customers' traffic also originates from these ASNs. Always combine with secret header validation.
120+
:::
121+
122+
### Use Access Service Tokens for high-security environments
123+
124+
For stronger authentication, use [Cloudflare Access Service Tokens](/cloudflare-one/access-controls/service-credentials/service-tokens/) for machine-to-machine authentication. Create a Service Token in the Zero Trust dashboard, then configure Logpush with the Access headers:
125+
126+
```txt
127+
https://logpush.yourdestinationendpoint.com?header_CF-Access-Client-Id=YOUR_CLIENT_ID&header_CF-Access-Client-Secret=YOUR_CLIENT_SECRET
128+
```
129+
130+
### Verify your security configuration
131+
132+
Test that your WAF rules are blocking unauthorized requests:
133+
134+
```bash
135+
$ curl https://logpush.yourdestinationendpoint.com
136+
# Expected: error code: 1020
137+
138+
$ curl -H "X-Logpush-Secret: wrong-token" https://logpush.yourdestinationendpoint.com
139+
# Expected: error code: 1020
140+
```
141+
142+
Check Cloudflare Analytics for the proxy zone to confirm Logpush traffic is flowing, and monitor WAF events to ensure unauthorized requests are blocked.

0 commit comments

Comments
 (0)