-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodule.info
43 lines (35 loc) · 1.02 KB
/
module.info
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# module.info
name=Cloudflare Argo Tunnel for Webmin
description=Create and configure a Cloudflare Argo Tunnel for your Webmin server
version=1.0
# tunnel_setup.pl
use LWP::UserAgent;
use JSON;
my $ua = LWP::UserAgent->new;
# Your Cloudflare API credentials
my $email = "your_email";
my $api_key = "your_api_key";
# Request headers
my $headers = {
'X-Auth-Email' => $email,
'X-Auth-Key' => $api_key,
'Content-Type' => 'application/json'
};
# Request body to create the tunnel
my $tunnel_request = {
"hosts" => [
"webmin.example.com"
],
"session_affinity" => "None",
"routing_policy" => "NoFilter"
};
# API endpoint to create the tunnel
my $tunnel_endpoint = "https://api.cloudflare.com/client/v4/tunnels";
# Send the API request to create the tunnel
my $response = $ua->post($tunnel_endpoint, Content => to_json($tunnel_request), %$headers);
# Check the response for success
if ($response->is_success) {
print "Tunnel created successfully\n";
} else {
print "Error creating tunnel: " . $response->status_line . "\n";
}