[Centos] *very* raw script for a new email server

Wed Dec 8 15:34:49 UTC 2004
Ryan Sweet <rsweet at aoes.com>

On Wed, 8 Dec 2004, Benjamin J. Weiss wrote:

> All,
> I'm putting up a new email server, but I can't afford downtime when I
> switch servers.  So, I've been writing a script that will take a CentOS
> install and turn it into a secure email server with Spam Assassin,
> Amavis-new, ClamAV and external relay using SASL authentication.
> The script is still *very* raw, and I'm relatively new to bash script
> writing.  I still have some areas of work to do:

If you are new to bash, or programming in general, I think you might find 
learning python is more specifically suited to the task, and more powerful.

However bash can work quite nicely for a lot of things ;-)

> - I need to figure out how to automate the certificate generation.  Right
> now I still have to type in a password at the prompt, as well as hit
> <enter> to accept the defaults

have you looked at "expect"?  It is designed for this sort of operation. 
There are modules for python or perl both, and I imagine you could also get it 
to work from the shell.  We have scripts for apache ssl cert generation that 
use pyexpect.

> - Some of my sed commands are kludgy.  I'm still learning the ins and outs
> of sed

If you are doing search/replace filters, many sed commands can be replaced 
from the shell with perl's re interpreter by doing:
 	perl -pi.orig -e 's/search-this/replace-with-this/' filename
which is more overhead, buts lets you make a backup file (named 
filename.orig), and gives you the power of perl's re engine, which is arguably 
more forgiving in syntax than sed.

> - I have *no* idea whether or not Vipul's Razor is working or not.
> - I need to fix the yum "extras" section.
> - I need to improve the iptables handling.
> Anyway, if you guys'd like to take a look and make comments, I'm open to
> suggestions and whatnot.
> It's at:
> http://www.benjamin.weiss.name/mail-server.sh
> Thanks!
> Ben
> _______________________________________________
> CentOS mailing list
> CentOS at caosity.org
> http://lists.caosity.org/mailman/listinfo/centos

Ryan Sweet             <ryan.sweet at aoes.com> 
Advanced Operations and Engineering Services
AOES Group BV            http://www.aoes.com
Phone +31(0)71 5795521  Fax +31(0)71572 1277