OPS535 – Advanced Network Administration

Mail Box Server Lab POP3 and IMAP Servers Web using squirrelmail

Secure IMAP (Mail Box Server) server for user's remote mail access

CentOS 7.0 rpm package: dovecot

2.2.10-4 CentOS7,0

Web Site: http://www.dovecot.org

Configuration file: /etc/dovecot/dovecot.conf Starting/stopping dovecot use systemctl command - by default starts/stops pop3, pop3s, imap, imaps

Logging: by default log messages send to /var/log/maillog file (syslog option)

Very Useful Command: dovecot -n (display vital information about dovecot)

On CentOS 7.0: [root@mail ~]# dovecot -n # 2.2.10: /etc/dovecot/dovecot.conf # OS: 3.10.0-229.14.1.el7.x86_64 x86_64 CentOS Linux release 7.1.1503 (Core) mbox_write_locks = fcntl namespace inbox { inbox = yes location = Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = } passdb { driver = pam } ssl = required ssl_cert =

On CentOS 5.3: root@localhost ~]# dovecot ­n # 1.0.7: /etc/dovecot.conf login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap­login login_executable(imap): /usr/libexec/dovecot/imap­login login_executable(pop3): /usr/libexec/dovecot/pop3­login mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_plugin_dir(default): /usr/lib64/dovecot/imap mail_plugin_dir(imap): /usr/lib64/dovecot/imap mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3 auth default: passdb: driver: pam userdb: driver: passwd

On Fedora 11: # 1.2.6: /etc/dovecot.conf # OS: Linux 2.6.30.9­90.fc11.x86_64 x86_64 Fedora release 11 (Leonidas) login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap­login login_executable(imap): /usr/libexec/dovecot/imap­login login_executable(pop3): /usr/libexec/dovecot/pop3­login mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_plugin_dir(default): /usr/lib64/dovecot/imap mail_plugin_dir(imap): /usr/lib64/dovecot/imap mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3 lda: postmaster_address: [email protected] auth default: passdb: driver: pam userdb: driver: passwd

Role of Dovecot: ======What is Dovecot? Well, let's follow the path of a typical mail message from start to finish and see where Dovecot would fit. Let begin with someone out in the world creates a mail message in their mail-user-agent [MUA]. Examples of typical MUA's include and Microsoft . Whatever was used, a message was created and sent to that user's mail-transfer-agent [MTA] - using the SMTP protocol. Then that MTA checks the message to determine the recipient (we'll pretend that's YOU), queries its DNS servers to find out the responsible MTA for the recipient's domain, and sends the message to that MTA - again using the SMTP protocol. At this point, the message has traveled from the remote user's workstation, to their ISP's mailserver, and has reached your domain. Now what happens? Depending on the network configuration, it's quite possible that the message will be relayed to yet another MTA. But at some point, one MTA will take responsibility for the message and become responsible for delivery. At this time, the MTA will pass the message to a mail-delivery-agent [MDA]. At its core, an MDA is responsible for actually saving the mail to disk. Some MDA's do other things as well, such as filtering mail or delivering to subfolders. But it is the MDA that stores the mail on the server. Now, it's time to check your mail. Starting up your MUA, you query your mail server using one of the standard protocols: IMAP and POP3. The mail server confirms your identity, then retrieves the list of messages from the mail storage area and returns them to the MUA. You can now read your mail. And the mail server that just handed you that mail was Dovecot. As an IMAP and POP3 server, Dovecot provides a way for mail-user agents [MUA] to access their mail. As such, Dovecot is NOT responsible for receiving mail from other servers. Dovecot presents mail already stored on the system to MUA's. IMAP and POP3 are the two common protocols used by MUA's to communicate with mail storage servers. POP3 is commonly used by users who do not have a high-speed connection to the mail server. One of POP3's basic principles is that MUA's download mail and store it locally - and then delete the mail from the server. IMAP is intended for LAN's and high-speed connections. The intent of IMAP is contact the server each time a given message needs to be read (apart from MUA-specific caching). Dovecot has a number of optimizations for IMAP that make it an exceptionally good performer for most IMAP applications. With the possible, optional, exception of the deliver MDA, Dovecot is not involved with reception, delivery, and storage of mail. That function is provided by a MTA such as postfix. It is the MTA that determines where and how mail is stored - Dovecot must then be configured to retrieve the mail accordingly. Obviously, a working MTA installation is a prerequisite of a working Dovecot installation. There are two primary storage options of mail in the *NIX world - mbox and Maildir. Mbox stores multiple messages - sometimes hundreds or thousands of messages - in a single file. Maildir stores each message a separate file. While there may have been some issues with older filesystems that made mbox reasonable, for most new installations maildir offers a far more robust implementation and all-things- being-equal is the recommended choice. There are other storage options in existence, such as dbmail, however these are unsupported by Dovecot (at least at this time). Again, it bears repeating, Dovecot is not responsible for mail delivery or storage. Any questions on these issues involve your MTA and MDA. Get those working first. Dovecot configuration primarily consists of mail storage type, mail storage location, user list, and password list. Dovecot currently supports a variety of user & password sources, including *NIX passwd, shadow, PAM, LDAP, SQL, and vpopmail. It's usually best to select a source supported by all the parts of your overall mail solution, including your MTA, MDA, and Dovecot.

Installing Web mail server: Squirrelmail yum install epel-release yum install squirrelmail

The squirrelmail rpm contains about 2000 files

Configuration for Squirrelmail (1.4.22-15):

The squirrelmail will run through Apache. For regular http, just start httpd and squirrelmail can be access via http://host-ip/webmail

Check the squirrelmail configuration file in the apache configuration directory: /etc/httpd/conf.d/squirrelmail.conf

To protect user name and password when login to squirrelmail, your should run Apache with https protocol.