Skip to main content

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.

  1. Download and Install Certbot:
Step 2: Obtain a Certificate
  1. Open Command Prompt as Administrator:

    • Search for cmd in your Windows search bar, right-click on Command Prompt, and select 'Run as administrator'.
  2. 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.com with your actual domain.
      • Follow the on-screen prompts to complete domain verification. Certbot will verify your domain and issue the SSL certificate.
Step 3: Install the Certificate in Gunbot
  1. Locate Certificate Files:
    • After verification, your certificate and key are stored in C:\Certbot\live\yourdomain.com\. You need fullchain.pem (certificate) and privkey.pem (private key).
  2. Configure Gunbot to Use SSL:
    • Copy fullchain.pem and privkey.pem to your Gunbot directory. Rename them to localhost.crt and localhost.key, or update your Gunbot configuration to point to the files.
    • Edit your config.js or GUI settings to enable HTTPS and specify the paths.
Step 4: Configure Windows Firewall
  • Ensure the port used by Gunbot (default 5000, 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 (where port is 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.pem is 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

  1. Access your VPS: Connect via SSH or terminal:
    ssh root@your_vps_ip
  2. Install Certbot:
    sudo apt update
    sudo apt install certbot -y
  3. Generate SSL Certificates:
    sudo certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com
    (Replace yourdomain.com with your actual domain)

Setting Up on macOS

  1. Install Homebrew (if not already installed):
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install Certbot:
    brew install certbot
  3. Run Certbot:
    sudo certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com
    (Replace yourdomain.com with 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 (e.g., to 5000 for Windows Firewall), ensure consistency.

Making Gunbot Accessible from Anywhere

  1. Port Forwarding: Open the configured port (e.g., 3001) on your router to allow external connections to your server.
  2. Firewall Settings: Configure your server's firewall (Windows Firewall, ufw on 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.