Then I configured postfix by editing to postfix configuration files in /etc/postfix to be:
main.cf
# SOFT BOUNCE
#
#soft_bounce = no
# LOCAL PATHNAME INFORMATION
#
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
# QUEUE AND PROCESS OWNERSHIP
#
mail_owner = postfix
#default_privs = nobody
# INTERNET HOST AND DOMAIN NAMES
#
myhostname = minnie.home
mydomain = home
# SENDING MAIL
#
myorigin = $myhostname
# RECEIVING MAIL
inet_interfaces = $myhostname, localhost
#proxy_interfaces =
#proxy_interfaces = 1.2.3.4
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# REJECTING MAIL FOR UNKNOWN LOCAL USERS
#
#local_recipient_maps = proxy:unix

asswd.byname $alias_maps
#local_recipient_maps =
unknown_local_recipient_reject_code = 550
# TRUST AND RELAY CONTROL
#
#mynetworks_style = host
#relay_domains = $mydestination
# INTERNET OR INTRANET
#relayhost = $mydomain
# REJECTING UNKNOWN RELAY USERS
#
#relay_recipient_maps = hash:/etc/postfix/relay_recipients
# INPUT RATE CONTROL
#
#in_flow_delay = 1s
# ALIAS DATABASE
#
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
# ADDRESS EXTENSIONS (e.g., user+foo)
#
#recipient_delimiter = +
# DELIVERY TO MAILBOX
#
#home_mailbox = Mailbox
mail_spool_directory = /var/spool/mail
# JUNK MAIL CONTROLS
#
#header_checks = regexp:/etc/postfix/header_checks
# FAST ETRN SERVICE
#
#fast_flush_domains = $relay_domains
# SHOW SOFTWARE VERSION OR NOT
#
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
# PARALLEL DELIVERY TO THE SAME DESTINATION
#
# How many parallel deliveries to the same user or domain? With local
#default_destination_concurrency_limit = 20
# DEBUGGING CONTROL
#
debug_peer_level = 2
#debug_peer_list = 127.0.0.1
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
# INSTALL-TIME CONFIGURATION INFORMATION
#
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
#content_filter = smtp-amavis:[127.0.0.1]:10024
and master.cf:
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
smtp inet n - n - - smtpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
-o fallback_relay=
showq unix n - n - - showq
error unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
old-cyrus unix - n n - - pipe
flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user}
cyrus unix - n n - - pipe
user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user}
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
smtp-amavis unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
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_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_retrictions=permit_mynetworks,reje ct
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o mynetworks=127.0.0.0/8
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_ unknown_recipient_checks
Now we need to configure the system to use postfix rather than sendmail, so select the sendmail.postfix option using:
$ alternatives --config mta
And now stop the sendmail service (to avoid confusion) and start the postfix and dovecot services and test the postfix configuration
$ service sendmail stop
$ service postfix start
$ service dovecot start
$ postfix check
$ echo hello | mail root
$ echo hello | mail ~non-root-user~
The "postfix check" command hopefully will return no errors (i.e nothing at all), and you can check for mail delivery simply by using the "mail" command.
Now for SquirrelMail. All you have to do is to enable world write permission for the user home directories and start the apache server with:
$ chmod 777 /home
$ service httpd start
and that's done. Test this by running your favourite browser and typing "http://localhost/webmail/". That should get you the SquirrelMail login page. Just login as your non-root user and check that you have a message (from above).
To clean up this section edit the services configuration to start postfix, dovecot and httpd on system startup and then reboot and retest.
So now we have a working mail server.The only problem is that we are not checking for spam and virii. So let's do that now. First of all we will configure amavisd-new. All this takes is a quick edit to the /etc/amavisd/amavisd.conf file to set the lines
$mydomain = 'home';
$myhostname = 'minnie.home';
to their appropriate values. We also need to configure freshclam (the clamav update program) to automatically update the virus definition files. This we do by commenting out the line
FRESHCLAM_DELAY=disabled-warn # REMOVE ME
in the file /etc/sysconfig/freshclam. Also /etc/freshclam.conf needs to have the line
Example
commented out. The final step is to edit the last line in /etc/postfix/main.cf to remove the comment # and enable content filtering. This line is now:
content_filter = smtp-amavis:[127.0.0.1]:10024
and restart postfix. The Spamassassin configuration file should become:
# These values can be overridden by editing ~/.spamassassin/user_prefs.cf
# (see spamassassin(1) for details)
# These should be safe assumptions and allow for simple visual sifting
# without risking lost emails.
required_hits 5
report_safe 1
use_bayes 1
bayes_auto_learn 1
skip_rbl_checks 0
use_razor2 1
use_dcc 1
use_pyzor 1
whitelist_from *@example.com
rewrite_header Subject [SPAM]
Finally start the requisite services (amavisd, clamd.amavisd)and edit crontab to run freshclam hourly. Now you are good to go.
Good luck!!!!