flarectl: Official CLI for Cloudflare

flarectl is the official command-line interface (CLI) tool for Cloudflare, a widely used cloud-based service that provides various features for website optimization, security, and performance. With flarectl, users can interact with their Cloudflare services and manage their configurations and settings through the command line.

Here are some key features and functionalities of flarectl:

  • Zone Management: flarectl allows users to manage their Cloudflare zones from the command line. A zone represents a website or application protected and accelerated by Cloudflare. Users can create new zones, list existing zones, view zone details, and modify zone settings using flarectl commands. This includes configuration options for DNS, caching, SSL/TLS, and other features provided by Cloudflare.
  • DNS Management: flarectl provides commands to manage DNS records for a Cloudflare zone. Users can add, update, or delete DNS records, such as A records, CNAME records, TXT records, and more. This allows users to manage their DNS configurations directly from the command line, making it convenient for automating DNS updates or making bulk changes.
  • Firewall Rules: flarectl offers functionality to manage Cloudflare Firewall Rules, which allow users to set up custom security rules for their applications. Users can create, update, and delete Firewall Rules using the CLI, providing a flexible and programmatic way to manage security policies and protect their applications from various threats.
  • Cache Purging: flarectl enables users to purge the Cloudflare cache for specific files or URL patterns. This is useful when content on a website has been updated, and users want to ensure that the latest version is served from the Cloudflare cache. With flarectl, users can initiate cache purges from the command line, making it convenient for automating cache clearance tasks.
  • Analytics and Statistics: flarectl provides commands to retrieve analytics and statistics about website traffic, DNS requests, and other Cloudflare-related metrics. Users can obtain insights into their website’s performance, track usage trends, and monitor key metrics from the command line, allowing for easy integration with monitoring systems or scripting.
  • Integration with Automation: flarectl is designed to be scriptable and suitable for automation workflows. It supports authentication using Cloudflare API tokens, allowing users to authenticate their CLI commands securely. This makes it possible to incorporate flarectl commands into scripts, deployment pipelines, or other automated processes, enabling efficient management of Cloudflare services.
  • Documentation and Help: flarectl offers a built-in help system that provides detailed information about available commands, their usage, and options. Users can access documentation directly from the CLI, making it easy to explore and understand flarectl’s capabilities.

By using flarectl, users can effectively manage their Cloudflare services and configurations directly from the command line. It provides a convenient and programmatic way to interact with Cloudflare, automate tasks, and integrate Cloudflare management into existing workflows and systems.

flarectl Command Examples

1. Block a specific IP:

# flarectl firewall rules create --zone="example.com" --value="8.8.8.8" --mode="block" --notes="Block bad actor"

2. Add a DNS record:

# flarectl dns create --zone="example.com" --name="app" --type="CNAME" --content="myapp.herokuapp.com" --proxy

3. List all Cloudflare IPv4/IPv6 ranges:

# flarectl ips --ip-type [ipv4|ipv6|all]

4. Create many new Cloudflare zones automatically with names from domains.txt:

for domain in $(cat domains.txt)
do 
    flarectl zone info --zone=$domain
done

5. List all firewall rules:

# flarectl firewall rules list
Related Post