Showing posts with label Mail. Show all posts
Showing posts with label Mail. Show all posts

12/10/2010

Run with Clamav

[1] Configure SMTP Server in order to scan emails to protect from virus or spams. Install clamav first.
# install from DAG

[root@mail ~]#yum --enablerepo=dag -y install clamd amavisd-new


[root@mail ~]#vi /etc/clamd.conf

# line 72: change

LocalSocket /var/run/clamav/clamd.sock

# line 80: make it comment

#TCPSocket 3310

# line 149: change

AllowSupplementaryGroups yes

[root@mail ~]#vi /etc/amavisd.conf

# line 20: specify domain name

$mydomain= 'server.world';

# line 80: make it comment (not notify if virus detected)
#$virus_admin= "virusalert\@$mydomain";

# line 113: uncomment and specify FQDN

$myhostname= 'mail.server.world';

# line 115,116: uncomment

$notify_method= 'smtp:[127.0.0.1]:10025';

$forward_method= 'smtp:[127.0.0.1]:10025';

# line 118: uncomment thease 4 lines

$final_virus_destiny= D_DISCARD;
$final_banned_destiny= D_BOUNCE;
$final_spam_destiny= D_BOUNCE;
$final_bad_header_destiny= D_PASS;

# line 321: uncomment thease 4 lines

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

[root@mail ~]#vi /etc/postfix/main.cf

# add at the bottom

content_filter=smtp-amavis:[127.0.0.1]:10024

[root@mail ~]#vi /etc/postfix/master.cf

# add at the bottom

smtp-amavis unix -       -       n      -     2 smtp
      -o smtp_data_done_timeout=1200
      -o smtp_send_xforward_command=yes
      -o disable_dns_lookups=yes
127.0.0.1:10025 inet n     -     n     -     - smtpd
      -o content_filter=
      -o local_recipient_maps=
      -o relay_recipient_maps=
      -o smtpd_restriction_classes=
      -o smtpd_client_restrictions=
      -o smtpd_helo_restrictions=
      -o smtpd_sender_restrictions=
      -o smtpd_recipient_restrictions=permit_mynetworks,reject
      -o mynetworks=127.0.0.0/8
      -o strict_rfc821_envelopes=yes
      -o smtpd_error_sleep_time=0
      -o smtpd_soft_error_limit=1001
      -o smtpd_hard_error_limit=1000


[root@mail ~]#/etc/rc.d/init.d/clamd start
Stopping Clam AntiVirus Daemon:[ OK ]
Starting Clam AntiVirus Daemon: Running as user clamav (UID 100, GID 101) [ OK ]
[root@mail ~]#/etc/rc.d/init.d/amavisd start
Starting Mail Virus Scanner (amavisd):[ OK ]
[root@mail ~]#/etc/rc.d/init.d/spamassassin start
Starting spamd:[ OK ]
[root@mail ~]#/etc/rc.d/init.d/postfix restart
Shutting down postfix:[ OK ]
Starting postfix:[ OK ]
[root@mail ~]#chkconfig amavisd on
[root@mail ~]#chkconfig spamassassin on
[root@mail ~]#chkconfig clamd on

These lines below are added in header section of emails after this configuration.
     
from: server-world.info

11/11/2010

Virtual Domain

Configure for Virtulal Domain to send an email with another domain name different from original domain. This example set config as, present domain name ⇒ server.world new domain name ⇒ virtual.host and userA has an email address cent@mail.server.world now
and Add userB newly and Give him an email address cent@mail.virtual.host

[1]     Config for Virtula Domain

[root@mail ~]#vi /etc/postfix/main.cf
# add at the bottom
virtual_alias_domains = virtual.host
virtual_alias_maps = hash:/etc/postfix/virtual
[root@mail ~]#vi /etc/postfix/virtual
# add at the head
cent@mail.virtual.host
userB
[root@mail ~]#postmap /etc/postfix/virtual
[root@mail ~]#/etc/rc.d/init.d/postfix reload
Reloading postfix:[ OK ]

[2]     Configure on client for new account and verify sending emails.

10/29/2010

Spam Control For Postfix

Spam Control For Postfix

Spam is a major problem for anyone with a mail server. Many times, spam goes to email addresses that don't exist. But, it still is hitting your server even if it isn't delivered. Other times, a users inbox will be overflowing with annoying messages about Viagra, hookers, free software, and whatever else.


Below is a solution. It's an ongoing accumulation of my efforts to stop spam to the best of my abilities. So far, it has a 97% success rate with over 20,000 emails (spam and ham, alike) processed.


Follow the instructions. I will update/modify as necessary if things seem unclear. Feel free to ask.

1) Install Postgrey, RRD, a log parser, and Graphing tools.
apt-get install postgrey rrdtool mailgraph pflogsumm

Postgrey will have a delay of 5 minutes by default on email going to your mailbox. If this is too long, edit the /etc/default/postgrey file by adding --delay=120 where 120 is seconds.

2) Restart the Postgrey server.
/etc/init.d/postgrey restart

3) Edit the Postfix main.cf.
We will be adding several things including the Postgrey configuration.

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = my.derekgordon.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = my.derekgordon.com, localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8 [::1]/128 66.118.142.78
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /var/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, reject_unauth_destination, check_policy_service inet:127.0.0.1:60000, reject_rbl_client zen.spamhaus.org, reject_rbl_client smtp.dnsbl.sorbs.net, reject_rbl_client bl.spamcop.net, reject_rbl_client combined.rbl.msrbl.net, reject_rbl_client multihop.dsbl.org, check_recipient_access regexp:/etc/postfix/spamtrap, permit
smtpd_tls_security_level = may
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf
smtpd_client_restrictions = check_client_access mysql:/etc/postfix/mysql-virtual_client.cf
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
header_checks = regexp:/etc/postfix/header_checks
mime_header_checks = regexp:/etc/postfix/mime_header_checks
nested_header_checks = regexp:/etc/postfix/nested_header_checks
body_checks = regexp:/etc/postfix/body_checks
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings
message_size_limit = 0

disable_vrfy_command = yes
smtpd_helo_required = yes


From a generic main.cf found in the Debian Lenny installation, I added/modified the BOLD areas.

4) Create a file named "spamtrap" in the /etc/postfix/ directory.
This serves as a filter. If spam is emailed to this address and other addresses on your machine, it will drop that email so that it doesn't get to any other mailboxes.

spamtrap file looks like this:

/emailcontrol.*@derekgordon\.com/ DISCARD

This is regexp so the slashes have to be used. My filter email is emailcontrol@derekgordon.com so edit accordingly and place in the spamtrap file!!!

Side note: Do not create this mailbox using ISPConfig. There is absolutely no reason for it to exist on your mailserver. It's a fake address meant to catch annoying spam.



5) Open up local.cf for SpamAssassin and add the following bit.
It will be an extra filter designed to work with SA more than it is with general Postfix.

nano /etc/spamassassin/local.cf

Add the following to the bottom:

urirhssub       URIBL_BLACK  multi.uribl.com.        A   2
body            URIBL_BLACK  eval:check_uridnsbl('URIBL_BLACK')
describe        URIBL_BLACK  Contains an URL listed in the URIBL blacklist
tflags          URIBL_BLACK  net
score           URIBL_BLACK  3.0

6) Restart Postfix and Spamassassin
/etc/init.d/postfix restart
/etc/init.d/spamassassin restart



7) Copy the mailgraph CGI script to your websites CGI-BIN:
cp -p /usr/lib/cgi-bin/mailgraph.cgi /var/www/www.example.com/cgi-bin



8) Create and CHMOD the postfix_report.sh script:
nano /usr/local/sbin/postfix_report.sh

Paste the following into the script:

#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

pflogsumm /var/log/mail.log | formail -c -I"Subject: Mail Statistics" -I"From: maillog@example.com" -I"To: youremail@yourdomain.com" -I"Received: from www.example.com ([ 127.0.0.1])" | sendmail youremail@yourdomain.com

##gzip /var/log/mail.log.0
exit 0
chmod 755 /usr/local/sbin/postfix_report.sh



9) Edit the RSYSLOG file so that your mail.log rotates daily and to set up an automatic email with postfix statistics:
nano /etc/logrotate.d/rsyslog

Delete the line that says /var/log/mail.log and add this at the VERY bottom of the file:

