deajan / tcpping

tcpping script for smokeping that runs with newer linux traceroute binaries
GNU General Public License v3.0
127 stars 39 forks source link

Fix for not running with proper run permissions. #3

Closed notjames closed 5 years ago

notjames commented 5 years ago

Fix for issue #2 by erroring if not running as root and it's required. This wouldn't negate the idea of adding a -s argument to run sudo from within the script. Apologies for the whitespace changes as that is something I have my editor do automatically since tabs are much ugly. If necessary and this change is OK to be merged but the tabs put back in, I will redo the change and submit keeping the tabs in if so desired.

deajan commented 5 years ago

Thanks for your contrib. Indeed, please have the whitespace / tabs fixed as this PR simply changes like EVERY line of the script for nothing.

deajan commented 5 years ago

I'll have some further modifications to make sure tracerouteCommand isn't executed twice as in your PR. Thanks for the PR :)

deajan commented 5 years ago

Care to test the latest version ?

notjames commented 5 years ago

Sure, I'll test it. This script can use a lot of optimization, but I opted to go the quick route. If you're interested in my doing some optimization, I'll work on that when I get some time.

deajan commented 5 years ago

Indeed, but as often, it's a quick and dirty "just make it run" work, and of course it could need some love :)

notjames commented 5 years ago

So the only problem I'm seeing is the error: Unable to run '$traceRouteCommand' command. Please try run $0 with-sparameter or 'sudo $0' because there is no valid -s command that currently runs sudo. Currently, -s sets a traceroute argument. Also, I just noticed that the usage is really outdated and there may be some traceroute arguments that are obsolete or which may differ between traceroutes provided between Windows/Linux/BSD.

I don't have Windows or BSD to test on, so I can't do much with the traceroute args. I think it's best not to offer an argument of -s for sudo at this point. The original error message stating that one should run sudo $0 is probably best for now. Thoughts?

Hmm, I'm also having a problem running even with sudo -- I'll check into this later today.

--UPDATE-- I just noticed the argument for sudo is -Z -- not very intuitive, but understandable. Let me test that out really fast.

--UPDATE^2-- OK. Not sure what I was doing before, but -Z works and sudo is working as expected. So all is well with the current master.

deajan commented 5 years ago

Thanks, Could not use '-s' since traceroute itself can use it. I have changed '-s' to '-Z' to fix the output message. Also, I did test the script under FreeBSD 11.

netstx commented 3 years ago

Do you guys know how to configure the smokeping probe to run tcpping with sudo? I enabled the use of no password on sudoers file.

EDIT: this is more of a question about smokeping, I am currently looking how I can pass the -Z flag to the binary via smokeping configuration.

EDIT2: I guess changing the script to enable the sudo command works, i.e. SUDO_COMMAND="/usr/bin/sudo"