On 07/10/2007, Finlay Dobbie <email@hidden> wrote:
> On 06/10/2007, Steve Savery <email@hidden> wrote:
> > I have a web site and a mailing list running both running on the same
> > Mac OS X Server 10.4 Mac. I would like to enable those who register to
> > the web site to simply tick a box on a form to have themselves
> > automatically added to the mailing list.
> >
> > I've done the code, but while I am getting a TRUE response from the
> > command sent via PHP, the email address does not get added to the
> > mailing list.
> >
> > Is this a permissions issue? If so, what do I need to change and what,
> > if any, security implications are there?
>
> Yes, this is a permissions issue. On Mac OS X, Apache runs as "www"
> and Mailman runs as "mailman". Only the mailman user and root can
> access/modify the Mailman data store.
>
> sudo is designed for things like that. On the host I was recently
> doing this for, where httpd runs as nobody, I added the following rule
> to /etc/sudoers:
>
> nobody ALL = (mailman) NOPASSWD: /home/sptowers/mailman_trampoline.sh
>
> Where the shell script does some verification of a shared secret and
> is rw-r-x--- sptowers:mailman.
>
> Then from PHP you can "sudo -u mailman
> /home/sptowers/mailman_trampoline.sh <args>"
>
> That's about the most secure way I could think of doing it.
>
>
> -- Finlay
>
As I have been unable to locate the CGI documentation (am I missing
something glaringly obvious?) I have tried amending the sudoers file,
which appears to have gone OK.
However, I am still not seeing the new email address added to Mailman.
The PHP code:
<?php
//snippet
$file = '/Library/WebServer/Documents/smug_members/mailinglist.txt';
$fp = fopen($file, 'w');
fwrite($fp, 'email@hidden'); //normally this would be
$_POST['email'] from the form
fclose($fp);
system('sudo -u mailman /usr/share/mailman/bin/add_members -e
-r='.$file.' s-mug', $retval);
print $retval; // returns 1
?>
I am aware that the resulting value of 1 is actually not a response
from mailman, but from the PHP command itself - which is frustrating.
Anyway, if anyone can shed some light on this I'd be eternally
grateful. It's only a small Mac Users Group site that I'm doing this
for - and I just wanted to make it as easy as possible for registering
users to add themselves to the mailing list.
TIA, Steve.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macos-x-server/email@hidden
This email sent to email@hidden