Control-D-Inc / ctrld

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

ctrld CLI on a Ubiquiti Enterprise Fortress Gateway #178

Open standrake opened 1 month ago

standrake commented 1 month ago

Hi,

Opening an issue for clarity here as this is my first time using the CLI, and am in the process of setting up this new router.

Model: Ubiquiti Enterprise Fortress Gateway

The problem that I am seeing is that the installer appears to identify that it is a router (I think?) and install the binary to /data/controld, however the config file gets placed in /etc/controld/ctrld.toml which as I understand it will not survive a reboot. Before going to far with this setup I wanted to seek guidance and see if it is just that this product is too new and code updates need to be made to support it.

Thanks in advance!

Here is the output of the installer run

root@skynet:~# sh -c 'sh -c "$(curl -sL https://api.controld.com/dl)"'

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

---------------------
|    System Info    |
---------------------
OS Type      : linux
OS Vendor    : ubios
OS Version   : 4.0.18.16835
Router Model : Enterprise Fortress Gateway
Arch         : aarch64
CPU          : N/A
Free RAM     : 20276 MB / 32411 MB
---------------------
|  Install Details  |
---------------------
Binary URL   : https://dl.controld.com/linux-arm64/ctrld
Install Path : /data/controld
---------------------
Install binary and run it? (y/n): 
cuonglm commented 1 month ago

Hello, since v1.3.8, we changed the default directory on EdgeOS: https://github.com/Control-D-Inc/ctrld/commit/b3eebb19b6a0657de5ec1c8f647326dd81cf74a5, so it will survive after firmware upgrade. Your device seems to be an Ubios based, so /etc/controld is what we are storing config file.

If you run ctrld in cd mode, then you dont have to worry about it, ctrld will re-generate config file upon start.

If you want to use your own config file, just passing --config flag with the path to your config file, for example:

ctrld start --config=data/controld/ctrld.toml
standrake commented 1 month ago

Thank you for the great follow up, I really appreciate it. I am very new to control D, so can you point me to the right docs on what cd mode is?

I would like my config regenerated by default so it survives a reboot. If it now can survive in /etc that would be fantastic.

All I have done to date is run the installer and did a very basic configuration as I am evaluating control D coming from nextDNS.

Thank you once again.

cuonglm commented 1 month ago

@standrake Here's from the README: https://github.com/Control-D-Inc/ctrld/tree/main?tab=readme-ov-file#control-d-auto-configuration

standrake commented 1 month ago

Thank you very much for the link to the documentation, I appreciate it.

So far, I have only installed the control D CLI and configured it in nextDNS mode and that is it. Since I have not had to use the CD mode is this sufficient? Based on my understanding, which I will admit is limited at this point I think the answer is yes.

Can you link me to the source, or documentation where I can educate myself on exactly what is done on a Ubiquiti router that would go a long way to help me out. The commit you shared above is for EdgeOS, which is different than the Unifi Enterprise Fortress Gateway which is a newer version of the UDM PRO, UDM SE, or UDM Pro Max.

Thanks again.

cuonglm commented 1 month ago

Can you link me to the source, or documentation where I can educate myself on exactly what is done on a Ubiquiti router that would go a long way to help me out. The commit you shared above is for EdgeOS, which is different than the Unifi Enterprise Fortress Gateway which is a newer version of the UDM PRO, UDM SE, or UDM Pro Max.

As a user, you don't have to do anything, ctrld will detect your router platform and do all the required setup to make it works: https://github.com/Control-D-Inc/ctrld?tab=readme-ov-file#supported-routers

You may want to read: https://github.com/Control-D-Inc/ctrld/blob/v1.3.9/internal/router/ubios/ubios.go to see what ctrld does under the hood.

standrake commented 1 month ago

Thank you for the links to the source, that was very informative!

Sp basically, once I installed ctrld and configure it then it will persist. I will do some more testing as the EFG is a newer device and report back tomorrow.

standrake commented 1 month ago

Following up on my own post. IT has been several days and several reboots and things are behaving as expected.

There will be a new UnifiOS update coming in a week or so (or sooner), so I will follow up once more to see if everything survives a firmware upgrade on the EFG.

Thanks again, @cuonglm !