Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I am doing this so they can package the server as a product which allows the not so savvy users to change network configurations.

Um... is allowing users to screw up the method in which they update the server a good idea? Just a thought ;)

I would recommend something like Jasonk is talking about. But to give a few more ideas in the pool.

make a script that will do the actual editing and restart netstart. Using taint mode is an absolute must! Because you're on FreeBSD modifying the config is actually pretty easy. All you need to do is append the delta's to the end of rc.conf, so the relevent information like ip address, mask and such should be pretty easy to check. Make this script SUID root, and make sure that the only thing it will execute is /etc/netstat. Then put this script somewhere safe, that is; somewhere where apache will certainly not be able to see it.

Then make a second script to be the "web interface". Again taint checking is a must. Then use the first script to pass parameters to the second script. Just make sure that you are extremely strict on what input is allowed, and careful in what you write to rc.conf, make sanity checks at both ends and you should be fine.

You can also include files in rc.conf. Which might be a little safer than risking wacking the entire file. Just use the shell include syntax:

. /path/to/file


In reply to Re: running root command from cgi by archen
in thread running root command from cgi by XYZ

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 having a coffee break in the Monastery: (5)
As of 2024-03-29 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found