Hi folks!

I installed SpamAssassin on my own account here at work a couple weeks
ago, and saw how cool it was, and then I showed it to my boss. Then she
wanted it and mentioned it to the CEO. He wanted it, too. Then I brought
it up in a programmers meeting and lots of people wanted it. Still, we
don't want to install it on everyone's account. Why, you ask? Well, some
of our clients like to send (*coughannoyingcough*) flamboyantly flashy
HTML mail. Further, missing even 1 mail from a client would be
unacceptable. So, the secretaries who get the email from our clients don't
get spam protection, nor do our tech support people. Some sales people,
all managers, and all programmers do.

Anyhoo, I wrote a little perl script that takes the name of a user and
automagically installs SpamAssassin for them. It's not quite ready for
primetime, but I thought I'd send in what I had and maybe get some
comments on it. Take a look, lemme know what you think.

Thanks!

--
Johnny Wales
Book Systems, Inc.
#!/usr/bin/perl

print "Enter username: ";
$usr = <>;
chomp($usr);

print "Is $usr correct? ";
$yn = <>;
if($yn=~/n/gi) {
        print "Fine. Aborting now, then.";
        exit;
}

print "Proceeding to install for them....\n";
print "\tCopying files\n";
`cp /home/johnny/Mail-SpamAssassin-2.41.tar /home/$usr/`;
print "\tChanging directories\n";
chdir "/home/$usr/";
print "\tUntarring\n";
`tar -xvf Mail-SpamAssassin-2.41.tar`;
print "\tEntering directory\n";
chdir "Mail-SpamAssassin-2.41";
print "\tWriting makefile\n";
`perl Makefile.PL PREFIX=/home/$usr/sausr SYSCONFDIR=/home/$usr/saetc`;
print "\tBuilding...\n";
`make`;
print "\tInstalling...\n";
`make install`;
print "\tCreating files...\n";
open (FORWARD, ">>/home/$usr/.forward");
print FORWARD "\"|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #$usr\"";
close(FORWARD);
open (PROCRC, ">>/home/$usr/.procmailrc");
print PROCRC ":0fw\n";
print PROCRC "| /home/$usr/sausr/bin/spamassassin\n";
close(PROCRC);

print "SpamAssassin install complete for user $usr!\n";
print "Send a test email that should be tagged as spam to that user\n";
print "to make sure everything is working properly.\n";
print "\n\n";

Reply via email to