Deploy Apache Guacamole via Cloudflare Tunnels: Secure Remote Access Solution Without VPN
Guide to deploying Apache Guacamole on a Cloud VPS using Cloudflare Tunnels for secure remote access without a traditional VPN. Leverage Cloudflare's Zero Trust to protect...
Introduction
Apache Guacamole is an open-source remote access solution that allows users to connect to servers via protocols such as RDP, VNC, and SSH without installing client software. When deployed on a Cloud VPS, remote access must be rigorously secured to prevent network threats. Cloudflare Tunnels provide a secure method to expose internal services without opening ports on firewalls or relying on traditional VPNs.
Requirements and Preparation
- Cloud VPS with Ubuntu 22.04 or 24.04 (learn more: Cloud VPS with L3/L4/L7 Anycast Anti-DDoS)
- Cloudflare account with access to the "Tunnels" section
- Verified email address and access to the Cloudflare dashboard
- SSH access to the VPS (recommended using public key authentication)
- SSH hardening configured on the VPS (see hardening Ubuntu 24.04 VPS against SSH brute-force)
Deploy Apache Guacamole on VPS
Follow these steps to install and configure Apache Guacamole:
Step 1: Update System and Install Required Components
sudo apt update
sudo apt upgrade -y
sudo apt install -y guacamole-server guacamole-client tomcat9 tomcat9-admin
Step 2: Configure Guacamole
Create the configuration directory and the `guacamole.properties` file:
sudo mkdir -p /etc/guacamole
sudo touch /etc/guacamole/guacamole.properties
Edit the `guacamole.properties` file:
sudo nano /etc/guacamole/guacamole.properties
Add the following content (adjust values as needed):
guacamole-server:
guacd-hostname: localhost
guacd-port: 4822
mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacamole_db
mysql-username: guacamole_user
mysql-password: your_password
Step 3: Configure Tomcat to Run Guacamole
Create the `guacamole.war` file and copy it to Tomcat's webapps directory:
sudo cp /var/lib/tomcat9/webapps/guacamole.war /var/lib/tomcat9/webapps/
Set Up Cloudflare Tunnels
Cloudflare Tunnels enable secure exposure of internal services without opening firewall ports. This is a safer alternative to traditional VPNs.
Step 1: Install Cloudflare Tunnel
sudo apt install -y cloudflared
Step 2: Log in to Cloudflare
Run the following command to authenticate:
cloudflared tunnel login
Create a new tunnel:
cloudflared tunnel create guacamole-tunnel
Step 3: Configure the Tunnel
Create the configuration file `config.yml`:
sudo nano /etc/cloudflared/config.yml
Add the following content:
tunnel: guacamole-tunnel
credentials-file: /etc/cloudflared/guacamole-tunnel.json
ingress:
- hostname: guacamole.example.com
service: http://localhost:8080
- service: http_status:404
Step 4: Run the Tunnel
sudo cloudflared tunnel run guacamole-tunnel
Security and Authentication
Enhance security using the following measures:
- Set up OAuth or SSO authentication via Cloudflare Access
- Integrate automated ACME SSL/TLS certificate renewal with Cloudflare Tunnels
- Secure the VPS with SSH brute-force protection using public key authentication
- Ensure the system is protected by Network Security & 99.98% SLA Infrastructure at DPTCloud
Verify Connectivity
After configuration, access the following URL:
https://guacamole.example.com
Ensure you can access the Guacamole interface. If not, check the logs for Cloudflare Tunnels and Guacamole.
Troubleshooting
- Unable to access Guacamole: Check if the tunnel is running using
cloudflared tunnel list. Verify the configuration inconfig.yml. - SSL/TLS certificate issues: Ensure ACME SSL/TLS is correctly configured with Cloudflare. Refer to automated SSL/TLS certificate renewal guide.
- Cannot connect to MySQL: Verify that the MySQL service is running and that the username and password are correct.
References
Recommended NVMe Cloud VPS Plans to Deploy This Setup
Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.
VPS-3E
10% VAT included
- CPU: 2 vCPU
- RAM: 4 GB
- SSD: 50 GB NVMe