/var/log/mail.log
{
        rotate 7
        daily
        missingok
        notifempty
        delaycompress
        compress
        prerotate
              /usr/local/sbin/postfix_report.sh > /dev/null
        endscript
        postrotate
                invoke-rc.d rsyslog reload > /dev/null
        endscript
}
With this, every time the mail.log rotates (usually around 6am by default) you will get a detailed email about what Postfix has delivered, not delivered, greylisted, and so on.

So now you're all done! What did you do? You installed blacklist filters, greylisting, graphing for on-the-fly information about Postfix, daily emails with detailed Postfix stats, created a spam trap, and other minor things to make your mailserver a lot more secure and less susceptible to spam.

IMPORTANT: Let me know what you all do. Please respond with your choice, if you use it, and how well it worked. If there's much of a use, I will keep building upon the instructions and make it even better (hopefully). Responses are in the form of thread messages.

BONUS INSTRUCTIONS:
If you use the script I posted below, that gives you GREYLISTING SPECIFIC STATS, do the following:

1) DELETE it from having a CRONJOB if you added one originaly. Most likely, you did.

2) Open the RSYSLOG file again.

3) Modify the above entry so that it looks like this:

/var/log/mail.log
{
        rotate 7
        daily
        missingok
        notifempty
        delaycompress
        compress
        prerotate
          /path/to/the/greylist_script.sh > /dev/null
              /usr/local/sbin/postfix_report.sh > /dev/null
        endscript
        postrotate
                invoke-rc.d rsyslog reload > /dev/null
        endscript
}
Make sure that the /path/to/the/greylist_script.sh > /dev/null matches the exact path to the script you were using.

Here is the greylist_script.sh:

#!/bin/sh

LOGFILE=/tmp/greylist-statistics
YOURMAIL=youremail@yourdomain.com

echo "Total amount of GreyListed messages
" > $LOGFILE
cat /var/log/mail.log | /usr/bin/postgreyreport --delay=300 >> $LOGFILE
echo -ne  "-------------------------------------\n" >> $LOGFILE
echo -ne  "-------------------------------------\n" >> $LOGFILE
echo "Get only the top 20 sources getting greylisted out
" >> $LOGFILE
cat /var/log/mail.log | postgreyreport | awk '{print $1}' | sort | uniq -c | sort -nr | head -n20 >> $LOGFILE
echo -ne  "-------------------------------------\n" >> $LOGFILE
echo -ne  "-------------------------------------\n" >> $LOGFILE
echo "Get a list of the top 20 email address that the greylisted sources are sending email to
"  >> $LOGFILE
cat /var/log/mail.log | postgreyreport | awk '{print $4}'  | sort  | uniq -c | sort -nr | head -n20 >> $LOGFILE
echo -ne  "-------------------------------------\n" >> $LOGFILE
echo -ne  "-------------------------------------\n" >> $LOGFILE
cat $LOGFILE | mail -s "Greylisting Statistics of `hostname` for `date +%Y-%m-%d`" $YOURMAIL
Edit the following parts of the above script:

1) Change the YOUREMAIL = line so that it goes to your personal mail box. This will give you details on how its working.
2) Make sure that /var/log/mail.log is the correct path to your current mail.log file. Distros are different.

Set the script to chmod +700 so that it is executable:

chmod 700 /path/to/the/greylist_script.sh

To: howtofoge

10/25/2010

Install/Configure Postfix


This is How to Build SMTP Server with Postfix
Install/Configure Postfix



[root@mail ~]#
yum -y install postfix


[root@mail ~]#
vi /etc/postfix/main.cf


# line 70: uncomment and specify hostname

myhostname =
mail.server.world


# line 77: uncomment and specify domain name

mydomain =
server.world


# line 93: uncomment

myorigin = $mydomain

# line 110: change

inet_interfaces =
all


# line 155: add

mydestination = $myhostname, localhost.$mydomain, localhost
, $mydomain


# line 255: uncomment and specify LAN

mynetworks = 127.0.0.0/8,
10.0.0.0/24


# line 410: uncomment (use Maildir)

home_mailbox = Maildir/

# line 536: uncomment; line 537: add

header_checks = regexp:/etc/postfix/header_checks
body_checks = regexp:/etc/postfix/body_checks


# line 562: add

smtpd_banner = $myhostname ESMTP


# add at the bottom

# limit an email size 5M

message_size_limit = 5242880

# limit mailbox 100M

mailbox_size_limit = 104857600


# for SMTP-Auth setting

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth-client
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_client_restrictions = permit_mynetworks,reject_unknown_client,permit
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject


[root@mail ~]#
vi /etc/postfix/header_checks


# add at the head

# reject if email address is empty

/^From:.*<#.*@.*>/ REJECT
/^Return-Path:.*<#.*@.*>/ REJECT
# hide Received line

/^Received:/ IGNORE


[root@mail ~]#
vi /etc/postfix/body_checks


# reject if includes 'example.com' in mail body

/^(|[^>].*)example.com/ REJECT


[root@mail ~]#
/etc/rc.d/init.d/sendmail stop

Shutting down sm-client:
[ OK ]

Shutting down sendmail:
[ OK ]

[root@mail ~]#
chkconfig sendmail off

[root@mail ~]#
alternatives --config mta

# change default MTA


There are 2 programs which provide 'mta'.

Selection Command
-----------------------------------------------
*+ 1
/usr/sbin/sendmail.sendmail

2
/usr/sbin/sendmail.postfix


Enter to keep the current selection[+], or type selection number:
2

# switch to postfix


[root@mail ~]#
/etc/rc.d/init.d/postfix start

Starting postfix:
[ OK ]

[root@mail ~]#
chkconfig postfix on


Source: sever-world.info

10/16/2010

Install/Configure Dovecot

[root@mail ~]# yum -y install dovecot

[root@mail ~]# vi /etc/dovecot.conf

# line 20: uncomment
protocols = imap imaps pop3 pop3s

# line 211: uncomment and add
mail_location = maildir:~/Maildir

# line 762: add
mechanisms = plain login

# line 978: change like below
socket listen { # uncomment
#master {
# Master socket provides access to userdb information. It's typically
# used to give Dovecot's local delivery agent access to userdb so it
# can find mailbox locations.
#path = /var/run/dovecot/auth-master
#mode = 0600
# Default user/group is the one who started dovecot-auth (root)
#user =
#group =
#}
client { # uncomment
# The client socket is generally safe to export to everyone. Typical use
# is to export it to your SMTP server so it can do SMTP AUTH lookups
# using it.
path = /var/spool/postfix/private/auth-client # uncomment and change
mode = 0660 # uncomment
user = postfix # add
group = postfix # add
}# uncomment
} # uncomment

[root@mail ~]# /etc/rc.d/init.d/dovecot start
Starting Dovecot Imap: [ OK ]
[root@mail ~]# chkconfig dovecot on

From: server-world

10/15/2010

Set mail server on Debian

In the following article, Linuxbasiccommad will guide you how to set up the system fully featured mail server, secure, scalable and replace a number of other functions if necessary. This model provides hosting services for virtual mailbox with many different formats, filtering and quota server - side, domain alias, alias address, forwarding address and the catchall address. Transition are secure protocol SMTP-AUTH and STARTTLS. The email received will be strictly controlled by the virus filter, spam, malware and quickly remove the SPF and DNSBL policy.

And the whole process will be undergoing three main server:

- An MX server, here will concentrate all the security features (faramir.middle.earth)

- A transition SMTP protocol, allowing users to send emails to the outside (ectelion.middle.earth)

- Mailstore a server used to store all data of the mailbox (denetor.middle.earth)

Of course, you can assign more custom MX record to use DNS MX domains, forwarding services using DNS round-robin, archiving, email forwarding and division ... will be fully addressed in the article.

All operations were performed on systems that use Debian server operating system.

Set up LDAP

The entire information of the user are stored in the LDAP directory. And this is how we installed on the server making the transition task. The system requires the following packages needed:
sudo apt-get install slapd ldap-utils

Here, we will use the following LDAP parameters:
- ldapBase: dc=middle,dc=earth

- adminDn: cn=admin,dc=middle,dc=earth

- adminPwd: thirdAge

Besides, we need to use LDAP schema is available. Most of the properties and subject to the standard, noting that much of the standard attributes user should pay attention to avoid duplication event occurred.

