saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod#
Module for Setting up CloudFlare Zero Trust Tunnels
- depends:
- CloudFlare python module
This module requires the python wrapper for the CloudFlare API. https://github.com/cloudflare/python-cloudflare
- Cloudflared Tunnel Client
This module requires that the cloudflared utility to be installed. https://github.com/cloudflare/cloudflared
- configuration:
This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The module will use the ‘cloudflare’ key by default
For example:
cloudflare: api_token: account:
- api_token:
API Token with permissions to create CloudFlare Tunnels
- account:
CloudFlare Account ID, this can be found on the bottom right of the Overview page for your domain
- saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod.get_tunnel(tunnel_name)[source]#
Get tunnel details for the supplied name
- tunnel_name
User friendly name of the tunnel
CLI Example:
salt '*' cloudflare_tunnel.get_tunnel sample-tunnel
Returns a dictionary containing the tunnel details if successful or
False
if tunnel doesn’t exist
- saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod.create_tunnel(tunnel_name)[source]#
Create a cloudflare configured cloudflare tunnel
- tunnel_name
User friendly name for the tunnel
CLI Example:
salt '*' cloudflare_tunnel.create_tunnel example_tunnel_name
Returns a dictionary containing the tunnel details if successful or
False
if it already exists
- saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod.remove_tunnel(tunnel_id)[source]#
Delete a cloudflare tunnel
- tunnel_id
tunnel uuid to remove
CLI Example:
salt '*' cloudflare_tunnel.remove_tunnel <tunnel uuid>
Returns
True
if tunnel removed
- saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod.get_dns(dns_name)[source]#
Get DNS details for the supplied dns name
- dns_name
DNS record name
CLI Example:
salt '*' cloudflare_tunnel.get_dns sample.example.com
Returns a dictionary containing the dns details or
False
if it does not exist
- saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod.create_dns(hostname, tunnel_id)[source]#
Create cname record for the tunnel
- hostname
DNS record name
- tunnel_id
tunnel uuid
CLI Example:
salt '*' cloudflare_tunnel.create_dns test.example.com tunnel_id
Returns a dictionary containing the dns details
- saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod.remove_dns(hostname)[source]#
Delete a cloudflare dns entry
- hostname
DNS record to remove
CLI Example:
salt '*' cloudflare_tunnel.remove_dns sub.domain.com
Returns
True
if successful
- saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod.get_tunnel_config(tunnel_id)[source]#
Get a cloudflare tunnel configuration
- tunnel_id
tunnel uuid to get the config of
CLI Example:
salt '*' cloudflare_tunnel.get_tunnel_config <tunnel uuid>
Returns a dictionary containing the tunnel configuration details or
False
if it does not exist
- saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod.create_tunnel_config(tunnel_id, config)[source]#
Create a cloudflare tunnel configuration
See https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup /tunnel-guide/local/local-management/configuration-file/ for config options
Automatically adds the catch-all rule http_status:404
- tunnel_id
tunnel uuid to add the config to
- config
ingress rules for the tunnel
CLI Example:
salt '*' cloudflare_tunnel.create_tunnel_config <tunnel uuid> '{ingress : [{hostname": "test", "service": "https://localhost:8000" }]}'
Returns a dictionary containing the tunnel configuration details
- saltext.cloudflare_tunnel.modules.cloudflare_tunnel_mod.is_connector_installed()[source]#
Check if connector service installed
CLI Example:
salt '*' cloudflare_tunnel.is_connector_installed
Returns
True
if it installed orFalse
if it is not