flarectl
Manage Cloudflare resources from the command line
TLDR
Block a specific IP
Add a DNS record
List all Cloudflare IPv4/IPv6 ranges
Create many new Cloudflare zones automatically with names from domains.txt
List all firewall rules
SYNOPSIS
flarectl [command] [options]
PARAMETERS
tunnel create
Creates a new tunnel with the specified name.
tunnel info
Retrieves detailed information about a specific tunnel by its ID.
tunnel list
Lists all tunnels associated with your Cloudflare account.
tunnel delete
Deletes a tunnel with the specified ID.
tunnel route
Routes the hostname traffic through specified tunnel.
tunnel unroute
Stops routing the hostname traffic through specified tunnel.
tunnel token
Creates a new tunnel ingress rule.
tunnel ingress
Manages tunnel ingress rules.
--api-key
Specifies the Cloudflare API key to use for authentication. Alternatively, environment variables like `CLOUDFLARE_API_KEY` can be used.
--api-email
Specifies the Cloudflare API email to use for authentication. Alternatively, environment variables like `CLOUDFLARE_API_EMAIL` can be used.
--account-id
Specifies the Cloudflare account ID. Alternatively, environment variables like `CLOUDFLARE_ACCOUNT_ID` can be used.
--zone-id
Specifies the Cloudflare Zone ID. Alternatively, environment variables like `CLOUDFLARE_ZONE_ID` can be used.
--config
Specifies the path to the configuration file.
--help
Displays help information for the command.
DESCRIPTION
flarectl
is a command-line tool used to manage Cloudflare Tunnel resources. Cloudflare Tunnel, formerly known as Argo Tunnel, provides a secure way to connect your origin server to Cloudflare without exposing it to the public internet. flarectl
allows users to create, update, and delete tunnels, manage tunnel credentials (certs), and obtain status information about existing tunnels. It is primarily used for automating tunnel deployments, integrating with CI/CD pipelines, and performing administrative tasks related to tunnel configuration. The tool interacts with the Cloudflare API to perform these operations, requiring appropriate API credentials to authenticate and authorize actions. It enables users to manage tunnels effectively from the command line, offering an alternative to the Cloudflare dashboard interface.
Using flarectl
requires you to have a Cloudflare account, and appropriate DNS records configured on Cloudflare, and you need to install the tool on your origin server.
CAVEATS
Requires valid Cloudflare API credentials and appropriate permissions to manage tunnels. Ensure that the tunnel is properly configured in the Cloudflare dashboard after creation or modification. The tunnel should have at least one route configured through a hostname.
AUTHENTICATION
Authentication can be provided through environment variables (e.g., CLOUDFLARE_API_KEY
, CLOUDFLARE_API_EMAIL
, CLOUDFLARE_ACCOUNT_ID
) or through command-line flags. Using environment variables is recommended for security.
CONFIGURATION FILE
A configuration file can be used to store default values for API keys, account IDs, and zone IDs. This simplifies command usage by avoiding the need to repeatedly specify these values on the command line. The default config path is ~/.flarectl/config.json
. You can specify a different config with the --config
parameter.
INGRESS RULES
Ingress rules define how traffic is routed through the tunnel. They can be configured to route traffic based on hostname, path, and other criteria. The tunnel ingress
command provides options for managing these rules.
HISTORY
flarectl
was developed as a command-line interface to manage Cloudflare Tunnels, formerly known as Argo Tunnel. The initial focus was to provide a programmatic way to create, configure, and manage these tunnels, improving automation capabilities. The tool evolved alongside the Cloudflare Tunnel service, adding support for new features and functionalities. Early versions focused on basic tunnel management, while later iterations incorporated more advanced capabilities such as ingress rule management and integration with CI/CD pipelines.
SEE ALSO
cloudflared(1)