using perl with PNGs, Net::Ping, and CGI
I have a web page that pulls a list of computers from a DHCP database and I would like to add a column to see if the computers were online. My idea was simple enough, a perl script that pings the host and returns either a red PNG or a green PNG...as you can see...
Code:
#!/usr/local/bin/perl -w However, the script does not run in a apache, as apache's user is not root and root access is required for ICMP stuff, apparently. I saw something about setuid, but I was too scared to look into it, as I am taking direct input from a user (potentially, I guess I could lock it down by IP) and don't want someone breaking out and gaining root access. But other than locking it down by IP, does anyone have a hint for me how to do this effectively? I've been using perl for about a month now, so i'm probably not familiar with a lot of the basics. thanks |
why not use a less restrictive ping like tcp or udp?
|
or...
write a separate ping server, run as root which you query from your CGI script. so, you have a separate ping-ing server, you send it a hostname, it does the ping for you and replies yes or no. |
thanks for the replies.
I thought about writing it in 2 parts, but I couldnt figure out if that would actually be more secure. I suppose I could always just valid my input with a regular expression right? I've heard that's one of the main reasons to using perl. I had some problems with the upd thing, probably my own fault. (It always fails) Does there need to be a port listening to reply to a UDP packet? I don't know much about networking yet... |
All times are GMT -5. The time now is 07:23 AM. |