Transplantation in openldap schema is available in the / etc / ldap / schema / mailMEO.schema
attributetype ( 2.16.840.1.113730.3.1.13
NAME 'mailLocalAddress'
DESC 'RFC822 email address of this recipient'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
attributetype ( 2.16.840.1.113730.3.1.16
NAME 'mailQuota'
DESC 'Maiximal amount of disk space for a mailbox in kilobytes'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
attributetype ( 2.16.840.1.113730.3.1.18
NAME 'mailHost'
DESC 'FQDN of the SMTP/MTA of this recipient'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SINGLE-VALUE )
attributetype ( 2.16.840.1.113730.3.1.22
NAME 'mailCopyAddress'
DESC 'RFC822 email shadow copy address'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
attributetype ( 2.16.840.1.113730.3.1.47
NAME 'mailRoutingAddress'
DESC 'RFC822 routing address of this recipient'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
attributetype ( 2.16.840.1.113730.3.1.49
NAME 'spamassassinUserPrefs'
DESC 'SpamAssassin user preferences'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
objectclass ( 2.16.840.1.113730.3.2.147
NAME 'inetLocalMailRecipient'
DESC 'Internet local mail recipient'
SUP top AUXILIARY
MAY ( mailLocalAddress $ mailHost $ mailRoutingAddress $ mailCopyAddress $ mailQuota $ spamassassinUserPrefs ) )

objectclass ( 2.16.840.1.113730.3.2.148
NAME 'inetMailForwarder'
DESC 'Internet mail Forward Address'
SUP top AUXILIARY
MAY ( mailHost $ mailRoutingAddress ) )


Confiure file /etc/ldap/slapd.conf:

include /etc/ldap/schema/inetorgperson.schema
include /etc/ldap/schema/mailMEO.schema

Check line:
suffix "dc=middle,dc=earth"


Then, add the ACLs assigned to the daemon should use to transfer data to LDAP. Readonly attribute to initialize access to userPassword for devecot
access to attrs=userPassword,shadowLastChange
by dn="cn=admin,dc=middle,dc=earth" write
by dn="uid=dovecot,dc=middle,dc=earth" read
by anonymous auth
by self write
by * none

Confiure exim and dovecot with too
access to *
by dn="cn=admin,dc=middle,dc=earth" write
by dn="uid=dovecot,dc=middle,dc=earth" read
by dn="uid=exim,dc=middle,dc=earth" read
by * read
by anonymous none

ACL final parameters assume the responsibility for preventing the ability to read data from anonymous accounts, but allowed to edit the account is confirmed. Slapd restart to apply the changes
sudo /etc/init.d/slapd restart

After that, we must create a user account with the previous ACL. To do this, we must use user.ldif file follows:

dn: uid=exim,dc=middle,dc=earth
objectClass: account
objectClass: simpleSecurityObject
objectClass: top
uid: exim
userPassword:: e01ENX1hOElTeXAwV2hnVzFSVnhHd0hCNDF3PT0=
dn: uid=dovecot,dc=middle,dc=earth
objectClass: account
objectClass: simpleSecurityObject
objectClass: top
uid: dovecot
userPassword:: e01ENX1yZGp2Q1lPNmtDRm1scXAyVWQwa0xBPT0=


This account will have a user / pass is: dovecot / dovecotpopper and exim4 / eximmta

To provide information and data to the root directory, use the following command:
ldapadd -x -D cn=admin,dc=middle,dc=earth -W < users.ldif


Below is a sample ldif file containing the data:
dn: ou=domains,dc=middle,dc=earth
objectClass: organizationalUnit
objectClass: top
ou: domains
dn: dc=middle.earth,ou=domains,dc=middle,dc=earth
dc: middle.earth
objectClass: dNSDomain
objectClass: top
objectClass: inetLocalMailRecipient
objectClass: domainRelatedObject
objectClass: posixAccount
mailLocalAddress: catchall@middle.earth
cn: catchall
gidNumber: 8
homeDirectory: /var/mail/middle.earth/c/catchall
uid: catchall
uidNumber: 8
userPassword:: e01ENX1EV3RteGErOFROanJKNUFXZWt1Z0tBPT0=
mailQuota: 102400
mailHost: denetor.middle.earth
associatedDomain: middle.earth
associatedDomain: lotr.middle.earth
dn: uid=sam,dc=middle.earth,ou=domains,dc=middle,dc=earth
cn: sam
displayName: Sam Gamji
gidNumber: 8
homeDirectory: /var/mail/middle.earth/s/sam
mail: sam@middle.earth
mailHost: 172.16.16.23
mailQuota: 102400
objectClass: inetLocalMailRecipient
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
sn: Gamji
uidNumber: 8
uid: sam
userPassword:: e01ENX1NeVV5M1BxaHkvWWVLaVpyMXlOaExBPT0=
mailLocalAddress: sam@middle.earth
mailLocalAddress: gamji@middle.earth
mailLocalAddress: shire@middle.earth
dn: uid=frodo,dc=middle.earth,ou=domains,dc=middle,dc=earth
cn: frodo
displayName: Frodo Baggins
gidNumber: 8
givenName: Frodo
homeDirectory: /var/mail/middle.earth/f/frodo
mail: frodo@middle.earth
mailHost: 172.16.16.23
mailQuota: 102400
objectClass: inetLocalMailRecipient
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
sn: Baggins
uidNumber: 8
uid: frodo
userPassword:: e01ENX04UGlDRHVnWEdCMmNhRktnbDljTmpRPT0=
mailLocalAddress: frodo@middle.earth
mailLocalAddress: baggins@middle.earth
mailLocalAddress: shire@middle.earth
dn: uid=gmail,dc=middle.earth,ou=domains,dc=middle,dc=earth
cn: gmail
mail: alxgomz@gmail.com
mailHost: 172.16.16.23
mailRoutingAddress: alxgomz@gmail.com
objectClass: inetMailForwarder
objectClass: inetOrgPerson
objectClass: top
sn: alias to Gmail address
uid: gmail

10/14/2010

Spam Control For Postfix

Spam is a major problem for anyone with a mail server. Many times, spam goes to email addresses that don't exist. But, it still is hitting your server even if it isn't delivered. Other times, a users inbox will be overflowing with annoying messages about Viagra, hookers, free software, and whatever else.

Below is a solution. It's an ongoing accumulation of my efforts to stop spam to the best of my abilities. So far, it has a 97% success rate with over 20,000 emails (spam and ham, alike) processed.

Follow the instructions. I will update/modify as necessary if things seem unclear. Feel free to ask.

1) Install Postgrey, RRD, a log parser, and Graphing tools.
apt-get install postgrey rrdtool mailgraph pflogsumm

2) Restart the Postgrey server.
/etc/init.d/postgrey restart

3) Edit the Postfix main.cf.
We will be adding several things including the Postgrey configuration.
# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = my.derekgordon.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = my.derekgordon.com, localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8 [::1]/128 66.118.142.78
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /var/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, reject_unauth_destination, check_policy_service inet:127.0.0.1:60000, reject_rbl_client zen.spamhaus.org, reject_rbl_client smtp.dnsbl.sorbs.net, reject_rbl_client bl.spamcop.net, reject_rbl_client combined.rbl.msrbl.net, reject_rbl_client multihop.dsbl.org, check_recipient_access regexp:/etc/postfix/spamtrap, permit
smtpd_tls_security_level = may
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf
smtpd_client_restrictions = check_client_access mysql:/etc/postfix/mysql-virtual_client.cf
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
header_checks = regexp:/etc/postfix/header_checks
mime_header_checks = regexp:/etc/postfix/mime_header_checks
nested_header_checks = regexp:/etc/postfix/nested_header_checks
body_checks = regexp:/etc/postfix/body_checks
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings
message_size_limit = 0

disable_vrfy_command = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, reject_invalid_hostname, permit

4) Create a file named "spamtrap" in the /etc/postfix/ directory.
This serves as a filter. If spam is emailed to this address and other addresses on your machine, it will drop that email so that it doesn't get to any other mailboxes.

spamtrap file looks like this:
/emailcontrol.*@derekgordon\.com/ DISCARD
5) Open up local.cf for SpamAssassin and add the following bit.
It will be an extra filter designed to work with SA more than it is with general Postfix.

nano /etc/spamassassin/local.cf
Add the following to the bottom:
urirhssub URIBL_BLACK multi.uribl.com. A 2
body URIBL_BLACK eval:check_uridnsbl('URIBL_BLACK')
describe URIBL_BLACK Contains an URL listed in the URIBL blacklist
tflags URIBL_BLACK net
score URIBL_BLACK 3.0


