“Automatic Login Links”, with …

“Automatic Login Links”, with Rails code segments from @danielmorrison http://t.co/opZ2j8D Useful followup comments too..

Posted in Tweets | Comments Off on “Automatic Login Links”, with …

“base your business around an …

“base your business around an idea. Products are just the manifestation of the idea.” http://t.co/WYlZNcs Good thoughts on the SF Bubble too

Posted in Tweets | Comments Off on “base your business around an …

Tweets for 2011-06-14

  • Listening to This Week in Cloud Computing podcast on my iPhone with @shiftyjelly's Pocketcasts app.. #twicc #

Powered by Twitter Tools

Posted in Tweets | Comments Off on Tweets for 2011-06-14

Listening to This Week in Clou…

Listening to This Week in Cloud Computing podcast on my iPhone with @shiftyjelly‘s Pocketcasts app.. #twicc

Posted in Tweets | Comments Off on Listening to This Week in Clou…

Tweets for 2011-06-13

  • Anti Spam test: send an email with the following string of characters:
    XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X #

Powered by Twitter Tools

Posted in Tweets | Comments Off on Tweets for 2011-06-13

Installing SpamAssassin & ClamAV with Amavisd-milter on Sendmail on CentOS 5

I’ve previously described the install & setup process for spamass-milter on Sendmail for Anti-Spam processing.

This blog post describes a different interface to Sendmail for Anti-Spam & Anti-Virus (AS/AV), using the Amavis daemon (amavisd-new) along with the Milter interface for Amavis to Sendmail.

1. Software Installs

1.0 Pre-Requisites

This requires (at least during this install process) the C compiler, so to install all the pre-req’s run:

yum -y install gcc make sendmail-devel

1a. Amavisd-Milter

Please DO NOT install the ‘amavisd-new-milter’ package in RPMForge, it’s old & lacks functionality. Please download the source distribution for amavisd-milter from http://sourceforge.net/projects/amavisd-milter/
The latest amavisd-milter in early 2011 delivers the file ‘amavisd-milter-1.5.0.tar.gz’, so extract that file & install that software to its default install locations.

Then do the following in the extract amavisd-milter directory:

./configure
make install

Which yields the /usr/local/sbin/amavisd-milter exacutable & the ‘man amavisd-milter’ manual page.

1b. Amavisd itself and its pre-requisites

Run:
yum -y install amavisd-new

1c. Check that the SpamAssassin & ClamAV packages are installed with:

yum -y install clamav clamav-db clamav-milter clamd spamass-milter perl-Mail-SPF sendmail-cf perl-Mail-DKIM

1d. There are some scanners that aren’t installed with amavisd-new’s Yum install, so bring in these decoders:

yum -y install tnef unzip lrzip p7zip-plugins
(updated for CentOS 5.9)

2 Configuring components & Amavisd

2a. See our previously posted SpamAssassin/ClamAV & Sendmail page for the SpamAssassin & ClamAV setup, but the important difference here is that ClamAV (clamd) must be reconfigured to run as the same pid/user that runs the Amavisd software (amavis username & group).
We set the pid & gid of the clamav user in /etc/passwd to be the same pid/gid as the amavis user that’s installed when using Yum to install the amavisd-new package.
Then you need to chown the ClamAV run & log directories to the new pid/gid of the clamav user with:
chown -R clamav.amavis /var/run/clamav /var/log/clamav/ /var/clamav/
Then restart clamd with:
service clamd restart
And check that it comes up ok with no errors in /var/log/maillog and /var/log/messages

2b. Amavisd-Milter Sysconfig file isn’t provided, as we’ve installed it from source, not a pre-build Package, so we need to create the file & I’ve used the following, from the site http://users.on.net/~hilton/amavisd-milter-sysconfig.txt

### /etc/sysconfig/amavisd-milter
### Configuration options for amavisd-milter
### Suitable for Redhat & SuSE systems.
#
#
### Amavisd's homedir.
### This should match the '$MYHOME' directive in amavisd.conf
AMAVISD_HOME="/var/amavis"

### Location of milter binary.
MILTER="/usr/local/sbin/amavisd-milter"

### User that amavisd-milter will run as.
### For RH/CentOS/Fedora set to "amavis"
### For SuSE set to "vscan"
AMAVISD_MILTER_USER="amavis"

### This is the socket used for communication between sendmail <--> milter
### It must correspond to the "S=" variable of the milter definition in sendmail.cf
### Note the variable substitution!
MILTER_SOCKET="local:$AMAVISD_HOME/amavisd-milter.sock"

### This is the socket used for communication between amavisd <--> milter
### It must correspond to the value of "$unix_socketname" in amavisd.conf
### Note the variable substitution!
AMAVISD_SOCKET="$AMAVISD_HOME/amavisd.sock"

