Control-D-Inc / ctrld

A highly configurable, multi-protocol DNS forwarding proxy
MIT License
424 stars 21 forks source link

Issue with ASUSWRT-Merlin router #45

Closed pmcarrion closed 1 year ago

pmcarrion commented 1 year ago

Hello,

I installed ctrld on my Asus RT-AX88U router with ASUSWRT-Merlin 388.2_2 using this command:

sh -c 'sh -c "$(curl -sL https://api.controld.com/dl)" -s ##########  forced'

        __         .__       .___
  _____/  |________|  |    __| _/
_/ ___\   __\_  __ \  |   / __ |
\  \___|  |  |  | \/  |__/ /_/ |
 \___  >__|  |__|  |____/\____ |
     \/       installer       \/

size: 79716 bytes (51356 left)
---------------------
|    System Info    |
---------------------
OS Type      : linux
OS Vendor    : ASUSWRT-Merlin
Is Router    : yes
Arch         : aarch64
CPU          : N/A
Free RAM     : 551 MB / 882 MB
---------------------
|  Install Details  |
---------------------
Resolver ID  : ##########
Binary URL   : https://assets.controld.com/ctrld/linux/armv5/ctrld
Install Path : /jffs/controld
---------------------
 - Starting download
 - Making binary executable
 - Launching /jffs/controld/ctrld
---------------------
May 23 21:59:24.000 INF writing default config file to: /jffs/controld/ctrld.toml
May 23 21:59:24.000 INF fetching Controld D configuration from API: ########## mode=cd
May 23 21:59:25.000 INF generating ctrld config from Control-D configuration mode=cd
May 23 21:59:25.000 INF writing config file to: /jffs/controld/ctrld.toml mode=cd
May 23 21:59:25.000 NTC Service started

The router is scheduled to reboot itself every day at 4am. After the last reboot, all my devices went offline and there's no way to get them back.

I tried using the same command again some minutes ago, but nothing happened:

➜ ssh USER@192.168.X.X
USER@192.168.X.X's password:

ASUSWRT-Merlin RT-AX88U 388.2_2 Sun May  7 16:36:37 UTC 2023
USER@RT-AX88U-####:/tmp/home/root# sh -c 'sh -c "$(curl -sL https://api.controld.com/dl)" -s ###########  forced'
USER@RT-AX88U-####:/tmp/home/root#

I noticed from the router's system log that it's complaining about the time: [timecheck] NTP sync error

How can I get the router back up?

Thanks.

cuonglm commented 1 year ago

@pmcarrion Thanks for reporting. Could you please send us /tmp/syslog.log file so we can look further?

In the meantime, you could uninstall ctrld and your router will be back to normal state:

$ cd /jffs/controld
$ ./ctrld service uninstall
pmcarrion commented 1 year ago

My network is back. Thanks.

What's the command I have to use to download the log from that path? Please provide an email address to send you the log once I download it.

cuonglm commented 1 year ago

My network is back. Thanks.

What's the command I have to use to download the log from that path?

Please provide an email address to send you the log once I download it.

What's your OS? On Windows, you can use WinSCP, on *nix, you can use scp command to download the file.

We dont need full file, though, just the log since the router restart is ok.

Please send it to: cuong@controld.com

pmcarrion commented 1 year ago
USER@RT-AX88U-XXXX:/jffs/controld# scp /tmp/syslog.log
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-P port] [-S program]
           [[user@]host1:]file1 [...] [[user@]host2:]file2

It didn't work. I''m on macOS. I'm accessing the router via SSH.

cuonglm commented 1 year ago
USER@RT-AX88U-XXXX:/jffs/controld# scp /tmp/syslog.log
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-P port] [-S program]
           [[user@]host1:]file1 [...] [[user@]host2:]file2

It didn't work. I''m on macOS. I'm accessing the router via SSH.

From your Mac, run this:

scp <user>@<router ip>:/tmp/syslog.log .

You may want to use scp -O if your router has old version of OpenSSH. Note that the file name could be different, so please use the correct one on the router.

pmcarrion commented 1 year ago

It keeps asking me to input a flag.

➜ scp USER@192.168.X.X:/tmp/syslog.log
usage: scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config]
           [-i identity_file] [-J destination] [-l limit]
           [-o ssh_option] [-P port] [-S program] source ... target
➜ scp -O USER@192.168.X.X:/tmp/syslog.log
usage: scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config]
           [-i identity_file] [-J destination] [-l limit]
           [-o ssh_option] [-P port] [-S program] source ... target
cuonglm commented 1 year ago

@pmcarrion You missed the last dot .:

scp <user>@<router ip>:/tmp/syslog.log .
yegors commented 1 year ago

@pmcarrion Is the reported issue happening on a device that enforces a profile that redirects everything, or potentially the NTP server used on the router? Look in Administration -> System -> NTP Server and Secondary NTP server. What are they set to, and if you resolve them via command line (nslookup domain.com) do they resolve to true IPs or redirected Control D IPs?

pmcarrion commented 1 year ago

@cuonglm

I got the file, but it only has events from the last 20 minutes. There's no reference to ctrld.

I also downloaded /jffs/syslog.log, but it doesn’t mention ctrld either.

The scheduled reboot and loss of connection happened at 4am. I regained connection after uninstalling the ctrld service from the router around 8am.

The logs were sent to you by email.

@yegors

NTP servers are set to: time.apple.com pool.ntp.org

➜ nslookup time.apple.com
Server:     127.0.0.1
Address:    127.0.0.1#53

Non-authoritative answer:
time.apple.com  canonical name = time.g.aaplimg.com.
Name:   time.g.aaplimg.com
Address: 17.253.10.149
Name:   time.g.aaplimg.com
Address: 17.253.10.165
Name:   time.g.aaplimg.com
Address: 17.253.12.125
➜ nslookup pool.ntp.org
Server:     127.0.0.1
Address:    127.0.0.1#53

Non-authoritative answer:
Name:   pool.ntp.org
Address: 162.159.200.123
Name:   pool.ntp.org
Address: 161.132.202.49
Name:   pool.ntp.org
Address: 162.159.200.1
pmcarrion commented 1 year ago

I reinstalled ctrld on my router yesterday, and everything was fine until it performed its scheduled reboot at 4am. All my devices have been down since that time.

I had to uninstall ctrld from my router again this morning to get my network back.

Will this issue be fixed in the next version?

cuonglm commented 1 year ago

I reinstalled ctrld on my router yesterday, and everything was fine until it performed its scheduled reboot at 4am. All my devices have been down since that time.

I had to uninstall ctrld from my router again this morning to get my network back.

Will this issue be fixed in the next version?

Yes, it already be fixed on dev version, you could try:


sh -c 'sh -c "$(curl -sL https://api.controld.dev/dl)" -s p2 forced'
pmcarrion commented 1 year ago

The dev version worked. Thanks.

yegors commented 1 year ago

Fixed is released in #51