NRDP change source port

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
mstrasser
Posts: 3
Joined: Tue Mar 13, 2018 9:12 am

NRDP change source port

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: NRDP change source port

Post 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.
Former Nagios employee
mstrasser
Posts: 3
Joined: Tue Mar 13, 2018 9:12 am

Re: NRDP change source port

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: NRDP change source port

Post 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).
Former Nagios employee
mstrasser
Posts: 3
Joined: Tue Mar 13, 2018 9:12 am

Re: NRDP change source port

Post by mstrasser »

Thank you!
I will try your solution and look if it runs stable.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRDP change source port

Post by scottwilkerson »

Let us know if you have further issues
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked