Difference between revisions of "Configuring basic SMTP, IMAP, POP and HTTP access for complete email on a single server"
m |
m |
||
Line 87: | Line 87: | ||
# Go to /usr/share/squirrelmail/config | # Go to /usr/share/squirrelmail/config | ||
# Again run ./conf.pl and enable both plugins (Compatability plugin must load before change_password plugin. Edit /etc/squirrelmail/config.php by hand if that is not the case) | # Again run ./conf.pl and enable both plugins (Compatability plugin must load before change_password plugin. Edit /etc/squirrelmail/config.php by hand if that is not the case) | ||
Line 99: | Line 100: | ||
==Add swap in case of AWS== | |||
In rare cases the RAM requirement might go beyond RAM available in VM. In such cases swap would be necessary. Swap can be created and enabled using: | |||
# Create swap file of 1GB | |||
#:<pre> | |||
#:: dd if=/dev/zero of=/swap bs=1024000 count=1024 | |||
#:: chown root:root /swap | |||
#:: chmod 600 /swap | |||
#:: mkswap /swap | |||
#:</pre> | |||
# Append in /etc/fstab | |||
#:<pre> | |||
#:: /swap none swap defaults 0 0 | |||
#:</pre> | |||
# Enable swap using | |||
#:<pre> | |||
#:: mount -a | |||
#:: swapon -a | |||
#:: free -m | |||
#:</pre> | |||
==Migrating email server== | |||
For migrating email server setup this way refer to [[Migrating mail server from one machine to another]] | For migrating email server setup this way refer to [[Migrating mail server from one machine to another]] | ||
<yambe:breadcrumb>Email_server_configuration|Email server configuration</yambe:breadcrumb> | <yambe:breadcrumb>Email_server_configuration|Email server configuration</yambe:breadcrumb> |
Revision as of 02:32, 25 April 2016
<yambe:breadcrumb>Email_server_configuration|Email server configuration</yambe:breadcrumb>
Configuring basic SMTP, IMAP, POP and HTTP access for complete email on a single server
In case of a completely new domain, one can create an account on AWS and use micro instance for testing configuration. A domain name can also be purchased
AWS Account creation and DNS entries
- Create a dedicated amazon account
- Create CentOS micro instance with public IP
- Take an elastic IP and associate with VM
- Ensure that security group of VM allows SSH, HTTP, HTTPS, IMAP, IMAPS, SMTP, STMPS, POP3, POP3S and ICMP
- Register domain name through registrar such as godaddy
- Update DNS entries for domain, www, mail, MX record to point to elastic IP of the VM
Configure web server
- yum -y install httpd mod_ssl
- service httpd start
- Edit iptables to allow incoming connections to port 80, 443
- service iptables restart
- Put test file in /var/www/html
- Open domain in browser to verify that website is accessible. (Wait at least 3-4 minutes after updating DNS entries to avoid getting wrong values cached in near-by DNS)
- chkconfig httpd on
- Edit /etc/httpd/conf/httpd.conf and update 'Listen 80' to 'Listen 0.0.0.0:80'
Create users
- useradd saurabh
- passwd saurabh
Similarly more users can be created
Setup postfix SMTP server
- Edit '/etc/postfix/main.cf' as follows:
- Set myhostname=mail.sbarjatiya.com
- Set mydomain=sbarjatiya.com
- Set myorigin=$mydomain
- Set inet_interfaces=all (Comment inet_interfaces=localhost)
- Prepend $mydomain to mydestination value (Without this only @mail.domain.com mails would get accepted. After this change @domain.com would also work)
- service postfix restart
- Edit /etc/sysconfig/network and set correct hostname.
- Edit /etc/hosts and correct hostname
- hostname mail.sbarjatiya.com
- Allow incoming connections to port 25 and 465
Also refer to Postfix SMTP authentication using dovecot
Setup dovecot
- yum -y install dovecot
- Edit /etc/postfix/main.cf and set 'home_mailbox = mail/'
- service postfix restart
- Edit /etc/dovecot/conf.d/10-mail.conf and set 'mail_location = maildir:~/mail'
- service dovecot start
- Allow incoming connections to ports 110,143,993,995
- chkconfig dovecot on
Setup squirrelmail
- yum -y install wget
- Setup rpmfusion, repoforge and epel
- yum -y install squirrelmail
- cd /usr/share/squirrelmail/config and run './conf.pl'
- Set Organization Preferences -> Organization name
- Set Server Settings -> Domain
- Set Server Settings -> IMAP Settings. Use values mail.sbarjatiya.com, 993, Secure (IMAP): true, Server software: dovecot
- Setup mail sending using sendmail and not through SMTP
- Open <domain>/webmail in browser
- setenforce 0
- edit /etc/sysconfig/selinux and set SELINUX=disabled
Note that user must login into squirrelmail interface once before he/she can receive email. This is required for creating necessary folders in home folder.
Squirrelamil change password support
- Download change_passwd and compatability (Version 1.3) plugins from
- cd /usr/share/squirrelmail/plugins
- Extract both .tar.gz file here
- For change_passwd read INSTALL file and perform necessary steps
- cp config.php.sample config.php
- yum -y install gcc
- gcc -lcrypt -O -o chpasswd chpasswd.c
- chown root:apache chpasswd
- chmod 4750 chpasswd
- Go to /usr/share/squirrelmail/config
- Again run ./conf.pl and enable both plugins (Compatability plugin must load before change_password plugin. Edit /etc/squirrelmail/config.php by hand if that is not the case)
Troubleshooting change password support
Squirrelmail change password support requires use of md5 salted hash and does not supports sha256 or sha512. In case machine is configured to use only sha256 hash for password then the plugin will not work and will always report old password as incorrect. To resolve this use following steps:
- Edit /etc/libuser.conf and set 'crypt_style md5'
- yum -y install authconfig
- Edit /etc/sysconfig/authconfig and set 'PASSWDALGORITHM=md5'. The same can also be achived by running 'authconfig-tui' and enabling use of md5 for passwords.
- Test by going to /usr/share/squirrelmail/plugins/change_passwd folder and by running command 'sudo ./chpasswd <username> <old_password> <new_password>'. If this fails then changing through browser will also fail as the browser plugin calls this script to change password.
Add swap in case of AWS
In rare cases the RAM requirement might go beyond RAM available in VM. In such cases swap would be necessary. Swap can be created and enabled using:
- Create swap file of 1GB
- dd if=/dev/zero of=/swap bs=1024000 count=1024
- chown root:root /swap
- chmod 600 /swap
- mkswap /swap
- Append in /etc/fstab
- /swap none swap defaults 0 0
- Enable swap using
- mount -a
- swapon -a
- free -m
Migrating email server
For migrating email server setup this way refer to Migrating mail server from one machine to another
<yambe:breadcrumb>Email_server_configuration|Email server configuration</yambe:breadcrumb>