Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2001 20:26:35 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        Ian Chilton <ian@ichilton.co.uk>
Cc:        <freebsd-stable@FreeBSD.ORG>
Subject:   Re: OT: Adding a user to freebsd from cgi?
Message-ID:  <20011218201909.G32770-100000@catalyst.sasknow.net>
In-Reply-To: <000301c1882c$a2d2ff40$0a01a8c0@dipsy>

next in thread | previous in thread | raw e-mail | index | archive | help
Ian Chilton wrote to freebsd-stable@FreeBSD.ORG:

> Hello,
>
> Does anyone have any cgi scripts to add a user to a freebsd
> system?

Sure, but they're rather specific to our particular purpose... Read up
on pw(8) and suexec(8) (part of Apache). That's one way to do it.

A more secure and scalable way to do it would be to have your CGI
script just queue the new users in a file (flat "transaction" file is
fine). This is easy to code... You just have to parse the input and
write it out in a format your other script can understand. With perl,
you can check for things like duplicate users with getpwent(), as a
normal user.

Then, have a root CRON job process the output file every 5-15 minutes.
The cron job can be a simple script that runs pw(8) based on the saved
settings in the CGI file. If your system is very busy, you can
increase the delay, or just run it nightly, etc.

Code the scripts VERY carefully, as they will be indirectly processing
user input from the WWW, and will be mucking with the password
database. (for example you DON'T want to give someone the ability to
create a user with uid 0 (or any existing uid for that matter)).


> Thanks!
>
> Ian

Hope this helps.
- Ryan

-- 
  Ryan Thompson <ryan@sasknow.com>
  Network Administrator, Accounts

  SaskNow Technologies - http://www.sasknow.com
  #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2

        Tel: 306-664-3600   Fax: 306-664-1161   Saskatoon
  Toll-Free: 877-727-5669     (877-SASKNOW)     North America


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011218201909.G32770-100000>