-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow specifying --wg-iface and --wg-port #659
Conversation
I guess adding entries to interfaces blacklist would be handy too |
hello @nazarewk, thanks for the contribution. The Pr is still with a Draft status. I have a few comments to add and some requests as well, but I wonder if you want to add more to it. |
I have what I personally need in the PR, but I'm up for comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @nazarewk. I left some comments regarding the input; we are moving things a bit to be configured through the up command to prevent reinstallation of the daemon.
ccb33b5
to
3bdbc96
Compare
3bdbc96
to
5c19e23
Compare
what is the difference between |
The service start and stop only controls the OS system start and stop of a service. The I saw that you updated the flags to be added with the |
if !slices.Contains(config.IFaceBlackList, config.WgIface) { | ||
var newBlacklist []string | ||
replaced := false | ||
for _, ifc := range config.IFaceBlackList { | ||
if ifc == oldIface { | ||
ifc = config.WgIface | ||
replaced = true | ||
} | ||
newBlacklist = append(newBlacklist, ifc) | ||
} | ||
if !replaced { | ||
newBlacklist = append(newBlacklist, config.WgIface) | ||
} | ||
log.Infof("prepending Wireguard Interface Name to interface blacklist %#v, updated to %v (old value %v)", config.WgIface, newBlacklist, config.IFaceBlackList) | ||
config.IFaceBlackList = newBlacklist | ||
refresh = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !slices.Contains(config.IFaceBlackList, config.WgIface) { | |
var newBlacklist []string | |
replaced := false | |
for _, ifc := range config.IFaceBlackList { | |
if ifc == oldIface { | |
ifc = config.WgIface | |
replaced = true | |
} | |
newBlacklist = append(newBlacklist, ifc) | |
} | |
if !replaced { | |
newBlacklist = append(newBlacklist, config.WgIface) | |
} | |
log.Infof("prepending Wireguard Interface Name to interface blacklist %#v, updated to %v (old value %v)", config.WgIface, newBlacklist, config.IFaceBlackList) | |
config.IFaceBlackList = newBlacklist | |
refresh = true | |
} | |
if oldIface != config.WgIface { | |
for i, ifc := range config.IFaceBlackList { | |
if ifc == oldIface { | |
ifc = config.WgIface | |
config.IFaceBlackList[i] = config.WgIface | |
log.Infof("replaced Wireguard Interface Name in the interface blacklist. old name %s, new name", oldIface, config.WgIface) | |
refresh = true | |
break | |
} | |
} | |
} |
if input.WgPort != 0 && input.WgPort != config.WgPort { | ||
log.Infof("new Wireguard Port provided, updated to %#v (old value %#v)", input.WgPort, config.WgPort) | ||
config.WgPort = input.WgPort | ||
refresh = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if input.WgPort != 0 && input.WgPort != config.WgPort { | |
log.Infof("new Wireguard Port provided, updated to %#v (old value %#v)", input.WgPort, config.WgPort) | |
config.WgPort = input.WgPort | |
refresh = true | |
} |
if config.WgPort == 0 && input.WgPort == 0 { | ||
log.Infof("using default Wireguard Port: %#v ", iface.DefaultWgPort) | ||
config.WgPort = iface.DefaultWgPort | ||
refresh = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if config.WgPort == 0 && input.WgPort == 0 { | |
log.Infof("using default Wireguard Port: %#v ", iface.DefaultWgPort) | |
config.WgPort = iface.DefaultWgPort | |
refresh = true | |
} | |
if input.WgPort != 0 && input.WgPort != config.WgPort { | |
log.Infof("new Wireguard Port provided, updated to %d (old value %d)", input.WgPort, config.WgPort) | |
config.WgPort = input.WgPort | |
refresh = true | |
} | |
// previous version config upgrade check because WgPort didn't exist | |
if config.WgPort == 0 { | |
log.Infof("using default Wireguard Port: %d", iface.DefaultWgPort) | |
config.WgPort = iface.DefaultWgPort | |
refresh = true | |
} |
@nazarewk, my apologies, I forgot about the protocol update required to pass the new flags from the client to the daemon. You need to update the protocol file here /client/proto/daemon.proto#L31 and then you can run the generate.sh Once that is done, you need to retrieve them in the https://github.com/netbirdio/netbird/blob/main/client/server/server.go#L158 and pass to the configuration calls With that updating the port will look like this:
|
@nazarewk let us know if the requests were too much. I would be happy to join the effort and help you in your branch |
@mlsmaycon I can't continue this right now (maybe next week) and I'm not planning to become Netbird architecture expert so feel free to help and fix the things you mentioned :) |
ad6fc03
to
65d74d3
Compare
65d74d3
to
0439530
Compare
0439530
to
54ccf5f
Compare
Describe your changes
I am working on setting up multiple instances of Netbird on same machine, I need a way to tell the deamon to input different interfaces/ports to those without modifying files by hand.
I got it to work at nazarewk-iac/nix-configs@aeefbf5c
Issue ticket number and link
Checklist