6) Restart Postfix and Spamassassin
/etc/init.d/postfix restart
/etc/init.d/spamassassin restart

7) Copy the mailgraph CGI script to your websites CGI-BIN:
cp -p /usr/lib/cgi-bin/mailgraph.cgi /var/www/www.example.com/cgi-bin

8) Create and CHMOD the postfix_report.sh script:
nano /usr/local/sbin/postfix_report.sh

Paste the following into the script:
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

pflogsumm /var/log/mail.log | formail -c -I"Subject: Mail Statistics" -I"From: maillog@example.com" -I"To: youremail@yourdomain.com" -I"Received: from www.example.com ([ 127.0.0.1])" | sendmail youremail@yourdomain.com

##gzip /var/log/mail.log.0
exit 0

chmod 755 /usr/local/sbin/postfix_report.sh

9) Edit the RSYSLOG file so that your mail.log rotates daily and to set up an automatic email with postfix statistics:
nano /etc/logrotate.d/rsyslog

Delete the line that says /var/log/mail.log and add this at the VERY bottom of the file:

/var/log/mail.log
{
rotate 7
daily
missingok
notifempty
delaycompress
compress
prerotate
/usr/local/sbin/postfix_report.sh > /dev/null
endscript
postrotate
invoke-rc.d rsyslog reload > /dev/null
endscript

10/10/2010

Configure Exim

######################################################################
# Runtime configuration file for Exim #
######################################################################


# This is a default configuration file which will operate correctly in
# uncomplicated installations. Please see the manual for a complete list
# of all the runtime configuration options that can be included in a
# configuration file. There are many more than are mentioned here. The
# manual is in the file doc/spec.txt in the Exim distribution as a plain
# ASCII file. Other formats (PostScript, Texinfo, HTML, PDF) are available
# from the Exim ftp sites. The manual is also online at the Exim web sites.


# This file is divided into several parts, all but the first of which are
# headed by a line starting with the word "begin". Only those parts that
# are required need to be present. Blank lines, and lines starting with #
# are ignored.


########### IMPORTANT ########## IMPORTANT ########### IMPORTANT ###########
# #
# Whenever you change Exim's configuration file, you *must* remember to #
# HUP the Exim daemon, because it will not pick up the new configuration #
# until you do. However, any other Exim processes that are started, for #
# example, a process started by an MUA in order to send a message, will #
# see the new configuration as soon as it is in place. #
# #
# You do not need to HUP the daemon for changes in auxiliary files that #
# are referenced from this file. They are read every time they are used. #
# #
# It is usually a good idea to test a new configuration for syntactic #
# correctness before installing it (for example, by running the command #
# "exim -C /config/file.new -bV"). #
# #
########### IMPORTANT ########## IMPORTANT ########### IMPORTANT ###########



######################################################################
# MAIN CONFIGURATION SETTINGS #
######################################################################

# Specify your host's canonical name here. This should normally be the fully
# qualified "official" name of your host. If this option is not set, the
# uname() function is called to obtain the name. In many cases this does
# the right thing and you need not set anything explicitly.

# primary_hostname =


# The next three settings create two lists of domains and one list of hosts.
# These lists are referred to later in this configuration using the syntax
# +local_domains, +relay_to_domains, and +relay_from_hosts, respectively. They
# are all colon-separated lists:

domainlist local_domains = @
domainlist relay_to_domains =
hostlist relay_from_hosts = 127.0.0.1

# Most straightforward access control requirements can be obtained by
# appropriate settings of the above options. In more complicated situations, you
# may need to modify the Access Control List (ACL) which appears later in this
# file.

# The first setting specifies your local domains, for example:
#
# domainlist local_domains = my.first.domain : my.second.domain
#
# You can use "@" to mean "the name of the local host", as in the default
# setting above. This is the name that is specified by primary_hostname,
# as specified above (or defaulted). If you do not want to do any local
# deliveries, remove the "@" from the setting above. If you want to accept mail
# addressed to your host's literal IP address, for example, mail addressed to
# "user@[192.168.23.44]", you can add "@[]" as an item in the local domains
# list. You also need to uncomment "allow_domain_literals" below. This is not
# recommended for today's Internet.

# The second setting specifies domains for which your host is an incoming relay.
# If you are not doing any relaying, you should leave the list empty. However,
# if your host is an MX backup or gateway of some kind for some domains, you
# must set relay_to_domains to match those domains. For example:
#
# domainlist relay_to_domains = *.myco.com : my.friend.org
#
# This will allow any host to relay through your host to those domains.
# See the section of the manual entitled "Control of relaying" for more
# information.

# The third setting specifies hosts that can use your host as an outgoing relay
# to any other host on the Internet. Such a setting commonly refers to a
# complete local network as well as the localhost. For example:
#
# hostlist relay_from_hosts = 127.0.0.1 : 192.168.0.0/16
#
# The "/16" is a bit mask (CIDR notation), not a number of hosts. Note that you
# have to include 127.0.0.1 if you want to allow processes on your host to send
# SMTP mail by using the loopback address. A number of MUAs use this method of
# sending mail.


# All three of these lists may contain many different kinds of item, including
# wildcarded names, regular expressions, and file lookups. See the reference
# manual for details. The lists above are used in the access control list for
# incoming messages. The name of this ACL is defined here:

acl_smtp_rcpt = acl_check_rcpt

# You should not change that setting until you understand how ACLs work.

# The following ACL entries are used if you want to do content scanning with
# the exiscan-acl patch. When you uncomment one of these lines, you must also
# review the respective entries in the ACL section further below.

# acl_smtp_mime = acl_check_mime
# acl_smtp_data = acl_check_content

# This configuration variable defines the virus scanner that is used with
# the 'malware' ACL condition of the exiscan acl-patch. If you do not use
# virus scanning, leave it commented. Please read doc/exiscan-acl-readme.txt
# for a list of supported scanners.

# av_scanner = sophie:/var/run/sophie

# The following setting is only needed if you use the 'spam' ACL condition
# of the exiscan-acl patch. It specifies on which host and port the SpamAssassin
# "spamd" daemon is listening. If you do not use this condition, or you use
# the default of "127.0.0.1 783", you can omit this option.

# spamd_address = 127.0.0.1 783

# Specify the domain you want to be added to all unqualified addresses
# here. An unqualified address is one that does not contain an "@" character
# followed by a domain. For example, " caesar@rome.exampleThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it " is a fully qualified
# address, but the string "caesar" (i.e. just a login name) is an unqualified
# email address. Unqualified addresses are accepted only from local callers by
# default. See the recipient_unqualified_hosts option if you want to permit
# unqualified addresses from remote sources. If this option is not set, the
# primary_hostname value is used for qualification.

# qualify_domain =


# If you want unqualified recipient addresses to be qualified with a different
# domain to unqualified sender addresses, specify the recipient domain here.
# If this option is not set, the qualify_domain value is used.

# qualify_recipient =


# The following line must be uncommented if you want Exim to recognize
# addresses of the form "user@[10.11.12.13]" that is, with a "domain literal"
# (an IP address) instead of a named domain. The RFCs still require this form,
# but it makes little sense to permit mail to be sent to specific hosts by
# their IP address in the modern Internet. This ancient format has been used
# by those seeking to abuse hosts by using them for unwanted relaying. If you
# really do want to support domain literals, uncomment the following line, and
# see also the "domain_literal" router below.

# allow_domain_literals


# No deliveries will ever be run under the uids of these users (a colon-
# separated list). An attempt to do so causes a panic error to be logged, and
# the delivery to be deferred. This is a paranoic safety catch. There is an
# even stronger safety catch in the form of the FIXED_NEVER_USERS setting
# in the configuration for building Exim. The list of users that it specifies
# is built into the binary, and cannot be changed. The option below just adds
# additional users to the list. The default for FIXED_NEVER_USERS is "root",
# but just to be absolutely sure, the default here is also "root".

# Note that the default setting means you cannot deliver mail addressed to root
# as if it were a normal user. This isn't usually a problem, as most sites have
# an alias for root that redirects such mail to a human administrator.

never_users = root


# The setting below causes Exim to do a reverse DNS lookup on all incoming
# IP calls, in order to get the true host name. If you feel this is too
# expensive, you can specify the networks for which a lookup is done, or
# remove the setting entirely.

host_lookup = *


# The settings below, which are actually the same as the defaults in the
# code, cause Exim to make RFC 1413 (ident) callbacks for all incoming SMTP
# calls. You can limit the hosts to which these calls are made, and/or change
# the timeout that is used. If you set the timeout to zero, all RFC 1413 calls
# are disabled. RFC 1413 calls are cheap and can provide useful information
# for tracing problem messages, but some hosts and firewalls have problems
# with them. This can result in a timeout instead of an immediate refused
# connection, leading to delays on starting up an SMTP session.

rfc1413_hosts = *
rfc1413_query_timeout = 30s


# By default, Exim expects all envelope addresses to be fully qualified, that
# is, they must contain both a local part and a domain. If you want to accept
# unqualified addresses (just a local part) from certain hosts, you can specify
# these hosts by setting one or both of
#
# sender_unqualified_hosts =
# recipient_unqualified_hosts =
#
# to control sender and recipient addresses, respectively. When this is done,
# unqualified addresses are qualified using the settings of qualify_domain
# and/or qualify_recipient (see above).


# If you want Exim to support the "percent hack" for certain domains,
# uncomment the following line and provide a list of domains. The "percent
# hack" is the feature by which mail addressed to x%y@z (where z is one of
# the domains listed) is locally rerouted to x@y and sent on. If z is not one
# of the "percent hack" domains, x%y is treated as an ordinary local part. This
# hack is rarely needed nowadays; you should not enable it unless you are sure
# that you really need it.
#
# percent_hack_domains =
#
# As well as setting this option you will also need to remove the test
# for local parts containing % in the ACL definition below.


# When Exim can neither deliver a message nor return it to sender, it "freezes"
# the delivery error message (aka "bounce message"). There are also other
# circumstances in which messages get frozen. They will stay on the queue for
# ever unless one of the following options is set.

# This option unfreezes frozen bounce messages after two days, tries
# once more to deliver them, and ignores any delivery failures.

ignore_bounce_errors_after = 2d

# This option cancels (removes) frozen messages that are older than a week.

timeout_frozen_after = 7d



######################################################################
# ACL CONFIGURATION #
# Specifies access control lists for incoming SMTP mail #
######################################################################

begin acl

# This access control list is used for every RCPT command in an incoming
# SMTP message. The tests are run in order until the address is either
# accepted or denied.

acl_check_rcpt:

# Accept if the source is local SMTP (i.e. not over TCP/IP). We do this by
# testing for an empty sending host field.

accept hosts = :

#############################################################################
# The following section of the ACL is concerned with local parts that contain
# @ or % or ! or / or | or dots in unusual places.
#
# The characters other than dots are rarely found in genuine local parts, but
# are often tried by people looking to circumvent relaying restrictions.
# Therefore, although they are valid in local parts, these rules lock them
# out, as a precaution.
#
# Empty components (two dots in a row) are not valid in RFC 2822, but Exim
# allows them because they have been encountered. (Consider local parts
# constructed as "firstinitial.secondinitial.familyname" when applied to
# someone like me, who has no second initial.) However, a local part starting
# with a dot or containing /../ can cause trouble if it is used as part of a
# file name (e.g. for a mailing list). This is also true for local parts that
# contain slashes. A pipe symbol can also be troublesome if the local part is
# incorporated unthinkingly into a shell command line.
#
# Two different rules are used. The first one is stricter, and is applied to
# messages that are addressed to one of the local domains handled by this
# host. It blocks local parts that begin with a dot or contain @ % ! / or |.
# If you have local accounts that include these characters, you will have to
# modify this rule.

deny message = Restricted characters in address
domains = +local_domains
local_parts = ^[.] : ^.*[@%!/|]

# The second rule applies to all other domains, and is less strict. This
# allows your own users to send outgoing messages to sites that use slashes
# and vertical bars in their local parts. It blocks local parts that begin
# with a dot, slash, or vertical bar, but allows these characters within the
# local part. However, the sequence /../ is barred. The use of @ % and ! is
# blocked, as before. The motivation here is to prevent your users (or
# your users' viruses) from mounting certain kinds of attack on remote sites.

deny message = Restricted characters in address
domains = !+local_domains
local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
#############################################################################

# Accept mail to postmaster in any local domain, regardless of the source,
# and without verifying the sender.

accept local_parts = postmaster
domains = +local_domains

# Deny unless the sender address can be verified.

require verify = sender

#############################################################################
# There are no checks on DNS "black" lists because the domains that contain
# these lists are changing all the time. However, here are two examples of
# how you could get Exim to perform a DNS black list lookup at this point.
# The first one denies, while the second just warns.
#
# deny message = rejected because $sender_host_address is in a black list at $dnslist_domain\n$dnslist_text
# dnslists = black.list.example
#
# warn message = X-Warning: $sender_host_address is in a black list at $dnslist_domain
# log_message = found in $dnslist_domain
# dnslists = black.list.example
#############################################################################

# Accept if the address is in a local domain, but only if the recipient can
# be verified. Otherwise deny. The "endpass" line is the border between
# passing on to the next ACL statement (if tests above it fail) or denying
# access (if tests below it fail).

accept domains = +local_domains
endpass
verify = recipient

# Accept if the address is in a domain for which we are relaying, but again,
# only if the recipient can be verified.

accept domains = +relay_to_domains
endpass
verify = recipient

# If control reaches this point, the domain is neither in +local_domains
# nor in +relay_to_domains.

# Accept if the message comes from one of the hosts for which we are an
# outgoing relay. Recipient verification is omitted here, because in many
# cases the clients are dumb MUAs that don't cope well with SMTP error
# responses. If you are actually relaying out from MTAs, you should probably
# add recipient verification here.

accept hosts = +relay_from_hosts

# Accept if the message arrived over an authenticated connection, from
# any host. Again, these messages are usually from MUAs, so recipient
# verification is omitted.

accept authenticated = *

# Reaching the end of the ACL causes a "deny", but we might as well give
# an explicit message.

deny message = relay not permitted


# These access control lists are used for content scanning with the exiscan-acl
# patch. You must also uncomment the entries for acl_smtp_data and acl_smtp_mime
# (scroll up), otherwise the ACLs will not be used. IMPORTANT: the default entries here
# should be treated as EXAMPLES. You MUST read the file doc/exiscan-acl-spec.txt
# to fully understand what you are doing ...

acl_check_mime:

# Decode MIME parts to disk. This will support virus scanners later.
warn decode = default

# File extension filtering.
deny message = Blacklisted file extension detected
condition = ${if match \
{${lc:$mime_filename}} \
{\N(\.exe|\.pif|\.bat|\.scr|\.lnk|\.com)$\N} \
{1}{0}}

# Reject messages that carry chinese character sets.
# WARNING: This is an EXAMPLE.
deny message = Sorry, noone speaks chinese here
condition = ${if eq{$mime_charset}{gb2312}{1}{0}}

accept

acl_check_content:

# Reject virus infested messages.
deny message = This message contains malware ($malware_name)
malware = *

# Always add X-Spam-Score and X-Spam-Report headers, using SA system-wide settings
# (user "nobody"), no matter if over threshold or not.
warn message = X-Spam-Score: $spam_score ($spam_bar)
spam = nobody:true
warn message = X-Spam-Report: $spam_report
spam = nobody:true

# Add X-Spam-Flag if spam is over system-wide threshold
warn message = X-Spam-Flag: YES
spam = nobody

# Reject spam messages with score over 10, using an extra condition.
deny message = This message scored $spam_score points. Congratulations!
spam = nobody:true
condition = ${if >{$spam_score_int}{100}{1}{0}}

# finally accept all the rest
accept


######################################################################
# ROUTERS CONFIGURATION #
# Specifies how addresses are handled #
######################################################################
# THE ORDER IN WHICH THE ROUTERS ARE DEFINED IS IMPORTANT! #
# An address is passed to each router in turn until it is accepted. #
######################################################################

begin routers

# This router routes to remote hosts over SMTP by explicit IP address,
# when an email address is given in "domain literal" form, for example,
# . The RFCs require this facility. However, it is
# little-known these days, and has been exploited by evil people seeking
# to abuse SMTP relays. Consequently it is commented out in the default
# configuration. If you uncomment this router, you also need to uncomment
# allow_domain_literals above, so that Exim can recognize the syntax of
# domain literal addresses.

# domain_literal:
# driver = ipliteral
# domains = ! +local_domains
# transport = remote_smtp


# This router routes addresses that are not in local domains by doing a DNS
# lookup on the domain name. Any domain that resolves to 0.0.0.0 or to a
# loopback interface address (127.0.0.0/8) is treated as if it had no DNS
# entry. Note that 0.0.0.0 is the same as 0.0.0.0/32, which is commonly treated
# as the local host inside the network stack. It is not 0.0.0.0/0, the default
# route. If the DNS lookup fails, no further routers are tried because of
# the no_more setting, and consequently the address is unrouteable.

dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more


# The remaining routers handle addresses in the local domain(s).


# This router handles aliasing using a linearly searched alias file with the
# name SYSTEM_ALIASES_FILE. When this configuration is installed automatically,
# the name gets inserted into this file from whatever is set in Exim's
# build-time configuration. The default path is the traditional /etc/aliases.
# If you install this configuration by hand, you need to specify the correct
# path in the "data" setting below.
#
##### NB You must ensure that the alias file exists. It used to be the case
##### NB that every Unix had that file, because it was the Sendmail default.
##### NB These days, there are systems that don't have it. Your aliases
##### NB file should at least contain an alias for "postmaster".
#
# If any of your aliases expand to pipes or files, you will need to set
# up a user and a group for these deliveries to run under. You can do
# this by uncommenting the "user" option below (changing the user name
# as appropriate) and adding a "group" option if necessary. Alternatively, you
# can specify "user" on the transports that are used. Note that the transports
# listed below are the same as are used for .forward files; you might want
# to set up different ones for pipe and file deliveries from aliases.

system_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup{$local_part}lsearch{/etc/aliases}}
# user = exim
file_transport = address_file
pipe_transport = address_pipe


