readme.md

June 28, 2026 ยท View on GitHub

GL.iNet ACME

ACME Certificate Manager for GL.iNet Routers

Automate SSL/TLS certificates for your GL.iNet router with Let's Encrypt!

License Stars Forks Issues Last Commit


๐Ÿ’– Support the Project

If you find this tool helpful, consider supporting its development:

GitHub Sponsors Buy Me A Coffee Ko-fi PayPal


๐Ÿ“– About

The enable-acme.sh script enables the Automated Certificate Management Environment (ACME) for GL.iNet routers. It automatically requests a Let's Encrypt certificate for your router's DDNS domain and configures nginx to use it, providing secure HTTPS access to your router's web interface.

Created by Admon for the GL.iNet community.

๐ŸŽ–๏ธ Community Maintained โ€“ Part of the GL.iNet Toolbox project
โš ๏ธ Independent Project โ€“ Not officially affiliated with GL.iNet or Let's Encrypt


โœจ Features

  • ๐Ÿ”’ Automatic SSL/TLS Certificates โ€“ Requests and installs Let's Encrypt certificates
  • ๐Ÿ”„ Auto-Renewal โ€“ Certificates renew automatically via cron job with randomized timing
  • ๐ŸŒ DDNS Integration โ€“ Works seamlessly with GL.iNet DDNS
  • ๐ŸŒ IPv4/IPv6 Dual-Stack โ€“ Full support for both IPv4 and IPv6 networks
  • ๐Ÿ”Œ Port Reachability Check โ€“ Verifies port 80 accessibility via GL.iNet Community Reflector service
  • โš™๏ธ Dual Webserver Support โ€“ Configures both nginx (GL.iNet GUI) and uhttpd (LuCI)
  • ๐ŸŽฏ Dynamic Port Detection โ€“ Automatically detects uhttpd ports and preserves configuration
  • ๐Ÿ›ก๏ธ Firewall Management โ€“ Intelligent firewall control during certificate issuance and renewal
  • โœ… Validation Checks โ€“ Verifies DDNS and public IP match before proceeding
  • ๐Ÿ• Random Renewal Time โ€“ Daily renewal checks at random times (Let's Encrypt best practice)
  • ๐Ÿ’พ Optimized Persistence โ€“ Smart persistence strategy avoiding firmware upgrade conflicts
  • ๐Ÿ”ง Restore Function โ€“ Easy restoration to factory default configuration
  • ๐Ÿค– Unattended Mode โ€“ Support for automated installations with --force flag
  • ๐Ÿ”„ Modern acme.sh โ€“ Uses acme.sh v3.0.7 directly (no UCI dependencies)

๐Ÿ“‹ Requirements

RequirementDetails
RouterGL.iNet router with firmware v4.x or later
InternetWorking internet connection (IPv4 and/or IPv6)
DDNSDDNS must be enabled and configured
IP MatchDDNS IP must match router's public IP (verified by script)
Port 80Port 80 must be reachable from the internet
Webservernginx or uhttpd (or both) installed

โš ๏ธ Note: VPN IP addresses are not supported. The certificate is issued for the router's public IP.

๐Ÿ’ก IPv6 Support: The script automatically detects and uses IPv6 if available alongside IPv4.

๐Ÿ” Port Check: The script uses GL.iNet Reflector service to verify port 80 accessibility before attempting certificate issuance.


๐Ÿš€ Quick Start

Run the script without cloning the repository:

wget -O enable-acme.sh https://get.admon.me/acme-update && sh enable-acme.sh

Follow the on-screen instructions to complete the ACME setup.

Testing Port 80 Reachability

Before installing, you can test if port 80 is reachable from the internet:

sh enable-acme.sh --reflector

This performs a comprehensive connectivity check using the GL.iNet Reflector service.


๐Ÿ“š Usage

Installation Steps

  1. Download the script onto the router (or use the Quick Start command above)
  2. Open an SSH connection to the router
  3. Navigate to the directory where the script is located
  4. Execute the script:
sh enable-acme.sh
  1. Follow the on-screen instructions to complete the ACME process

Persistence Across Firmware Updates

During installation, you'll be asked if you want to make the installation permanent. If you choose "yes", the certificate files and renewal wrapper script will be preserved during firmware upgrades by adding them to /etc/sysupgrade.conf.

This means:

  • โœ… Your ACME certificates survive firmware updates
  • โœ… Renewal wrapper script is preserved
  • โœ… Webserver configurations are NOT persisted (to avoid conflicts)
  • โœ… Simply re-run the script after upgrading to reconfigure webservers

๐Ÿ’ก Why not persist webserver configs? GL.iNet firmware updates may change nginx/uhttpd configurations. By not persisting them, we avoid potential conflicts. The script quickly reconfigures webservers using your existing certificates after a firmware upgrade.

Manual Certificate Renewal

While certificates renew automatically, you can manually trigger renewal:

sh enable-acme.sh --renew

Or if you installed the script to /usr/bin:

/usr/bin/enable-acme --renew

๐ŸŽ›๏ธ Command Line Options

The enable-acme.sh script supports the following options:

OptionDescription
--renewManually renew the ACME certificate
--restoreRestore webservers to factory default configuration
--reflectorTest port 80 reachability via GL.iNet Reflector service
--forceSkip all confirmation prompts (for unattended installation)
--logShow timestamps in log messages
--asciiUse ASCII characters instead of emojis
--helpDisplay help message

Usage Examples

Standard Installation:

sh enable-acme.sh

Unattended Installation (no prompts):

sh enable-acme.sh --force

Renew Certificate:

sh enable-acme.sh --renew

Restore to Factory Default:

sh enable-acme.sh --restore

ASCII Mode (for older terminals):

sh enable-acme.sh --ascii

With Timestamps:

sh enable-acme.sh --log

๐Ÿ”„ Automatic Renewal

The certificate will be renewed automatically by a cron job installed by the script. The cron job runs at a randomized daily time (following Let's Encrypt best practices to distribute server load).

How it works:

  1. โฐ Cron job triggers at random daily time (between 00:00-23:59)
  2. ๐Ÿ›ก๏ธ Opens firewall port 80 temporarily
  3. ๐ŸŒ Disables HTTP on webservers (preserving original port configuration)
  4. ๐Ÿ”„ Runs acme.sh renewal (only renews if expiring within 60 days)
  5. ๐ŸŒ Re-enables HTTP on webservers
  6. ๐Ÿ›ก๏ธ Closes firewall port 80

Dual Webserver Support:

  • nginx (GL.iNet GUI): Automatically detected and managed on port 80/443
  • uhttpd (LuCI): Automatically detected and managed on configured ports (typically 8080/8443)
  • Both webservers receive the same certificate
  • Port configuration is dynamically detected and preserved

No manual intervention is required โ€“ just let it run!


โš™๏ธ Restoring Factory Configuration

To restore the webserver configurations to factory default and remove ACME certificates, use the built-in restore function:

sh enable-acme.sh --restore

This will:

  • โœ… Restore HTTP access on all webservers (nginx and/or uhttpd)
  • โœ… Revert to self-signed certificates
  • โœ… Restore original port configurations (dynamically detected)
  • โœ… Remove ACME firewall rules
  • โœ… Remove ACME configuration and certificates
  • โœ… Remove renewal wrapper script and cron job
  • โœ… Clean up sysupgrade.conf entries
  • โœ… Restart all affected webservers

GL.iNet Community Reflector Integration

The script uses the GL.iNet Community Reflector service for comprehensive connectivity testing:

Features:

  • Port 80 reachability verification
  • IPv4 and IPv6 detection
  • Detailed diagnostic feedback

๐Ÿ’ก Getting Help

Need assistance or have questions?


๐Ÿ™Œ Contributors

Thanks to everyone who has helped improve this project:

  • tpak โ€“ Fixed --install-cert truncating certificate files to 0 bytes on routers where issuance succeeds (#10, fixes #8)

Want to contribute? Open an issue or pull request!


โš ๏ธ Disclaimer

This script is provided as-is without any warranty. Use it at your own risk.

It may potentially:

  • ๐Ÿ”ฅ Break your router, computer, or network
  • ๐Ÿ”ฅ Cause unexpected system behavior
  • ๐Ÿ”ฅ Even burn down your house (okay, probably not, but you get the idea)

You have been warned!

Always read the documentation carefully and understand what a script does before running it. Ensure you have sufficient permissions to execute the script. The script behavior may vary depending on the router model and firmware version.


๐Ÿ“œ License

This project is licensed under the MIT License โ€“ see the LICENSE file for details.


๐Ÿงฐ Part of the GL.iNet Toolbox

This project is part of a comprehensive collection of tools for GL.iNet routers.

Explore more tools and utilities:

GL.iNet Toolbox

Discover Tailscale Updater, AdGuard Home Updater, and more community-driven projects!


Made with โค๏ธ by Admon for the GL.iNet Community

โญ If you find this useful, please star the repository!