Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Cloudflare Bot Management #467

Closed
LukasdeBoer opened this issue May 25, 2020 · 9 comments · Fixed by #1363
Closed

Add support for Cloudflare Bot Management #467

LukasdeBoer opened this issue May 25, 2020 · 9 comments · Fixed by #1363
Milestone

Comments

@LukasdeBoer
Copy link

Bot management is a service provided by CloudFlare that detects bots and exposes new variables you can use in custom firewall rules. For more information, see here: https://www.cloudflare.com/products/bot-management/

It is enabled/disabled in the Settings menu of a zone, but it is not exposed via the settings API so it can not be set using this library at the moment. It is exposed via the following URL: https://api.cloudflare.com/client/v4/zones/$ZONE_ID/bot_management

This endpoint allows setting of the enabled flag, which enables bot management, and the fight_mode flag which will automatically challenge probable bots.

example GET response:

{
  "result": {
    "fight_mode": false,
    "enabled": true
  },
  "success": true,
  "errors": [],
  "messages": []
}

and via PUT you can set values:

{
  "enabled": true,
  "fight_mode": true
}

Would be great if this feature was supported so it then can also be used in the Cloudflare Terraform provider.

@jacobbednarz
Copy link
Member

There isn’t public API documentation for this yet so it won’t be added as we are only building on the stable exposed endpoints.

Are you able to open a support ticket to get this documented?

@LukasdeBoer
Copy link
Author

They said they won't document it until the API is final, so we'll have to wait for a bit here.

@jacobbednarz
Copy link
Member

Thanks for the update! Let's leave this as is for now then and once the team releases a stable API, we can add the functionality here.

@stale
Copy link

stale bot commented Feb 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 2, 2021
@stale
Copy link

stale bot commented Aug 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 3, 2021
@stale stale bot closed this as completed Jan 8, 2022
@dc232
Copy link

dc232 commented Jan 26, 2022

@jacobbednarz @LukasdeBoer any update on this?
Would be awesome to see this feature integrated into applications like terraform

@LukasdeBoer
Copy link
Author

Hi @dc232, It's good that they didn't declare the API final, because it looks like Cloudflare has completely overhauled this setup and now has Bot Management enabled by default, so this issue can be closed.

@shellandbull
Copy link

For those wondering how to make this available as a header just use -> https://developers.cloudflare.com/terraform/additional-configurations/transform-rules/#create-an-http-request-header-modification-rule and then grab the value request.cf.botManagement.score

@github-actions github-actions bot added this to the v0.75.0 milestone Aug 8, 2023
@github-actions
Copy link
Contributor

This functionality has been released in v0.75.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants