Mail Server Configuration Details on Linux
# fdisk -l
# mount -t vfat /dev/sdb1 /mnt/
==============================
MAIL Server
==============================
# vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.50
netmask 255.255.255.0
gateway 192.168.1.1
:x!
# vi /etc/resolv.conf
nameserver 202.84.32.22
nameserver 202.84.33.20
# /etc/init.d/networking restart
# vi /etc/apt/sources.list
Source List:
deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main
deb http://cdn.debian.net/debian/ stable main contrib
deb http://security.debian.org/ stable/updates main
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
deb http://cdn.debian.net/debian/ squeeze-updates main
deb-src http://cdn.debian.net/debian/ squeeze-updates main
# apt-get update
# apt-get install vim telnet traceroute iftop iptraf gcc g++ cpp libgmp3-dev zip file tnef make patch zlib1g-dev
# apt-get install postfix
Internet with Smarthost
# vim /etc/postfix/main.cf
myhostname = mail.example.com
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
myorigin = daytexbd.com
mydestination = mail.example.com, mail, localhost.localdomain, localhost, hash:/etc/postfix/transport
#relayhost =
mynetworks = 127.0.0.0/8, 192.168.1.0/24, 202.84.40.5/32
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
transport_maps = hash:/etc/postfix/transport
# touch /etc/postfix/aliases
# postalias /etc/postfix/aliases
# vim /etc/postfix/transport
example.com local:
.example.com local:
# postmap /etc/postfix/transport
# /etc/init.d/postfix restart
# apt-get install dovecot-imapd dovecot-pop3d dovecot-common
# vim /etc/dovecot/dovecot.conf
protocols = imap imaps pop3 pop3s
ssl_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
disable_plaintext_auth = no
pop3_uidl_format = %08Xu%08Xv
mail_location = mbox:~/mail:INBOX=/var/mail/%u
# /etc/init.d/dovecot restart
# adduser omar
—————–
testing postfix
—————–
C:>telnet 192.168.1.1 25
220 mail.example.com ESMTP Postfix (Debian/GNU)
ehlo 192.168.1.1
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<omar@example.com>
rcpt to:<omar@example.com>
data
Its working!
.
quit
221 2.0.0 Bye
—————–
testing dovecot
—————–
C:>telnet 192.168.1.1 110
+OK Dovecot ready.
user bolcorp
+OK
pass b0lc0rp
+OK Logged in.
list
+OK 0 messages:
.
quit
+OK Logging out.
———————-
SASL Auth with smtps
———————-
# vim /etc/postfix/master.cf
#smtp inet n – – – – smtpd
smtps inet n – – – – smtpd
-o smtpd_sasl_auth_enable=yes
# vim /etc/postfix/main.cf
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
broken_sasl_auth_clients = yes
smtpd_sender_restrictions = permit_sasl_authenticated
smtpd_sasl_local_domain = example.com
smtpd_sasl_security_options = noanonymous
smtpd_helo_required = yes
smtpd_sasl_authenticated_header = yes
# vim /etc/dovecot/dovecot.conf
auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
——————————————–
Openwebmail Installation and Configuration
——————————————–
# apt-get install apache2
# wget http://www.openwebmail.org/openwebmail/download/current/openwebmail-current.tar.gz
# tar -zxvf openwebmail-current.tar.gz
# cp -R cgi-bin/openwebmail /usr/lib/cgi-bin/
# cd data/
# mv openwebmail /var/www
# vim /usr/lib/cgi-bin/openwebmail/etc/openwebmail.conf
domainnames example.com
auth_module auth_unix.pl
mailspooldir /var/mail
ow_cgidir /usr/lib/cgi-bin/openwebmail
ow_cgiurl /cgi-bin/openwebmail
ow_htmldir /var/www/openwebmail
ow_htmlurl /openwebmail
logfile /var/log/openwebmail.log
# vim /usr/lib/cgi-bin/openwebmail/etc/defaults/auth_unix.conf
passwdfile_encrypted /etc/shadow
passwdmkdb none
# vim /usr/lib/cgi-bin/openwebmail/etc/defaults/dbm.conf
dbm_ext .pag
dbmopen_ext none
dbmopen_haslock no
# apt-get install perl-suid libhtml-template-perl
# cd /usr/lib/cgi-bin/openwebmail
# chmod 4555 *.pl
# cd /var/www
# chown -R www-data:www-data openwebmail
# cd /usr/lib/cgi-bin/openwebmail/etc/
# chmod 777 sessions
# cd /usr/lib/cgi-bin/openwebmail
# ./openwebmail-tool.pl –init
# cd /var/www/openwebmail
# cp redirect.html index.html
Installation is complete. Now type this address to login to the web page.
http://***.***.***.***/openwebmail/
To get the webmail page in root web page
# cp /var/www/openwebmail/redirect.html /var/www/index.html
———————————————
Squirrelmail Installation and Configuration
———————————————
# apt-get install apache2
# wget http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fprdownloads.sourceforge.net%2Fsquirrelmail%2Fsquirrelmail-webmail-1.4.22.tar.gz
# mv countdl.ph……………..mail%2Fsquirrelmail-webmail-1.4.22.tar.gz squirrelmail-webmail-1.4.22.tar.gz
# tar -zxvf squirrelmail-webmail-1.4.22.tar.gz
# mkdir /var/www/webmail
# cd squirrelmail-webmail-1.4.22/
# cp -R * /var/www/webmail/
# cd /var/www/webmail/
# ./configure
***change the settings as you like***
***Change data and attach location in option 4 as follows***
/var/spool/squirrelmail/data/
/var/spool/squirrelmail/attach/
# mkdir /var/spool/squirrelmail
# mkdir /var/spool/squirrelmail/data
# mkdir /var/spool/squirrelmail/attach
# chown www-data:www-data /var/spool/squirrelmail/data/
# chown www-data:www-data /var/spool/squirrelmail/attach/
# apt-get install libapache2-mod-php5
# cd /var/www/
# mv index.html index.html.orig
# vim index.html
Auto-Redirect Page for Webmail
# cd
# wget http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fchange_pass-3.1-1.4.0.tar.gz
# mv countdl.php?fileurl=http:%2F%2Fwww.squirrelmail.org%2Fplugins%2Fchange_pass-3.1-1.4.0.tar.gz change_pass-3.1-1.4.0.tar.gz
# tar -zxvf change_pass-3.1-1.4.0.tar.gz
# cp -R change_pass/ /var/www/webmail/plugins/
# cd /var/www/webmail/
# ./configure
***Enable Change_Pass in option 8***
# apt-get install poppassd