MailScanner, Postfix, ClamAV and SpamAssassin Setup RHEL/CentOS 5/6

Hello,

this howto only describes how to configure MailScanner on a CentOS 5 machine. The requirements like Postfix (CentOS repository), ClamAV (EPEL repository) and Spamassassin (CentOS repository) have to be installed and working before you continue.

First download MailScanner from their website (www.mailscanner.info), extract the .tar.gz and execute the install.sh. The script starts now and compiles all needed rpm packages (rpm-build package is needed and has to be installed before with yum). Wait 15 minutes and Mailscanner is installed.

Now let's configure it:

– edit the file /etc/MailScanner/MailScanner.conf and set following values

%org-name% = your organization name
%org-long-name% = your full organization name
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
Incoming Work Group = clam
Incoming Work Permissions = 0640
MTA = postfix
Virus Scanners = clamd
Clamd Socket = /var/run/clamav/clamd.sock
Use SpamAssassin = yes
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin

– then go and create the folder /var/spool/MailScanner/Spamassassin

# mkdir /var/spool/MailScanner/spamassassin

– change permissions  to owner postfix and group clamav and restrict access to others

# chown -R postfix:clamav /var/spool/MailScanner/incoming
# chmod -R 770 /var/spool/MailScanner/incoming
# chown -R postfix:clamav /var/spool/MailScanner/quarantine
# chmod -R 770 /var/spool/MailScanner/quarantine
# chown -R postfix:clamav /var/spool/MailScanner/spamassassin
# chmod -R 770 /var/spool/MailScanner/spamassassin

– MailScanner looks for freshclam in a different location than installed so create a symbolic link to it

# ln -s /usr/bin/freshclam /usr/local/bin/freshclam

ok, MailScanner should now be installed and configured now, let's integrate postfix:

– edit the /etc/postfix/main.cf and uncomment the line

header_checks = regexp:/etc/postfix/header_checks

add the next line to that file

/^Received:/ HOLD

That's it… the postfix service should be started through MailScanner so disable or enable following services:

# chkconfig postfix off
# chkconfig MailScanner on
# chkconfig spamassassin on
# chkconfig clamd on

UPDATE: If you are using perl 5.10.1 it can be that Mailscanner exits with errors in an endless loop causing high cpu usage and no message delivery or keeps sending messages about problem messages. In that case open /usr/sbin/MailScanner and add the -U parameter to the first line (allow unsafe operations).

source: http://www.linuxmail.info/mailscanner-postfix-clamav-spamassassin-howto-centos-5/

Connecting a second mouse or keyboard directly to a Fusion virtual machine

Mice and keyboards belong to a special class of USB devices known as Human Interface Devices, or HID. Fusion does not allow these to be connected to the virtual machine by default, due to the risk of removing all human interface from the Mac. It is possible to instruct Fusion to make it possible to connect these devices by modifying the virtual machine settings.
 
Caution: You require access to a second keyboard and/or mouse for these steps. Do not follow these steps if you only have one mouse and/or keyboard, as you will not be able to use the device(s) with your Mac while Fusion is running.
 
To connect an external keyboard and/or mouse directly to your virtual machine:
  1. Shut down the virtual machine that needs the mouse/keyboard.
  2. Plug the second mouse/keyboard into your Mac.
  3. Edit your virtual machine's .vmx file using a text editor to include these lines:

    usb.generic.allowHID = "TRUE"
    usb.generic.allowLastHID = "TRUE"

    Note: For more information about editing the .vmx file,
    see Editing the .vmx file for your Fusion virtual machine (1014782).
     
  4. Power on your virtual machine.
  5. Go to Virtual Machine > USB and select Connect <your mouse or keyboard>.

source: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1003418

Validate email addresses using regular expressions (RFC 2822)

Hi,

this is for everyone who wants to check for a RFC 2822 compliant email. Here are 2 expressions, one for normal and one for strange looking but valid emails:

$normal = "^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$";

$strange = "^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})$";

source: http://www.markussipila.info/pub/emailvalidator.php