# This router handles forwarding using traditional .forward files in users'
# home directories. If you want it also to allow mail filtering when a forward
# file starts with the string "# Exim filter" or "# Sieve filter", uncomment
# the "allow_filter" option.

# If you want this router to treat local parts with suffixes introduced by "-"
# or "+" characters as if the suffixes did not exist, uncomment the two local_
# part_suffix options. Then, for example, xxxx-foo@your.domainThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it will be treated
# in the same way as xxxx@your.domainThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it by this router. You probably want to make
# the same change to the localuser router.

# The no_verify setting means that this router is skipped when Exim is
# verifying addresses. Similarly, no_expn means that this router is skipped if
# Exim is processing an EXPN command.

# The check_ancestor option means that if the forward file generates an
# address that is an ancestor of the current one, the current one gets
# passed on instead. This covers the case where A is aliased to B and B
# has a .forward file pointing to A.

# The three transports specified at the end are those that are used when
# forwarding generates a direct delivery to a file, or to a pipe, or sets
# up an auto-reply, respectively.

userforward:
driver = redirect
check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional
file = $home/.forward
# allow_filter
no_verify
no_expn
check_ancestor
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply


# This router matches local user mailboxes. If the router fails, the error
# message is "Unknown user".

# If you want this router to treat local parts with suffixes introduced by "-"
# or "+" characters as if the suffixes did not exist, uncomment the two local_
# part_suffix options. Then, for example, xxxx-foo@your.domainThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it will be treated
# in the same way as xxxx@your.domainThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it by this router.

