wsanders has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to run a program that calls Net::Ping -

$p = Net::Ping->new('icmp', 5, $lping);

Works fine with permission 4755 and chowned to root on Solaris and Linux:

-rwsr-xr-x  1 root staff  3065 Apr  9 12:57 check-ping

but on MacOSX it dies at the above line with:
icmp ping requires root privilege at ./exp-check-ping line 54

I've even tried setting Ping.pm to root and 4755 (it doesn't have to be setuid in Solaris and Linux):
-rwsr--r--  1 root  wheel  59082 Dec 14 12:18 /opt/local/lib/perl5/5.12.3/Net/Ping.pm

Has anyone gotten Net::Ping to work with ICMP, running suid? I suspect a ACL or flag will get this working...

Thanks in advance,
-w

  • Comment on Net::Ping on Snow Leopard, setuid broken

Replies are listed 'Best First'.
Re: Net::Ping on Snow Leopard, setuid broken
by wsanders (Novice) on Apr 10, 2012 at 00:02 UTC
    
    I built an suid C wrapper for this, and:
    
    YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!
    
    Geez perl, no need to yell at me! So neither the perl that comes with MacOSX nor the "ports" perl has suidperl, so this version of perl cannot run suid perl programs.
    
    Off to fiddle with sudo.
    

      suidperl is unsupported and has been removed from the Perl distribution since 5.12. The recommendation is to write a small C wrapper, I think.