13,420
edits
Changes
no edit summary
Online References:
* [https://help.ubuntu.com/community/Dovecot Dovecot Community Documentation]* [https://www.debian-administration.org/article/275/Setting_up_an_IMAP_server_with_dovecot Setting up an IMAP Server with Dovecot]
This week, we will set up a '''Postfix''' demonstration for <u>receiving</u> email on your '''VM3''' machine.
You may ask yourself, ''"why not install on VM2 machine, since we used the VM2 machine in the previous lab?"''. The reason for this approach is to separate the two types of services: '''IMAP''' vs '''POP3'''.
In this lab, we will begin by using the existing '''Postfix''' service on your '''VM3''' machine, then add an Local Delivery Agent ('''LDA''') by installing the '''dovecot-lda''' package on VM3, configure it, and test it to make sure that is is working correctly. Finally, we will set up an '''IMAP''' server (Dovecot) on VM3, so you can read your email from an MUA such as ''Thunderbird'' or a ''Webmail'' (we will set up a webmail application in a later lab).
== INVESTIGATION 1: SETTING UP MTA FOR RECEIVING EMAIL ==
=== Specifying Which Domains are Used to Delivered the "Received" Mail Messages===
This is done using postfix by setting the '''mydestination''' parameter (configuration variable) to include '''$mydomain''' (this is assuming you've set up '''mydomain''', '''myorigin''' , and '''inet_interfaces''' the same way as in the previous lab).
Perform the following stepson VM 3:
#Edit the '''/etc/postfix/main.cf''' file.
:'''Note:''' Even though your machine's name is ''vm2.yoursenecaid.org'', your postfix MTA will also receive emails addressed to the domain called: yoursenecaid.org
=== Installing and Configuring the Local Delivery Agent (LDA ) ===
Postfix is capable of performing the function of an LDA , but it has its LDA capabilities are limited configurability, and thus postfix is generally not used for that purpose. Currently , the most popular LDA is ''LMTP '', but wewill be installing, configuring, and using an LDA called ''ll use dovecot-lda because 'Dovecot''' since it's is also pretty popular and we'll will later be setting up Dovecot as an '''IMAP ''' server. Using the two as a pair both Postfix and Dovecot will actually increase the performance of your our IMAP server.
'''Perform the following steps:''' #Dovecot is not installed when you installed your Virtual machines in previous labs.#Install the Dovecot application by issuing the following command:<br>yum install dovecot#Edit your /etc/postfix/main.cf file and scroll down to (or search for) '''mailbox_command'''. Add the following line:
<pre>mailbox_command = /usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"</pre>
<pre>mail_location = maildir:~/Maildir</pre>
<ol><li value="3">We still haven't set up IMAP (for reading email) but we can test that the message is being delivered. Use the new account in Thunderbird to send an email to '''firstname@yoursenecaid.org''' and then check the contents of '''/home/firstname/Maildir/new/''' on your '''vm3''' machine. There should be a file there with the contents of your email.</li><li>If you got it - this there is a good time no file, then check the log file '''/var/log/maillog''' to stop and ponder how it all workedsee what went wrong. You</li><li>If you can see a file in the 've gone through setting ''/home/firstname/Maildir/new/''' directory, then review the procedures on how you got the email server working (since you have performed many steps and set up a lot of many services). Look at </li><li>Refer to the diagram at the top of the page - which this lab. Which services have you currently set up?Record your findings in your lab Logbook.</li></ol>
Finally, we will set up the IMAP server so we can read email. The configuration file current way we have configured our mail server on our VM3 machine should allow all the email for the anyaccount@yoursenecaid.org should be delivered to our '''vm3''' machine. We will set up Dovecot service (which is not with IMAP, IMAPS in the same thing as dovecot-ldanext lab) is /etc/dovecot/dovecotto get easy access to that email.conf
#The configuration file for the Dovecot service (which is not the same thing as dovecot-lda) is: '''/etc/dovecot/dovecot.conf'''. Modify the '''protocols''' option so that Dovecot will work with IMAP connections, no POP3 or LMTP.# Start the dovecot service, and ensure it will always start automatically when the machine boots.# Use the '''netstat ''' command to confirm the service is listening, and use telnet on the host to confirm you can connect to it.#If you can connect - it's now time to do something wrong, that is connect to our IMAP server using Thunderbird over an unencrypted connection.# Edit the '''/etc/dovecot/conf.d/10-auth.conf''' file and set '''disable_plaintext_auth''' to '''no'''.# Then edit the '''/etc/dovecot/conf.d/10-ssl.conf''' file and set '''ssl''' to '''yes'''.<br><br>'''Note:''' This combination of parameters will allow your username and password to be sent over the internet in plain text, for anyone interested to look at. In the following lab we'll set up secure SMTP and IMAP connections, for now this is all we have time for.<br><br># Restart dovecot so the changes take effect.#Try to connect to your IMAP server with Thunderbird by clicking on your '''Inbox'''.#If nothing happens, then check the Thunderbird Activity Manager for any errors. If the connection is successful, you should see the '''Trash''' box <u>appear</u> below Inbox.# Finally, send an email message from '''yoursenecaid@yoursenecaid.org''' to '''yoursenecaid@yoursenecaid.org''' using the Thunderbird application. The mail message should be sent without errors, and you should notice a '''Sent''' folder appear in the list. If all worked well, you should see your message arrive in the '''Inbox''' and you know that your configuration works correctly.
== COMPLETING THE LAB ==
==EXPLORATION QUESTIONS==
#What is the purpose of the '''Dovecot''' package?# What is the purpose of the '''mydestination''' parameter contained in the '''/etc/postfix/main.cf''' file?# Why are '''IMAP''' and '''POP''' email servers placed on separate machines (vms)?# What is the purpose of the '''mail_location''' parameter contained in the '''/etc/dovecot/conf.d/10-mail.conf''' file?