localuser:
driver = accept
check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional
transport = local_delivery
cannot_route_message = Unknown user



######################################################################
# TRANSPORTS CONFIGURATION #
######################################################################
# ORDER DOES NOT MATTER #
# Only one appropriate transport is called for each delivery. #
######################################################################

# A transport is used only when referenced from a router that successfully
# handles an address.

begin transports


# This transport is used for delivering messages over SMTP connections.

remote_smtp:
driver = smtp


# This transport is used for local delivery to user mailboxes in traditional
# BSD mailbox format. By default it will be run under the uid and gid of the
# local user, and requires the sticky bit to be set on the /var/mail directory.
# Some systems use the alternative approach of running mail deliveries under a
# particular group instead of using the sticky bit. The commented options below
# show how this can be done.

local_delivery:
driver = appendfile
file = /var/mail/$local_part
delivery_date_add
envelope_to_add
return_path_add
group = mail
mode = 0660


# This transport is used for handling pipe deliveries generated by alias or
# .forward files. If the pipe generates any standard output, it is returned
# to the sender of the message as a delivery error. Set return_fail_output
# instead of return_output if you want this to happen only when the pipe fails
# to complete normally. You can set different transports for aliases and
# forwards if you want to - see the references to address_pipe in the routers
# section above.

address_pipe:
driver = pipe
return_output


# This transport is used for handling deliveries directly to files that are
# generated by aliasing or forwarding.

address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add


# This transport is used for handling autoreplies generated by the filtering
# option of the userforward router.

address_reply:
driver = autoreply


# This transport is used to deliver local mail to cyrus IMAP server via UNIX
# socket.
#
#local_delivery:
# driver = lmtp
# command = "/usr/lib/cyrus-imapd/deliver -l"
# batch_max = 20
# user = cyrus


######################################################################
# RETRY CONFIGURATION #
######################################################################

begin retry

# This single retry rule applies to all domains and all errors. It specifies
# retries every 15 minutes for 2 hours, then increasing retry intervals,
# starting at 1 hour and increasing each time by a factor of 1.5, up to 16
# hours, then retries every 6 hours until 4 days have passed since the first
# failed delivery.

# Address or Domain Error Retries
# ----------------- ----- -------

* * F,2h,15m; G,16h,1h,1.5; F,4d,6h



######################################################################
# REWRITE CONFIGURATION #
######################################################################

# There are no rewriting specifications in this default configuration file.

begin rewrite



######################################################################
# AUTHENTICATION CONFIGURATION #
######################################################################

# There are no authenticator specifications in this default configuration file.

begin authenticators



######################################################################
# CONFIGURATION FOR local_scan() #
######################################################################

# If you have built Exim to include a local_scan() function that contains
# tables for private options, you can define those options here. Remember to
# uncomment the "begin" line. It is commented by default because it provokes
# an error with Exim binaries that are not built with LOCAL_SCAN_HAS_OPTIONS
# set in the Local/Makefile.

# begin local_scan


# End of Exim configuration file

10/04/2010

webmail SquirrelMail

Install SquirrelMail and build webmail system. It' necessarry Web server is installed in your LAN.
[1] Install and configure SquirrelMail



[root@www ~]#
yum -y install squirrelmail


[root@www ~]#
cd /usr/share/squirrelmail/plugins/

[root@www plugins]#
wget http://www.squirrelmail.org/plugins/...ity-1.3.tar.gz

[root@www plugins]#
wget http://www.squirrelmail.org/plugins/...4-1.2.2.tar.gz

[root@www plugins]#
wget http://www.squirrelmail.org/plugins/...2-1.2.8.tar.gz

[root@www plugins]#
tar zxvf compatibility-1.3.tar.gz

[root@www plugins]#
tar zxvf empty_trash-1.4-1.2.2.tar.gz

[root@www plugins]#
tar zxvf secure_login-1.2-1.2.8.tar.gz

[root@www plugins]#
rm -f *.tar.gz

[root@www plugins]#
cd

[root@www ~]#
/usr/share/squirrelmail/config/conf.pl

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >>
1

// select

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1. Organization Name
: SquirrelMail

2. Organization Logo
: ../images/sm_logo.png

3. Org. Logo Width/Height
: (308/111)

4. Organization Title
: SquirrelMail $version

5. Signout Page
:

6. Top Frame
: _top

7. Provider link
: http://www.squirrelmail.org/

8. Provider name
: SquirrelMail


R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
5

// change Signout Page



When users click the Sign Out button they will be logged out and
then sent to signout_page. If signout_page is left empty,
(hit space and then return) they will be taken, as normal,
to the default and rather sparse SquirrelMail signout page.

[]:
/webmail

// change Signout Page

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1. Organization Name
: SquirrelMail

2. Organization Logo
: ../images/sm_logo.png

3. Org. Logo Width/Height
: (308/111)

4. Organization Title
: SquirrelMail $version

5. Signout Page
: /webmail

6. Top Frame
: _top

7. Provider link
: http://www.squirrelmail.org/

8. Provider name
: SquirrelMail


R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
r

// back to main menu

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >>
2

// select

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: localhost

