How do web control panels work
I'm interested in building a software to manage some aspects (settings, services, firewall, ...) of my Linux computers as well as supporting FreeBSD later on.
I'd like to program it in PHP since I'm familiar with it (though I'll need to update my knowledge as well, since it's already been 4 years since then). Not sure if Python may be a better alternative (never used it, neither did I use Perl).

Basically what I'm trying to achieve is some kind of "clone" of Webmin (though not oriented towards the same user type, nor the same web interface). There are tons of other panels examples (openfiler, FreeNAS, napp-it, ...). Sorry if I got the title wrong.

What troubles me is how to pass commands from the web panel to the system. To read services status it may be as simple as doing a system("sh scripts.sh") call, though I see a major drawback in not getting the data into a buffer (thought probably there are other functions, like popen for instance).
When writing to files the SERIOUS problem concerns security: even if the panel's security has been compromized, it shouldn't have 100% control of the system (only access the components of the system it has been allowed to).

Furthermore I'd like to manage multiple computers from one single panel. I think for this to work there should be a client & server dedicated program / protocol, since I don't think tunnelling via ssh2 to remote host and parsing / setting data may be a good idea (security issues?).

**EDIT**: the PHP function was shell_exec()
How do web control panels work
===

I'm interested in building a software to manage some aspects (settings, services, firewall, ...) of my Linux computers as well as supporting FreeBSD later on.
I'd like to program it in PHP since I'm familiar with it (though I'll need to update my knowledge as well, since it's already been 4 years since then). Not sure if Python may be a better alternative (never used it, neither did I use Perl).

Basically what I'm trying to achieve is some kind of "clone" of Webmin (though not oriented towards the same user type, nor the same web interface). There are tons of other panels examples (openfiler, FreeNAS, napp-it, ...). Sorry if I got the title wrong.

What troubles me is how to pass commands from the web panel to the system. To read services status it may be as simple as doing a system("sh scripts.sh") call, though I see a major drawback in not getting the data into a buffer (thought probably there are other functions, like popen for instance).
When writing to files the SERIOUS problem concerns security: even if the panel's security has been compromized, it shouldn't have 100% control of the system (only access the components of the system it has been allowed to).

Furthermore I'd like to manage multiple computers from one single panel. I think for this to work there should be a client & server dedicated program / protocol, since I don't think tunnelling via ssh2 to remote host and parsing / setting data may be a good idea (security issues?).

**EDIT**: the PHP function was shell_exec()