### Pid file
### Note the variable substitution!
MILTER_PID="$AMAVISD_HOME/amavisd-milter.pid"

### All the args to milter
MILTER_FLAGS="-s $MILTER_SOCKET -p $MILTER_PID -w $AMAVISD_HOME -S $AMAVISD_SOCKET"

2c. Amavisd-Milter init.d file isn’t provided, as we’ve installed it from source, not a pre-build Package, so we need to create the file & I’ve used the following, from the site http://users.on.net/~hilton/amavisd-milter-init.d.txt

#!/bin/bash
# Init script for Amavisd-Milter.
# Written by Ben Tisdall
# chkconfig: 2345 78 31
# description: Amavisd Milter Interface
# processname: amavisd-milter

### Read in the standard init functions
source /etc/rc.d/init.d/functions

### Default variables
AMAVIS_USER="amavis"
MILTER_SOCKET=""
MILTER_FLAGS=""
desc="Amavisd Milter Interface"
RETVAL=0
SYSCONFIG="/etc/sysconfig/amavisd-milter"

### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"

### MILTER set in /etc/sysconfig/amavisd
prog="${MILTER##*/}"
progdir="${MILTER%/*}"

### Check we have the milter
if ! [ -x $progdir/$prog ]; then
echo -e "\nFATAL ERROR: $progdir/$prog not found and/or not executable, please check your installation.\n"
exit 1
fi

### Functions
start() {
if [ "$MILTER_SOCKET" -a -x "$progdir/$prog" ]; then
echo -n $"Starting $desc ($prog): "
daemon --user "$AMAVIS_USER" $progdir/$prog "$MILTER_FLAGS"
RETVAL=$?
echo
if [ $RETVAL -eq 0 -a -n "$MILTER_PID" -a ! -L "/var/run/${MILTER_PID##*/}" ]; then
ln -s "$MILTER_PID" "/var/run/${MILTER_PID##*/}"
touch /var/lock/subsys/$prog
fi
fi
}

stop() {
if [ "$MILTER_SOCKET" -o -f /var/lock/subsys/$prog ]; then
echo -n $"Shutting down $desc ($prog): "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
fi
return $RETVAL
}

reload() {
echo -n $"Reloading $desc ($prog): "
killproc -HUP $prog
RETVAL=$?
echo
return $RETVAL
}

restart() {
stop
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
restart
;;
condrestart)
[ -e /var/lock/subsys/$prog ] && restart
RETVAL=$?
;;
status)
status $prog
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
RETVAL=1
esac

exit $RETVAL

Download those two text files & copy them to the relevant system files with the commands:

Install amavisd-milter sysconfig script:

wget http://users.on.net/~hilton/amavisd-milter-sysconfig.txt
mv amavisd-milter-sysconfig.txt /etc/sysconfig/amavisd-milter

Install amavisd-milter init.d script:

wget http://users.on.net/~hilton/amavisd-milter-init.d.txt
mv amavisd-milter-init.d.txt /etc/init.d/amavisd-milter
chmod u+x /etc/init.d/amavisd-milter
chkconfig --add amavisd-milter

2d. Configuring Amavis

Amavis config file is /etc/amavisd.conf and it’s a large text config file, but the relevant settings to check/set are:

$protocol = "AM.PDP"; # Use AM.PDP protocol.
$unix_socketname = "$MYHOME/amavisd.sock"; # uncomment when using milter.
#$inet_socket_port = 10024; #comment out with milter.
$notify_method = 'pipe:flags=q argv=/usr/sbin/sendmail -Ac -i -odd -f ${sender} -- ${recipient}';
$forward_method = undef; #must be set like this with sendmail milter.
$mydomain = "example.com" #Your domain
$myhostname = "mail.example.com"; #The FQDN of your Mail Server host
$virus_admin = "root\@$mydomain"; #NDR recipient if virus found
$mailfrom_notify_admin = "virusalert\@$mydomain"; #NDR --> admin sender

Then the following affect the inclusion of mail message headers about the Amavis activity:

$sa_tag_level_deflt = -9999; # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 3.4; # add 'spam detected' headers at that level
#sa_kill_level_deflt = 6.31; # triggers spam evasive actions
#sa_dsn_cutoff_level = 9; # spam level beyond which a DSN is not sent
#$sa_quarantine_cutoff_level = 20; # spam level beyond which quarantine is off
$sa_spam_subject_tag = '[SPAM] '; # Prepended to the subject line if defined.

2e. Create the ‘virusalert@yourdomain’ email address or alias, enter the following to /etc/aliases & run ‘newaliases’
virusalert: root
spam-police: root