2. Invert Time
: false

3. Sendmail or SMTP
: Sendmail


A. Update IMAP Settings
: localhost:143 (uw)

B. Change Sendmail Config
: /usr/sbin/sendmail


R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
1

// change domain name


The domain name is the suffix at the end of all email addresses. If
for example, your email address is jdoe@example.com, then your domain
would be example.com.

[localhost]:
server-linux.info

// input domain name

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: server-linux.info

2. Invert Time
: false

3. Sendmail or SMTP
: Sendmail


A. Update IMAP Settings
: localhost:143 (uw)

B. Change Sendmail Config
: /usr/sbin/sendmail

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
3

// select


You now need to choose the method that you will use for sending
messages in SquirrelMail. You can either connect to an SMTP server
or use sendmail directly.

1. Sendmail
2. SMTP
Your choice [1/2] [1]:
2

// change

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: server-linux.info

2. Invert Time
: false

3. Sendmail or SMTP
: SMTP


A. Update IMAP Settings
: localhost:143 (uw)

B. Change Sendmail Config
: localhost:25

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
A

// select


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: server-linux.info

2. Invert Time
: false

3. Sendmail or SMTP
: SMTP


IMAP Settings
--------------
4. IMAP Server
: localhost

5. IMAP Port
: 143

6. Authentication type
: login

7. Secure IMAP (TLS)
: false

8. Server software
: uw

9. Delimiter
: /


B. Update SMTP Settings
: localhost:25

H. Hide IMAP Server Settings

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
4

// select


This is the hostname where your IMAP server can be contacted.
[localhost]:
mail.server-linux.info

// IMAP server

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: server-linux.info

2. Invert Time
: false

3. Sendmail or SMTP
: SMTP


IMAP Settings
--------------
4. IMAP Server
: mail.server-linux.info

5. IMAP Port
: 143

6. Authentication type
: login

7. Secure IMAP (TLS)
: false

8. Server software
: uw

9. Delimiter
: /


B. Update SMTP Settings
: localhost:25

H. Hide IMAP Server Settings

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
8

// select


Each IMAP server has its own quirks. As much as we tried to stick
to standards, it doesn't help much if the IMAP server doesn't follow
the same principles. We have made some work-arounds for some of
these servers. If you would like to use them, please select your
IMAP server. If you do not wish to use these work-arounds, you can
set this to "other", and none will be used.
cyrus
= Cyrus IMAP server

uw
= University of Washington's IMAP server

exchange
= Microsoft Exchange IMAP server

courier
= Courier IMAP server

macosx
= Mac OS X Mailserver

hmailserver
= hMailServer

other
= Not one of the above servers

[uw]:
other

// other

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: server-linux.info

2. Invert Time
: false

3. Sendmail or SMTP
: SMTP


IMAP Settings
--------------
4. IMAP Server
: mail.server-linux.info

5. IMAP Port
: 143

6. Authentication type
: login

7. Secure IMAP (TLS)
: false

8. Server software
: other

9. Delimiter
: /


B. Update SMTP Settings
: localhost:25

H. Hide IMAP Server Settings

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
9

// select


This is the delimiter that your IMAP server uses to distinguish between
folders. For example, Cyrus uses '.' as the delimiter and a complete
folder would look like 'INBOX.Friends.Bob', while UW uses '/' and would
look like 'INBOX/Friends/Bob'. Normally this should be left at 'detect'
but if you are sure you know what delimiter your server uses, you can
specify it here.

To have it autodetect the delimiter, set it to 'detect'.

[/]:
detect

// detect

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: server-linux.info

2. Invert Time
: false

3. Sendmail or SMTP
: SMTP


IMAP Settings
--------------
4. IMAP Server
: mail.server-linux.info

5. IMAP Port
: 143

6. Authentication type
: login

7. Secure IMAP (TLS)
: false

8. Server software
: other

9. Delimiter
: detect


B. Update SMTP Settings
: localhost:25

H. Hide IMAP Server Settings

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
B

// select


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: server-linux.info

2. Invert Time
: false

3. Sendmail or SMTP
: SMTP


SMTP Settings
-------------
4. SMTP Server
: localhost

5. SMTP Port
: 25

6. POP before SMTP
: false

7. SMTP Authentication
: none

8. Secure SMTP (TLS)
: false

9. Header encryption key
:


A. Update IMAP Settings
: mail.server-linux.info:143 (other)

H. Hide SMTP Settings

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
4

// select


This is the hostname of your SMTP server.
[localhost]:
: mail.server-linux.info

// SMTP server

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: server-linux.info

2. Invert Time
: false

3. Sendmail or SMTP
: SMTP


SMTP Settings
-------------
4. SMTP Server
: mail.server-linux.info

5. SMTP Port
: 25

6. POP before SMTP
: false

7. SMTP Authentication
: none

8. Secure SMTP (TLS)
: false

9. Header encryption key
:


A. Update IMAP Settings
: mail.server-linux.info:143 (other)

H. Hide SMTP Settings

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
7

// select


If you have already set the hostname and port number, I can try to
automatically detect the mechanisms your SMTP server supports.
Auto-detection is *optional* - you can safely say "n" here.

Try to detect auth mechanisms? [y/N]:
y

// yes (auto detect)

Trying to detect supported methods (SMTP)...
Testing none: SUPPORTED
Testing login: SUPPORTED
Testing CRAM-MD5: NOT SUPPORTED
Testing DIGEST-MD5: NOT SUPPORTED

What authentication mechanism do you want to use for SMTP connections?
none - Your SMTP server does not require authorization.
login - Plaintext. If you can do better, you probably should.
cram-md5 - Slightly better than plaintext.
digest-md5 - Privacy protection - better than cram-md5.

*** YOUR SMTP SERVER MUST SUPPORT THE MECHANISM YOU CHOOSE HERE ***
If you don't understand or are unsure, you probably want "none"

none, login, cram-md5, or digest-md5 [none]:
login

// select the way of login

Would you like to use other login and password for all SquirrelMail
SMTP connections? [y/N]:
n

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain
: server-linux.info

2. Invert Time
: false

3. Sendmail or SMTP
: SMTP


SMTP Settings
-------------
4. SMTP Server
: mail.server-linux.info

5. SMTP Port
: 25

6. POP before SMTP
: false

7. SMTP Authentication
: login

8. Secure SMTP (TLS)
: false

9. Header encryption key
:


A. Update IMAP Settings
: mail.server-linux.info:143 (other)

H. Hide SMTP Settings

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
r

// back to main menu

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >>
4

// select

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
General Options
1. Data Directory
: /var/lib/squirrelmail/prefs/

2. Attachment Directory
: /var/spool/squirrelmail/attach/

3. Directory Hash Level
: 0

4. Default Left Size
: 150

5. Usernames in Lowercase
: false

6. Allow use of priority
: true

7. Hide SM attributions
: false

8. Allow use of receipts
: true

9. Allow editing of identity
: true

Allow editing of name
: true

Remove username from header
: false

10. Allow server thread sort
: true

11. Allow server-side sorting
: true

12. Allow server charset search
: true

13. Enable UID support
: true

14. PHP session name
: SQMSESSID

15. Location base
:


R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
7

// select

Hide SM attributions (y/n) [n]:
y

// Yes

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
General Options
1. Data Directory
: /var/lib/squirrelmail/prefs/

2. Attachment Directory
: /var/spool/squirrelmail/attach/

3. Directory Hash Level
: 0

4. Default Left Size
: 150

5. Usernames in Lowercase
: false

6. Allow use of priority
: true

7. Hide SM attributions
: true

8. Allow use of receipts
: true

9. Allow editing of identity
: true

Allow editing of name
: true

Remove username from header
: false

10. Allow server thread sort
: true

11. Allow server-side sorting
: true

12. Allow server charset search
: true

13. Enable UID support
: true

14. PHP session name
: SQMSESSID

15. Location base
:


R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
r

// back to main menu

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >>
8

// select

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. delete_move_next
2. squirrelspell
3. newmail

Available Plugins:
4. listcommands
5. filters
6. fortune
7. mail_fetch
8. message_details
9. compatibility
10. calendar
11. translate
12. sent_subfolders
13. empty_trash
14. spamcop
15. bug_report
16. abook_take
17. info
18. secure_login
19. administrator

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
9

// add the plugin(compatibility)

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. delete_move_next
2. squirrelspell
3. newmail
4. compatibility

