Configuring Gunbot with a Certbot SSL Certificate and a Real Domain on Windows, Linux, and macOS
Use a real domain and a Let's Encrypt certificate to access Gunbot over HTTPS on Windows, Linux, or macOS. This guide walks through Certbot setup and Gunbot configuration.
Introduction
Using a real domain simplifies remote access and, paired with SSL, keeps traffic encrypted. It can also improve reliability when IP-based access is restricted. A real domain is required for the Gunbot mobile application because Google and Apple restrict mobile apps from working without real domains.
Info
A real domain (e.g., mygunbot.example.com) combined with an SSL certificate (providing HTTPS) allows secure and easy remote access to your Gunbot instance. Certbot is a tool to obtain free SSL certificates from Let's Encrypt.
Benefits of Using a VPS (Virtual Private Server)
Choosing to run Gunbot on a VPS offers:
- 24/7 Operation: Keep Gunbot running without a home PC staying on.
- Stable Internet Connection: VPS providers typically offer reliable connectivity.
- Enhanced Security: VPS providers include security measures for the server and data.
- Scalability: Upgrade resources as trading activity grows.
Prerequisites
Before you start, ensure you have the following:
- A VPS account or a local server setup, with full administrative access.
- A real domain with DNS settings configured to point to your VPS or local server IP.
- Familiarity with basic command-line interface operations.
Installation Guide
Setting Up on Windows
Step 1: Install Certbot
Certbot is a free, open-source tool for obtaining Let's Encrypt certificates to enable HTTPS.
- Download and Install Certbot:
- Visit Certbot's official website and select Windows as your software.
- Follow the link to download the Certbot Windows installer.
- Run the installer and follow the on-screen instructions to complete the installation.
Step 2: Obtain a Certificate
-
Open Command Prompt as Administrator:
- Search for
cmdin your Windows search bar, right-click onCommand Prompt, and select 'Run as administrator'.
- Search for
-
Run Certbot:
- In the Command Prompt, navigate to the Certbot directory, if not set to PATH, by typing
cd path\to\certbot. - Enter the following command to obtain a certificate:
certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com
- Replace
yourdomain.comwith your actual domain. - Follow the on-screen prompts to complete domain verification. Certbot will verify your domain and issue the SSL certificate.
- Replace
- In the Command Prompt, navigate to the Certbot directory, if not set to PATH, by typing
Step 3: Install the Certificate in Gunbot
- Locate Certificate Files:
- After verification, your certificate and key are stored in
C:\Certbot\live\yourdomain.com\. You needfullchain.pem(certificate) andprivkey.pem(private key).
- After verification, your certificate and key are stored in
- Configure Gunbot to Use SSL:
- Copy
fullchain.pemandprivkey.pemto your Gunbot directory. Rename them tolocalhost.crtandlocalhost.key, or update your Gunbot configuration to point to the files. - Edit your
config.jsor GUI settings to enable HTTPS and specify the paths.
- Copy
Step 4: Configure Windows Firewall
- Ensure the port used by Gunbot (default
3001, or another if configured) is open in Windows Firewall to allow inbound connections.
Step 5: Test the Configuration
- Restart Gunbot and navigate to
https://yourdomain.com:port(whereportis your configured Gunbot GUI port) to verify that the SSL certificate is working.
Troubleshooting
- If you encounter errors related to the certificate not being trusted, ensure that
fullchain.pemis correctly installed and referenced. - For issues with accessing the Gunbot GUI, check firewall settings and ensure that the correct ports are open and forwarded if necessary.
Setting Up on Linux
- Access your VPS: Connect via SSH or terminal:
ssh root@your_vps_ip
- Install Certbot:
sudo apt updatesudo apt install certbot -y
- Generate SSL Certificates:
(Replacesudo certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com
yourdomain.comwith your actual domain)
Setting Up on macOS
- Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install Certbot:
brew install certbot
- Run Certbot:
(Replacesudo certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com
yourdomain.comwith your actual domain)
Configuring Gunbot to Use SSL
Configure the config.js file to use HTTPS.
Copy your SSL certificates for easier management (paths shown for Linux/macOS, adjust for Windows if necessary):
sudo cp /etc/letsencrypt/live/yourdomain.com/privkey.pem /path/to/Gunbot/localhost.key
sudo cp /etc/letsencrypt/live/yourdomain.com/fullchain.pem /path/to/Gunbot/localhost.crt
(Replace yourdomain.com and /path/to/Gunbot/ with your actual domain and Gunbot installation path)
Detailed GUI Configuration for Gunbot
Below is the JSON snippet that configures the GUI settings in Gunbot's config.js file:
"GUI": {
"enabled": true, // Activates the GUI.
"start": false, // The GUI will not start automatically on launch.
"port": 3001, // Defines the port number for GUI access.
"https": true, // Enables HTTPS for GUI communication.
"key": "localhost.key", // The SSL private key file, expected in the same directory as the config file.
"cert": "localhost.crt", // The SSL certificate file, expected in the same directory as the config file.
"networktraffic": false, // Disables monitoring of network traffic in #core.
"authentication": {
"login": true, // Requires users to log in.
"twoFA": false // Two-factor authentication is disabled.
}
}
Note: The example port 3001 is used here. If you changed this in previous steps to another value for Windows Firewall, ensure consistency.
Making Gunbot Accessible from Anywhere
- Port Forwarding: Open the configured port (e.g.,
3001) on your router to allow external connections to your server. - Firewall Settings: Configure your server's firewall (Windows Firewall,
ufwon Linux, macOS Firewall) to allow traffic on the configured port.
Verification and Troubleshooting
Restart Gunbot and verify that you can access it via https://yourdomain.com:PORT (replace PORT with your configured port, for example 3001). If you encounter issues accessing your Gunbot through the domain, verify DNS settings, certificate paths, and that your firewall allows traffic on the configured port. Common issues include incorrect file paths in configuration files and blocked ports.
Conclusion
Setting up Gunbot with a real domain and SSL certificate improves remote access security. For additional support, contact the support channels.