Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Greetings, ye monks!

I'm going to write a web front-end to some sysadmin things that I do. This is to allow users to do things themselves that I'm sicking of doing by hand. I'm on linux. I want to separate the must-run-as-root code from the web code.

I'm thinking I'll have a CGI script and a seperate runs-as-root-script. The runs-as-root-script will do the actual privileged actions and the CGI will gather input from users and and pass the particulars onto the runs-as-root bit. I'm thinking the runs-as-root bit will be a constantly running service, so as to avoid suid. The cgi could talk to the run-as-root bit with unix sockets or something of that nature.

As I see it, I'll need to authenticate the users twice: first in the CGI and second in the runs-as-root bit. I want to authenticate in the CGI so I can give users feedback, avoid bothering the runs-as-root bit unnecessarily and so on. I need to authenticate in the runs-as-root bit because even if I authenticate in the CGI, I don't think there's a way the runs-as-root bit can entirely trust the cgi or that a request is coming from the cgi. The cgi handles user interface and makes it possible for the runs-as-root bit to have a very limited, strictly-defined interface.

In case I'm being unclear (my usual state) here's kindof how I envision a request going:

User -> web browser -> cgi -> runs-as-root -> system

So only the runs as root bit needs to run as root.

My first and most important question is: does this make sense? Is it a dumb idea? Am I making this too complex?.

My second question is: What's the best way to communicate between the cgi and the runs-as-root stuff? Is there any interprocess communication that guarantees input comes from a particular script? Security is my #1 priority.

I hope this question is comprehensible, and thanks for any thoughts.

--Pileofrogs


In reply to Security, root and CGI? by pileofrogs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-19 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found