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

doesnt work without root or sudo #2

Closed ausfestivus closed 5 years ago

ausfestivus commented 6 years ago

Morning,

Attempted to use this new script on an Ubuntu 16.04.5 LTS VM and it was producing zero output for smokeping. Debugged it down to the use of the -T switch with traceroute and the fact that the user smokeping runs as is just a normal user. User smokeping cant sudo and traceroute isnt setuid root by default.

Some more detailed notes:

ubuntu@jump00:~$ /usr/local/bin/tcpping.new -z -C -x 5 220.233.82.46 5060
traceroute -T -f 255 -m 255 -q 1 -w 3  -p 5060 220.233.82.46
traceroute -T -f 255 -m 255 -q 1 -w 3  -p 5060 220.233.82.46
ubuntu@jump00:~$ traceroute -T -f 255 -m 255 -q 1 -w 3  -p 5060 220.233.82.46
You do not have enough privileges to use this traceroute method.
socket: Operation not permitted
deajan commented 6 years ago

Indeed. I could add a -s option which launched traceroute with sudo. You can then add bob ALL=(ALL) NOPASSWD: /usr/bin/traceroute to your sudoers file in order to allow the command to be used without needing a password when sudoing.

Good for you ?

notjames commented 5 years ago

At the very least, perform a check that will show an error message if permissions disallow the runtime to work. For instance, I just had this happen to me and I had to run some debugging to see why iwas getting blank, but obvious output:

~/projects/src/tcpping$ tcpping 8.8.8.8 53

^C
~/projects/src/tcpping$ 

Just submitted a PR to error if sudo us required.

deajan commented 5 years ago

Issue resolved by @notjames