1

Currently I am working on an open source server control panel similar to cPanel, Plesk but I am not sure what would be the best approach to make system changes which require root permissions.

I was thinking to create scripts (with root permissions) which validate and execute commands sent by the app modules (which don't have root permissions). The problem with this is how to validate the call properly.

Maybe someone has a better solution. Please let me know your opinion on this.

2

You should separate the responsibilities of authentication/authorization and action. One possible approach would be to have a front end which receives requests from (authenticated) users, checks whether the requestors are authorized to perform the requests, and puts the requests into some kind of request queue. If this queue is implemented as a database table it can additionally serve as an audit trail. The back end would read requests from the queue, execute them with root permissions, and update the requests in the database with completion status information. If you want to manage multiple servers from one panel (for example database, web server, mail server etc.) requests can include fields designating appropriate servers. ISPconfig is a system that works with a somewhat similar approach.

| improve this answer | |
  • Thank you for your opinion. Indeed, user authorization will be done by a separate component or module (users module). However my question was more related to the communication between the app and the scripts making system wide changes. What I don't like about the request queues is that the changes aren't made instantly and if something fails it is a bit cumbersome to notify the user in a timely manner. – TheFuriousSnail Apr 29 '18 at 21:46
  • I guess I will have to also check the implementation in a couple of open source projects. The nice thing is we have plenty of them. :-) I just wanted to do some brainstorming here. – TheFuriousSnail Apr 29 '18 at 21:48
  • Depending on the database you're using, there might be event notification mechanisms available. If those are not sufficient (for example, get_lock in MySQL seems to be only suitable for single producers) you could use external mechanisms. I am currently using REDIS for producer/consumer situations, it is very easy to use and has the right level of abstractions to build even complex multi-process designs. – Hans-Martin Mosner May 2 '18 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.