[Mailman-Users] no require password for unsubscribe?
Jon Carnes
jonc at nc.rr.com
Wed Jan 16 09:27:30 CET 2002
On Tuesday 15 January 2002 16:29, tdavis at birddog.com wrote:
> I was pondering this idea. Great idea it is too.
> But is there a way to get the email address from the FROM headers rather
> than have them explicity put it in the subject line ?
>
> I see a problem in the FROM headers where they can have a bunch of stuff
> in there like name and whatever else like "Foo Bar <jo at hotmail.com>"
>
> Any thoughts here?
>
Easy, use:
UNSUB=`grep -i "From: " - |head -1 |tr "<>" " " `
The command tr is translate, and we're using it here to convert any < or >
into a blank. The rest of the script then handles it from there, looking
for an isolated string that has a @ inside it.
BTW: A friend of mine came up with a more elegant solution for doing the
unsubscribes...
- In the aliases file, add an entry for the unsubscribe email:
volleyball-unsub: "|/home/mailman/ext/v-unsub"
- Create the directory /home/mailman/ext
mkdir /home/mailman/ext
chown mail /home/mailman/ext
chmod 0700 /home/mailman/ext
- In /home/mailman/ext create the script "v-unsub":
#!/home/mailman/ext/bash_mailman
# This script runs as user mailman, but is only executable by user mail
# script to unsubscribe user from volleyball list
# Mail to volleyball-unsub at haht.com
# Subject: unsubscribe username at domain.com
UNSUB=`grep -i "Subject: " - |head -1`
for i in $UNSUB
do
/home/mailman/bin/remove_members volleyball $i
done
# End of script
- Make the script executable:
chmod a+x /home/mailman/ext/v-unsub
- In the /etc/smrsh directory:
ln -s /home/mailman/ext/v-unsub v-unsub
- Copy and modify bash so that it runs as user mailman:
cp /bin/bash /home/mailman/ext/bash_mailman
chown mailman.mailman /home/mailman/ext/bash_mailman
chmod 0555 /home/mailman/ext/bash_mailman
chmod u+s,g+s /home/mailman/ext/bash_mailman
===
The directory /home/mailman/ext has rights such that only the mail user can
access the files within. The copied version of "bash" now called
"bash_mailman" has it's ownership changed to mailman and then has it's UID
and GID bits set. Any script that runs using it as a shell will now run as
the user mailman with group mailman.
Wahoo!
Jon Carnes
More information about the Mailman-Users
mailing list