# How-To: Let's Encrypt on GLDDNS domain

**URL:** <https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544>\
**Category:** Router\
**Tags:** Featured\
**Created:** [March 9, 2024, 3:33pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544 "2024-03-09T15:33:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 9, 2024, 3:33pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/1 "2024-03-09T15:33:17Z")

</div>

Hi there 👋

I created another mighty 🦭 script!  
My newest script will automate the process of getting a Let's Encrypt certificate, which can be used for the GL GUI. It even will install a cronjob for automatic renewal! 🎉 It was tested on my Flint2.

 ![image](https://forum-static.gl-inet.com/original/3X/9/e/9ee1d27bf933bc0e0495ba5f954c5592bc48a701.jpeg)

# Dependencies

To execute the script, the following prerequisites must be met:

- A GL.iNet router with the latest firmware version (at least 4.x)
- A working internet connection.
- DDNS must be enabled and configured.
- DDNS IP must be the same as the router's public IP. Will be checked by the script.
- The script will request a certificate for the router's public IP.  
**VPN and (CG)NAT IP is not supported! So no certs for cellular devices, this is by design.**
- Only HTTP mode supported, no DNS mode. This is by design of GLDDNS

There is **no** need to disable VPN, the script will automatically use the _real_ WAN IP.

## Download

> **[GitHub - admonstrator/glinet-enable-acme: This script enables the Automated Certificate...](https://github.com/Admonstrator/glinet-enable-acme)**
>
> This script enables the Automated Certificate Management Environment (ACME) for GL.iNet routers.

## Quick run without downloading

You can run it without cloning the repository by using the following command:

```auto
wget -O enable-acme.sh https://raw.githubusercontent.com/Admonstrator/glinet-enable-acme/main/enable-acme.sh && sh enable-acme.sh

```

# Disclaimer

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

It may break your router, your computer, your network or anything else.  
It may even burn down your house 🔥 You have been warned!

# Reverting

To revert the changes:

```auto
sed -i '/listen \[::\]:80;/c\listen \[::\]:80;' /etc/nginx/conf.d/gl.conf
sed -i '/listen \[::\]:80;/c\listen \[::\]:80;' /etc/nginx/conf.d/gl.conf
sed -i 's|ssl_certificate .*;|ssl_certificate /etc/nginx/nginx.cer;|g' /etc/nginx/conf.d/gl.conf
sed -i 's|ssl_certificate_key .*;|ssl_certificate_key /etc/nginx/nginx.key;|g' /etc/nginx/conf.d/gl.conf
/etc/init.d/nginx restart
rm /usr/bin/enable-acme

```

After that, please remove the line `0 0 * * * /usr/bin/enable-acme --renew` from `crontab -e`

---

<div class="post-metadata">

**Author:** ![japa182](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@japa182](https://forum.gl-inet.com/u/japa182)\
**Post date:** [March 9, 2024, 3:50pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/2 "2024-03-09T15:50:00Z")

</div>

very very good, it’s a shame that my isp doesn’t leave the port 80 http and 443 https released, if not I would definitely use your script, if I change the router’s http port to another port that my isp allows and do Can I use this method of port forwarding on this chosen port?

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 9, 2024, 3:52pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/3 "2024-03-09T15:52:30Z")

</div>

> [@japa182](#):
>
> if I change the router’s http port to another port that my isp allows

Could you please try if you even can do that? It’s strange that your ISP does not allow 80/443. Can you use 8080 for example? If yes, I can integrate a way to change the ports.

---

<div class="post-metadata">

**Author:** ![japa182](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@japa182](https://forum.gl-inet.com/u/japa182)\
**Post date:** [March 9, 2024, 4:01pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/4 "2024-03-09T16:01:51Z")

</div>

unfortunately Vivo here in Brazil blocks most ports, the only one I tested that they don’t block is ssh 22 which is standard, but I can use another port like 8080, 8008, 8090 or 8443 for https

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 9, 2024, 4:07pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/5 "2024-03-09T16:07:34Z")

</div>

Unfortunately, it’s not possible to change the ports because the GLDDNS only supports HTTP-01-challenge, [which is fixed to 80 and 443](https://serverfault.com/a/1084031).

Maybe in future the GLDDNS service will add the possible to get DNS-verification. Nothing I can do about it, sorry.

---

<div class="post-metadata">

**Author:** ![Thinner3614](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@Thinner3614](https://forum.gl-inet.com/u/Thinner3614)\
**Post date:** [March 10, 2024, 12:53am UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/6 "2024-03-10T00:53:15Z")

</div>

It didn’t work for me. The script accuses that the public IP is not the same as the DDNS IP.

- I’m not using VPN
- I can access the router normally through DDNS
- Port 443 is open.

 ![Let's](https://forum-static.gl-inet.com/original/3X/4/4/444a8c82571eb2e8c6c54cffccf6b201c7cdbb43.png)

To prove that I have a public IP, I can access the router through it:

 ![Router](https://forum-static.gl-inet.com/original/3X/8/8/8833e7104ba272235a78b35958bc3eb5e46b1026.jpeg)

v4.5.7 beta release5

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 10, 2024, 7:54am UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/7 "2024-03-10T07:54:03Z")

</div>

Ah, you are using IPv6 - it does not work with that so far. I will try to fix the DDNS request.

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 10, 2024, 9:09am UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/8 "2024-03-10T09:09:29Z")

</div>

Fixed it by forcing IPv4 only - at least so far until I got my own IPv6 up and running to play around.  
@Thinner3614 Could you try again?

---

<div class="post-metadata">

**Author:** ![LupusE](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/lupuse/32/6737_2.png) [@LupusE](https://forum.gl-inet.com/u/LupusE)\
**Post date:** [March 10, 2024, 9:25am UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/9 "2024-03-10T09:25:01Z")

</div>

I really appreciate your warnings. I promise not to install it on my space station!

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [March 10, 2024, 9:29am UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/10 "2024-03-10T09:29:51Z")

</div>

The last who did it lost a battery pack which was going down in the sea …

---

<div class="post-metadata">

**Author:** ![Thinner3614](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@Thinner3614](https://forum.gl-inet.com/u/Thinner3614)\
**Post date:** [March 10, 2024, 11:51am UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/11 "2024-03-10T11:51:08Z")

</div>

It`s working. Very thanks for help! 😊

---

<div class="post-metadata">

**Author:** ![maholio](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/m/9f8e36/32.png) [@maholio](https://forum.gl-inet.com/u/maholio)\
**Post date:** [May 29, 2024, 4:06pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/12 "2024-05-29T16:06:53Z")

</div>

Purely theoretical based on script logic (I didn’t tested it) you can also add noip support for cases if ISP block port 80/443

```auto
echo "Select DDNS provider:"
echo "1. GLDDNS"
echo "2. No-IP"
read -p "Enter your choice (1 or 2): " DDNS_CHOICE

case $DDNS_CHOICE in
    1)
        DDNS_PROVIDER="gl"
        ;;
    2)
        DDNS_PROVIDER="noip"
        ;;
    *)
        echo "Invalid choice. Exiting..."
        exit 1
        ;;
esac

echo "Enter your email for ACME configuration:"
read EMAIL

# Variables for GLDDNS and No-IP
case $DDNS_PROVIDER in
    gl)
        DDNS_DOMAIN_PREFIX=$(uci get ddns.glddns.domain)
        ;;
    noip)
        DDNS_DOMAIN_PREFIX=$(uci get ddns.noip.domain)
        ;;
    *)
        echo "Unsupported DDNS provider. Exiting..."
        exit 1
        ;;
esac

# Functions
create_acme_config() {
    DDNS_PROVIDER=$1
    EMAIL=$2
    # Delete old ACME configuration file
    log "INFO" "Deleting old ACME configuration file for $DDNS_DOMAIN_PREFIX"
    uci delete acme.$DDNS_DOMAIN_PREFIX
    uci commit acme
    # Create new ACME configuration file
    log "INFO" "Creating ACME configuration file"
    uci set acme.@acme[0]=acme
    uci set acme.@acme[0].account_email="$EMAIL"
    uci set acme.@acme[0].debug='1'
    uci set acme.$DDNS_DOMAIN_PREFIX=cert
    uci set acme.$DDNS_DOMAIN_PREFIX.enabled='1'
    uci set acme.$DDNS_DOMAIN_PREFIX.use_staging='0'
    uci set acme.$DDNS_DOMAIN_PREFIX.keylength='2048'
    uci set acme.$DDNS_DOMAIN_PREFIX.validation='standalone'
    uci set acme.$DDNS_DOMAIN_PREFIX.update_nginx='1'
    uci set acme.$DDNS_DOMAIN_PREFIX.domains="$DDNS_DOMAIN_PREFIX"
    uci commit acme
    /etc/init.d/acme restart
}

```

Cannot test it now as I am away from my test router. On main I will not risk to test something 🙂

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [May 29, 2024, 4:13pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/13 "2024-05-29T16:13:49Z")

</div>

Only if noip offers changing of DNS entries.

DDNS does not need 80/443, Let's encrypt HTTP-01 challenge does.

---

<div class="post-metadata">

**Author:** ![maholio](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/m/9f8e36/32.png) [@maholio](https://forum.gl-inet.com/u/maholio)\
**Post date:** [May 29, 2024, 4:27pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/14 "2024-05-29T16:27:43Z")

</div>

> [@admon](#):
>
> offers changing of DNS entries

It does, but specific ones is paid

---

<div class="post-metadata">

**Author:** ![Thinner3614](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@Thinner3614](https://forum.gl-inet.com/u/Thinner3614)\
**Post date:** [June 2, 2024, 1:49pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/15 "2024-06-02T13:49:21Z")

</div>

I found this bug in MT6000 (v4.6.0-op24)

 ![DDNS](https://forum-static.gl-inet.com/original/3X/7/5/756d5acc43996db2d65ae9bfa2c7cbc95a28909d.png)

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [June 2, 2024, 1:54pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/16 "2024-06-02T13:54:25Z")

</div>

Is GLDDNS disabled on your device?

---

<div class="post-metadata">

**Author:** ![japa182](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@japa182](https://forum.gl-inet.com/u/japa182)\
**Post date:** [June 2, 2024, 2:37pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/17 "2024-06-02T14:37:20Z")

</div>

It probably has something to do with this change?

> [@DDNS host name not working suddenly?](https://forum.gl-inet.com/t/ddns-host-name-not-working-suddenly/42925/17):
>
> In our recent update, the server use the TCP peer public IP to update domain data instead of using http params in order to improve the security. So there is a issue in the old firmware, IPv4 data was uploaded by IPv6 network. It mean that the IPv4 record would not be update any more in the both IPv4 and IPv6 network . We decide to recover the original processing logic temporarily, but still consider close the logic when the most user update to the laste firmware in the future days.

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [June 2, 2024, 3:01pm UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/18 "2024-06-02T15:01:10Z")

</div>

No, shouldn't be an issue since GLDDNS won't be touched.

---

<div class="post-metadata">

**Author:** ![Thinner3614](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@Thinner3614](https://forum.gl-inet.com/u/Thinner3614)\
**Post date:** [June 4, 2024, 12:08am UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/19 "2024-06-04T00:08:10Z")

</div>

It's enabled:

 ![glinet](https://forum-static.gl-inet.com/original/3X/2/7/2701883e628870a8ccb9a75ebcaea0d45f859e60.png)

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [June 4, 2024, 4:27am UTC](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544/20 "2024-06-04T04:27:30Z")

</div>

In that case OpenWrt 24 seems to be not supported so far, I am sorry.

[Next page](https://forum.gl-inet.com/t/how-to-lets-encrypt-on-glddns-domain/39544.md?page=2)
