korpenkraxar has asked for the wisdom of the Perl Monks concerning the following question:
Having lurked around here for a while and learned a lot from various topics and questions, I've just stumbled across a programming problem having to do with security that is new to me and I would be very happy to get some general design input before I actually start messing around too much with the code.
My goal is to write a daemon that collects information (or "clues") about where a laptop may be located and (automatically or semi-automatically) tries to connect to the LAN and/or WLAN at that location according to predefined rules and priorities. This is meant to run on my Linux system and I expect to use standard tools like udev, ifplugd, wpa_supplicant, ifconfig, iwconfig, ethtool, iwlist, /proc and /sys to get information about surrounding networks. Perl is the glue that surrounds and binds everything.
However, to be able to actually swap network interfaces and set different configurations the daemon needs to have super-user access at some point. This is where big red warning lights started blinking. So, at last, here are my questions:
* At what point should the daemon be granted authority to change network settings? Run it as root all the time? Run it as special user with restriced password-less sudo access? What is the general recommendation for a daemon like this to keep security at a "reasonable" level? Are there any perl gotchas I should be aware of in this case?
* The daemon can in principle monitor and use any clues, not only network information, but perhaps some aspects of user behavior or even GPS data, to conclude where the computer is and what to do. While the rules are set when the daemon starts, clues are updated continuously. But it would be nice as a user to be able to force the daemon to activate some specific network configuration or just to "inject" location clues ("roaming", "home", "work"). The simplest way to inform a running perl program about this is perhaps having a small temporary text file in /tmp, but this way of interacting with a daemon that have super-user privileges feels neither very secure or elegant. How can I make a perl program to listen to/detect this kind of input?
I am mainly developing this program out of curiosity and I realize that the concept may have flaws, but instead of telling me to forget it, please give me some suggestions on how to deal with these security issues in a good (or better) way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl as a daemon... as root?
by shmem (Chancellor) on Jul 30, 2007 at 05:30 UTC | |
by Anno (Deacon) on Jul 30, 2007 at 10:16 UTC | |
|
Re: Perl as a daemon... as root?
by tirwhan (Abbot) on Jul 30, 2007 at 11:17 UTC | |
|
Re: Perl as a daemon... as root?
by korpenkraxar (Sexton) on Dec 31, 2007 at 02:58 UTC |