Cloudflare: Unterschied zwischen den Versionen

Aus Zovis Wikili
Wechseln zu: Navigation, Suche
(Authenticate cloudflared)
(Create new Tunnels)
Zeile 62: Zeile 62:
 
The file is required if you want to:
 
The file is required if you want to:
  
===== Create new Tunnels =====
+
* Create new Tunnels
 
+
* Change DNS routing from cloudflared
Change DNS routing from cloudflared
 
  
 
The file is not required if you want to:
 
The file is not required if you want to:
  
Run an existing Tunnel
+
* Run an existing Tunnel
 
+
* Manage routing from the Cloudflare dashboard
Manage routing from the Cloudflare dashboard
 
 
 
 
 
  
 
===== Create a tunnel =====
 
===== Create a tunnel =====

Version vom 19. Februar 2021, 17:51 Uhr

Cloudflare

Argo Tunnel

Linux

run as Service

https://developers.cloudflare.com/argo-tunnel/reference/config/

https://developers.cloudflare.com/argo-tunnel/reference/service/

hostname: test.example.com
url: http://localhost:8096
logfile: /var/log/cloudflared.log



Windoof

Install cloudflared

https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation#windows

Once cloudflared is installed:

Navigate to the Downloads folder. Right-click on the ZIP folder and select Extract All to extract the executable. Next, open PowerShell. Navigate to the same Downloads folder. Run the cloudflared.exe executable as an administrator to confirm the installation, replacing the path in the example below with the specifics of your directory:

PS C:\Users\Administrator\Downloads\cloudflared-stable-windows-amd64> .\cloudflared.exe --version


https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/setup


Updating cloudflared

You can update cloudflared by running the following command.

cloudflared update

The update will cause cloudflared to restart which would impact traffic currently being served. You can perform zero-downtime upgrades by using Cloudflare's Load Balancer product or by using multiple cloudflared instances.



Authenticate cloudflared

Follow these steps to authenticate cloudflared:

1. Log in to your Cloudflare account with the following command:

cloudflared tunnel login

2. The command will attempt to open a browser window and prompt you to authenticate with your Cloudflare account.

If running on a headless system, copy the link and paste it into a browser.

3. Once authenticated, Cloudflare will return a certificate file, cert.pem, that will give this instance of cloudflared the ability to:

  • Create and delete Tunnels
  • Modify DNS records in your account

The file is required if you want to:

  • Create new Tunnels
  • Change DNS routing from cloudflared

The file is not required if you want to:

  • Run an existing Tunnel
  • Manage routing from the Cloudflare dashboard
Create a tunnel

Tunnels created in this method do not currently display in the Traffic tab of the Cloudflare dashboard. These connections will be added to the dashboard in a future release.

To create a Tunnel, run the following command:

cloudflared tunnel create <NAME>

Replace <NAME> with the name you want to give to the Tunnel. The name assigned can be any string and does not need to relate to the hostname where traffic will be served.

This command will create a Tunnel with the name provided and associate it with a UUID. The relationship between the UUID and the name is persistent. The command will not create a connection at this point.


Ct1.png


Creating a Tunnel generates a credentials file for that specific Tunnel. This file is distinct from the cert.pem file. To run the Tunnel without managing DNS from cloudflared, you only need the credentials file.

List available Tunnels

cloudflared can list all created Tunnels in your account, as well as those actively connected to Cloudflare, by running the following command:


cloudflared tunnel list


Note: the command requires the cert.pem file.

Lt1.png

Revoke and delete a Tunnel

​Revoke and delete a Tunnel

You can delete an existing Tunnel with cloudflared. To delete a Tunnel, run the following command:

cloudflared tunnel delete <NAME>

NOTE: The command requires the cert.pem file.

If there are still active connections on that Tunnel, then you will have to force the deletion with:

cloudflared tunnel delete -f <NAME>

This will cause those connections to be dropped.

Deleting the Tunnel also invalidates the credentials file associated with that Tunnel, meaning those connections can not be re-established.