2f. Setting domains which will be passed to Scanners
Amavis (Amavisd-New) only hands of messages which are deemed able to be ‘locally delivered’ by Sendmail, but you can include domains for SA (SpamAssassin) processing by loading them to the @local_domains_maps variable in /etc/amavisd.conf, which by default is set to the value of $mydomain & its subdomains:

@local_domains_maps = ( [".$mydomain", ".foo.com"] );

You may want to list in @local_domains_maps all hosts & domain names that you have in /etc/mail/local-host-names & /etc/mail/relay-domains

2g. Further down in the amavisd.conf file you need to enable the ClamAV sections and set the /var/run/clamav/clamd.sock file (matching the value in /etc/clamd.conf)

['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.sock"],
qr/\bOK$/m, qr/\bFOUND$/m,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],

Now save all these edits to /etc/amavisd.conf

2h. Set relevant entry in /etc/sysconfig/amavisd

AMAVIS_SENDMAIL_MILTER="no"

2i. Sendmail configs to enable use of Amavis-Milter

Add the following MILTER definition to /etc/mail/sendmail.mc & remove any/all other Milter definitions (eg: remove clamav & spamass milter entries in sendmail.mc

define(`MILTER', 1)dnl
INPUT_MAIL_FILTER(`milter-amavis', `S=local:/var/amavis/amavisd-milter.sock, F=T, T=S:10m;R:10m;E:10m')dnl

If you want your Sendmail server to be available on port 25 (SMTP), then also ensure:

DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl

Then save that update & recreate the sendmail.cf & submit.cf files by running

make

in /etc/mail, then restart sendmail (when ready) with

service sendmail restart

3. Start daemons up & monitor /var/log/maillog for their logging

service sendmail restart
service amavisd start
service amavisd-milter start
service clamd restart

4. Test / Check

4a. Send an email through the server, either with manual “telnet your-mail-server 25” or such.

4b. Monitor /var/log/maillog

Posted in Network Presence | Tagged , , , , , | 3 Comments

Anti Spam test: send an email …

Anti Spam test: send an email with the following string of characters:
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

Posted in Tweets | Comments Off on Anti Spam test: send an email …

Installing ClamAV & SpamAssassin to CentOS 5 with Sendmail

Installing these Mail Server open-source software sets to CentOS 5 with Sendmail on a 64-bit CentOS 5.4 (or higher) Linux host.

1. Install RPMForge Repo to get access to more Software Packages for CentOS5

Install (using rpm -Uvh) http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

2. Use yum to install from the previously installed RPMForge Repo the necessary software packages

yum -y install spamass-milter clamav-milter
yum -y install perl-Mail-SPF
yum -y install sendmail-cf

Restart spamd after installing the new SPF package with
/etc/init.d/spamassassin restart

Install DKIM for Message Signing with
yum -y install perl-Mail-DKIM

Check DKIM use by sending yourself an email from GMail and saving that message (headers and all) to a local text file, processing that file with
spamassassin -D < /tmp/gmail-msg.txt 2>&1 |grep -i dk

Install GeoIP for regional/geographic message filtering
yum -y install geoip

Check that all of ClamAV is installed with
yum -y install clamav clamav-db clamav-milter clamd

Check then on the settings in /etc/sysconfig/clamav-milter & then set/check on the following in /etc/clamav-milter.conf
MilterSocket unix:/var/clamav/clmilter.socket
User clamav
AllowSupplementaryGroups yes
ClamdSocket unix:/var/run/clamav/clamd.sock
LogFile /var/log/clamav/clamav-milter.log
LogFileMaxSize 0
LogTime yes
LogSyslog yes

Set/check the following in /etc/clamd.conf
LogFile /var/log/clamav/clamd.log
LogFileMaxSize 0
LogTime yes
LogSyslog yes
PidFile /var/run/clamav/clamd.pid
TemporaryDirectory /var/tmp
DatabaseDirectory /var/clamav
LocalSocket /var/run/clamav/clamd.sock
FixStaleSocket yes
TCPSocket 3310
TCPAddr 127.0.0.1
MaxConnectionQueueLength 30
MaxThreads 50
ReadTimeout 300
User clamav
AllowSupplementaryGroups yes
ScanPE yes
ScanELF yes
DetectBrokenExecutables yes
ScanOLE2 yes
ScanMail yes
ScanArchive yes
ArchiveBlockEncrypted no

Install SPF capabilities with
yum -y install smf-spf

3. Start Configuring main software servers

3a. Sendmail for ClamAV & SpamAssassin

Load the following to /etc/mail/sendmail.mc, placed above any MAILER definition and I place it after the line “FEATURE(use_ct_file)dnl”

dnl # LOCAL ADDITIONS before Mailers
dnl # clamav-milter - z README ... dnl
INPUT_MAIL_FILTER(`clamav-milter',`S=local:/var/clamav/clmilter.socket, F=,T=S:4m;R:4m;E:10m')dnl
dnl #
dnl # SPAMASSASSIN dnl
dnl **
dnl ** enable spamassassin-milter to scan for spam using spamassassin **
dnl **
INPUT_MAIL_FILTER(`spamassassin', `S=unix:/var/run/spamass.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
define(`confMILTER_MACROS_CONNECT',`t, b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl
define(`confMILTER_MACROS_HELO',`s, {tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer}')dnl
dnl # END LOCAL ADDITIONS
dnl #

You can test / check the newly installed & configured SpamAssassin with the command:
spamassassin -D < /usr/share/doc/spamassassin-3.2.5/sample-spam.txt 2>&1 |grep -i spf
Looking for lines like:
[1290] dbg: spf: using Mail::SPF for SPF checks
&
[1290] dbg: spf: def_spf_whitelist_from: already checked spf and didn’t get pass, skipping whitelist check
[1290] dbg: spf: whitelist_from_spf: already checked spf and didn’t get pass, skipping whitelist check

3b. Now rebuild the sendmail.cf from your updated sendmail.mc in /etc as root with

make

3c. Ensure all the dependent & requisite servers are running for Clam & SA with

chkconfig clamd on
chkconfig clamav-milter on
chkconfig spamass-milter on
chkconfig sendmail on
chkconfig dovecot on

3d. Then start everything in the same order as per their init.d files, with

service clamd start
service clamav-milter start
service spamass-milter start

3e. Then restart Sendmail with

service sendmail restart

3z. SPF config & enabling <- OPTIONAL, NOT YET WORKING! Configure for the SMF-SPF support in /etc/mail/sendmail.mc and remake sendmail.cf with cd /etc/mail
cat >> sendmail.mc < END dnl ** dnl ** enable smf-spf (Sender Policy Framework) ** dnl ** define(`confMILTER_MACROS_HELO', confMILTER_MACROS_HELO`, {verify}')dnl INPUT_MAIL_FILTER(`smf-spf', `S=unix:/var/run/smfs/smf-spf.sock, T=S:30s;R:1m')dnl END make

In /etc/mail as root run make to generate the new sendmail.cf & submit.cf Sendmail config files.

Start SPF and restart Sendmail with
/etc/init.d/smf-spf restart
/etc/init.d/sendmail restart

4. Testing / Verifying Setup

4a. Check /var/log/maillog

4b. Test with a manual SMTP dialog using the telnet command to the server from another remote host on the Internet (ie: NOT from the server itself) to port 25 on your Sendmail host.

Posted in Network Presence | Tagged , , , | Comments Off on Installing ClamAV & SpamAssassin to CentOS 5 with Sendmail

Weekly Tweets for 2011-06-12

Powered by Twitter Tools

Posted in Tweets | Comments Off on Weekly Tweets for 2011-06-12

N+1 Routers & route mesh in Sydney

We’ve completed an important phase of upgrading our connectivity in Sydney, which now has 3 live / production links to the Internet in Sydney, as well as a ‘back-channel’ link.

The crucial part here is that we’ve now enabled the full internal redistribution of known routes between our 3 x Border Routers, meaning that all Network Presence customers are now able to utilise peering connectivity for both incoming & outgoing data flows from their Network Presence service.

This means that customers can now push data out to networks that we ‘peer’ with, using the same gateway router from within our network which receives data from that peered network (symmetric data flows) and this maximises our customers’ use of the various Peering connections that Network Presence has, as well as provides multiple & redundant Internet connectivity for Network Presence, and is the “route mesh” that I refer to.

The best example of this ‘better’ routing is the outgoing data path from Network Presence to the AARNet national network, in that this “all routers have full knowledge of the paths available” means that we now use our gigabit path through to AARNet in Sydney and thus all Australian Universities and other academic or research institutions nationwide, providing a faster & ‘better’ route for Network Presence customers to deliver data to this network as an example.

The “N + 1 Routers” is the physical aspect of our routing redundancy, in that Network Presence always provisions an extra router chassis at its own built POPs (currently Sydney and Canberra in Australia). The aim here is that a physical router can fail and Network Presence will still be online, providing an internal layer of routing redundancy above & beyond the link/path redundancy achieved through a full mesh of our available routes across all routers.

The whole aim here is two-fold then, to provide fantastic Routing QoS, through having a number of different paths to the Internet and to maximise our ability to hand-off data to & from Australians by a high level of domestic national Peering connectivity, while also being able to automatically & quickly recover and survive any physical router failure too.

All to provide very high uptime & quality of networking for Network Presence customers.

Posted in Network Presence | Tagged , , , , | Comments Off on N+1 Routers & route mesh in Sydney