Available Plugins:
5. listcommands
6. filters
7. fortune
8. mail_fetch
9. message_details
10. calendar
11. translate
12. sent_subfolders
13. empty_trash
14. spamcop
15. bug_report
16. abook_take
17. info
18. secure_login
19. administrator

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
13

// add the plugin(empty_trash)

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. delete_move_next
2. squirrelspell
3. newmail
4. compatibility
5. empty_trash

Available Plugins:
6. listcommands
7. filters
8. fortune
9. mail_fetch
10. message_details
11. calendar
12. translate
13. sent_subfolders
14. spamcop
15. bug_report
16. abook_take
17. info
18. secure_login
19. administrator

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
18

// add the plugin(secure_login)

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. delete_move_next
2. squirrelspell
3. newmail
4. compatibility
5. empty_trash
6. secure_login

Available Plugins:
7. listcommands
8. filters
9. fortune
10. mail_fetch
11. message_details
12. calendar
13. translate
14. sent_subfolders
15. spamcop
16. bug_report
17. abook_take
18. info
19. administrator

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
q

// quit


You have not saved your data.
Save? [Y/n]:
y

// save

Data saved in config.php

Exiting conf.pl.
You might want to test your configuration by browsing to
http://your-squirrelmail-location/src/configtest.php
Happy SquirrelMailing!

[root@www ~]#
cd /usr/share/squirrelmail/plugins/secure_login

[root@www secure_login]#
cp config.php.sample config.php

[root@www secure_login]#
vi config.php


$change_back_to_http_after_login =
0
;
// line 32: change


[root@www secure_login]#
/etc/rc.d/init.d/httpd reload

Reloading httpd: [ OK ]

ccess to 'http://(host name of your server)/webmail/'. The login screen is shown like below, Input user name and password and login.

9/27/2010

Maillog Analyzer

Install maillog analyzer for Postfix because it's more useful than the one from Logwatch.
[1] Set config that let Logwatch not investigate maillog first.


[root@mail ~]#
cd /usr/share/logwatch/default.conf/logfiles

[root@mail logfiles]#
mv maillog.conf maillog.conf.bk

[root@mail logfiles]#
touch maillog.conf

[root@mail logfiles]#
/usr/sbin/logwatch
// run logwatch

Make sure there is no analyzing for maillog in the email from logwatch.

[2] Install analyzer for postfix.


[root@mail ~]#
yum -y install postfix-pflogsumm

Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
base
100% |=========================| 1.1 kB 00:00

updates
100% |=========================|
951 B 00:00

addons
100% |=========================|
951 B 00:00

extras
100% |=========================| 1.1 kB 00:00

Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for postfix-pflogsumm to pack into transaction set.
postfix-pflogsumm-2.3.3-2 100% |========================| 15 kB 00:00
---> Package postfix-pflogsumm.i386 2:2.3.3-2 set to be updated
--> Running transaction check
--> Processing Dependency: perl(Date::Calc) for package: postfix-pflogsumm
--> Processing Dependency: perl-Date-Calc for package: postfix-pflogsumm
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for perl-Date-Calc to pack into transaction set.
perl-Date-Calc-5.4-1.2.2. 100% |=========================| 9.7 kB 00:00
---> Package perl-Date-Calc.x86_64 0:5.4-1.2.2.1 set to be updated
--> Running transaction check
--> Processing Dependency: perl(Bit::Vector) for package: perl-Date-Calc
--> Processing Dependency: perl(Carp::Clan) for package: perl-Date-Calc
--> Processing Dependency: perl-Bit-Vector >= 6.4 for package: perl-Date-Calc
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for perl-Bit-Vector to pack into transaction set.
perl-Bit-Vector-6.4-2.2.2 100% |=========================| 6.9 kB 00:00
---> Package perl-Bit-Vector.x86_64 0:6.4-2.2.2.1 set to be updated
---> Downloading header for perl-Carp-Clan to pack into transaction set.
perl-Carp-Clan-5.3-1.2.1. 100% |=========================| 3.2 kB 00:00
---> Package perl-Carp-Clan.noarch 0:5.3-1.2.1 set to be updated
--> Running transaction check

Dependencies Resolved

================================================== =========
Package
Arch
Version
Repository
Size

================================================== =========
Installing:
postfix-pflogsumm
i386
2:2.3.3-2
base
49 k

Installing for dependencies:
perl-Bit-Vector
i386
6.4-2.2.2.1
base
182 k

perl-Carp-Clan
noarch
5.3-1.2.1
base
22 k

perl-Date-Calc
i386
5.4-1.2.2.1
base
271 k


Transaction Summary
================================================== =========
Install
4 Package(s)

Update
0 Package(s)

Remove
0 Package(s)


Total download size: 524 k
Downloading Packages:
(1/4): perl-Date-Calc-5.4
100% |====================| 271 kB 00:00

(2/4): perl-Bit-Vector-6.
100% |====================| 182 kB 00:00

(3/4): postfix-pflogsumm-
100% |====================|
49 kB 00:00

(4/4): perl-Carp-Clan-5.3
100% |====================|
22 kB 00:00

Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-Carp-Clan
################################# [1/4]


Installing: perl-Date-Calc
################################# [2/4]


Installing: perl-Bit-Vector
################################# [3/4]


Installing: postfix-pflogsumm
################################# [4/4]


Installed: postfix-pflogsumm.i386 2:2.3.3-2
Dependency Installed: perl-Bit-Vector.i386 0:6.4-2.2.2.1 perl-Carp-Clan.noarch 0:5.3-1.2.1 perl-Date-Calc.i386 0:5.4-1.2.2.1
Complete!
// display summary of yesterday's maillogs

[root@mail ~]#
perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog


Postfix log summaries for May 21

Grand Totals
------------
messages


2 received


2 delivered


0 forwarded


0 deferred


0 bounced


2 rejected (50%)


0 reject warnings


0 held


0 discarded (0%)



14379 bytes received


14379 bytes delivered


1 senders


1 sending hosts/domains


2 recipients


1 recipient hosts/domains


Per-Hour Traffic Summary

time
received
delivered
deferred
bounced
rejected


-------------------------------------------------------------------------------------------


0000-0100
0
0
0
0
0


0100-0200
0
0
0
0
0


0200-0300
0
0
0
0
0


0300-0400
0
0
0
0
0


0400-0500
0
0
0
0
0


0500-0600
2
2
0
0
0


0600-0700
0
0
0
0
0


0700-0800
0
0
0
0
0


0800-0900
0
0
0
0
0


0900-1000
0
0
0
0
1


1000-1100
0
0
0
0
0


1100-1200
0
0
0
0
0


1200-1300
0
0
0
0
0


1300-1400
0
0
0
0
0


1400-1500
0
0
0
0
0


1500-1600
0
0
0
0
0


1600-1700
0
0
0
0
1


1700-1800
0
0
0
0
0


1800-1900
0
0
0
0
0


1900-2000
0
0
0
0
0


2000-2100
0
0
0
0
0


2100-2200
0
0
0
0
0


2200-2300
0
0
0
0
0


2300-2400
0
0
0
0
0


Host/Domain Summary: Message Delivery

sent cnt
bytes
defers
avg dly
max dly
host/domain


--------
-------
-------
-------
-------
-----------


2
14379
0
2.1 s
4.1 s
server-linux.info


Host/Domain Summary: Messages Received

msg cnt
bytes
host/domain


--------
-------
-----------


2
14379
server-linux.info


Senders by message count
------------------------

2 root@server-linux.info


Recipients by message count
---------------------------

1 cent@server-linux.info


1 root@server-linux.info


Senders by message size
-----------------------

14379 root@server-linux.info


Recipients by message size
--------------------------

7214 cent@server-linux.info


7165 root@server-linux.info


message deferral detail: none

message bounce detail (by relay): none

message reject detail
---------------------
RCPT

Recipient address rejected: Access denied (total: 2)


1 all9988@gmail.com


1 candy59839@yahoo.com.tw


message reject warning detail: none

message hold detail: none

message discard detail: none

smtp delivery failures: none

Warnings: none

Fatal Errors: none

Panics: none

Master daemon messages: none

[root@mail ~]#
crontab -e


// send summary of maillog at AM 1:00 everyday to root

00 01 * * * perl /usr/sbin/pflogsumm -e -d yesterday /var/log/maillog | mail -s 'Logwatch for Postfix' root