Page 1 of 1

NRDP change source port

Posted: Tue Mar 13, 2018 10:12 am
by mstrasser
Hello,

i want to change the source port of nrdp to a static value.
Is it possible to do so ?

For now it looks like, it uses some random highports !
I use Linux/Debian.

br,
Marcus

Re: NRDP change source port

Posted: Tue Mar 13, 2018 10:27 am
by tmcdonald
The term for what you are looking for is "bind() before connect()": https://idea.popcount.org/2014-04-03-bi ... e-connect/

Unfortunately this would require modification of the send_nrdp scripts. If you can come up with a good use case our developers might consider adding in a flag to set this, but I can't think of anything short of getting around restrictive firewall rules, and the solution to that is generally to speak with your network admin.

Re: NRDP change source port

Posted: Tue Mar 13, 2018 11:04 am
by mstrasser
In our new system we need to specify the exact ports, or a small port-range, a programm is using.
Goes for sourceports and destinationports.

As example with nrpe only 1 specific port is required.

Re: NRDP change source port

Posted: Tue Mar 13, 2018 12:50 pm
by tmcdonald
So aside from editing the source code of the send_nrdp script (which you are of course welcome to do if you are comfortable with it) there was a quick little hack I found to temporarily restrict the outgoing ports, send the data, then open them up again:

https://superuser.com/questions/1118735 ... 52#1118752

This is probably not ideal, as restricting the number of outgoing (ephemeral) ports too much can cause instability.

I can ask our developers if this is a flag they would be willing to consider adding, but this is a pretty niche request and not one we have had before (to my knowledge).

Re: NRDP change source port

Posted: Wed Mar 14, 2018 1:53 am
by mstrasser
Thank you!
I will try your solution and look if it runs stable.

Re: NRDP change source port

Posted: Wed Mar 14, 2018 11:53 am
by scottwilkerson
Let us know if you have further issues