netbird icon indicating copy to clipboard operation
netbird copied to clipboard

/etc/netbird/config.json is being modified by client process

Open PavelNiedoba opened this issue 1 year ago • 3 comments

Describe the problem

I had working server with connected clients. I changed management port from default 443 to 9443.

To Reproduce Have client installed and connected. then stop client netbird down Modify /etc/netbird/config.json

   ...
    "ManagementURL": {
        "Scheme": "https",
        "Opaque": "",
        "User": null,
        "Host": "vpn.xxx.eu:443",

change port 443 to 9443 and then start the client netbird up you will see error message

2024-02-12T16:46:05+01:00 WARN client/cmd/root.go:195: retrying Login to the Management service in 1.135610787s due to error rpc error: code = Unknown desc = getting device authorization flow info failed with error: context deadline exceeded

then open /etc/netbird/config.json and you will see it was modified and port 443 is set again.

Expected behavior /etc/netbird/config.json should never change unless being created for first time

A clear and concise description of what you expected to happen. client should connect to new url

Are you using NetBird Cloud? no

Please specify whether you use NetBird Cloud or self-host NetBird's control plane. self hosted

NetBird version 025.5

NetBird status -d output:

Daemon status: LoginFailed

Run UP command to log in with SSO (interactive login):

 netbird up 

If you are running a self-hosted version and no SSO provider has been configured in your Management Server,
you can use a setup-key:

 netbird up --management-url <YOUR_MANAGEMENT_URL> --setup-key <YOUR_SETUP_KEY>

More info: https://docs.netbird.io/how-to/register-machines-using-setup-keys

PavelNiedoba avatar Feb 12 '24 15:02 PavelNiedoba

I also tried to stop service by netbird service stop which seemed sucessfull

Netbird service has been stopped

then I modified '/etc/netbird/config.json' and started the service

but in /var/log/netbird/client/log i can see that netbird is trying to connect to obsolete address.

2024-02-12T17:08:07+01:00 ERRO client/internal/connect.go:303: error while connecting to the Signal Exchange Service vpn.xxx.eu:443: context deadline exceeded
2024-02-12T17:08:07+01:00 ERRO client/internal/connect.go:201: rpc error: code = FailedPrecondition desc = failed connecting to Signal Service : context deadline exceeded
2024-02-12T17:08:28+01:00 ERRO signal/client/grpc.go:87: failed to connect to the signalling server context deadline exceeded

which seems that there is another place with configuration, but i cannot find it.

PavelNiedoba avatar Feb 12 '24 16:02 PavelNiedoba

@PavelNiedoba I've just conducted tests on the up and down commands, and it appears that they function as expected, with the daemon being responsible for maintaining the management URL. You can indeed establish the management URL via the up -m ... command, and it should persist in the configuration.

Regarding the second comment on service, I attempted the following steps:

  1. Stopped the netbird service using netbird service stop.
  2. Modified the port in /etc/netbird/config.json.
  3. Restarted the service with netbird service start.
  4. Upon restart, I confirmed that the new port is indeed in use.

In your log output, it complains about vpn.xxx.eu:443. The clients get that from the management can you confirm how this is configured there?

It seems the behavior aligns with expectations. Let me know if further investigation is needed!

surik avatar Feb 13 '24 10:02 surik

@surik I have same problem , I have changed the managment port to 9443 and it works, but client still try to connect to signal service with 443 port. what's meaning that you mentioned "the clients get that from management"? where should I config it? management UI , or management container? thanks :)

reickbao avatar May 30 '24 01:05 reickbao