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.
The reason for this (described in the previous lab) was that you will be able to send email out of your network, and receive email from within your network, but you will '''<u>not</u>''' receive email from outside of your network due to the following reasons::* Individuals outside of your domain will never find the MX records because there are no '''.org''' servers pointing to your DNS server (i.e. you haven't paid for it).:* Even if the individuals could read your MX records, your local network is using IP addresses on a '''private subnet''', which is not routeable on the Internet, so it cannot be reached from outside of your system. 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 ==
=== Assigning Responsibility Specifying Which Domains are Used to Delivered the "Received" Mail Messages===
The default job of an '''SMTP ''' server is to forward the message recieved received to another email server. That's what we've set up We performed that step in the previous lab: in other words, your postfix MTA receives an email from your client MUA (Thunderbird) and forwards it to the destination '''SMTP ''' server. The other thing an SMTP server can be configured to do is receive email. It still uses SMTP but instead of forwarding it to another SMTP server it will forward it to the Local Delivery Agent (LDA).
The other thing an SMTP server can be configured to do is receive email. Your SMTP server, in this case, forwards the received mail message to <u>another</u> SMTP server, which in turn, forwards it to the Local Delivery Agent (LDA). 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 steps on VM 3: #Edit your the '''/etc/postfix/main.cf ''' file and scroll .#Scroll down to (or search for) the line containing: '''mydestination'''. Set it up and change line to look like thisthe text shown below:
<pre>mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost</pre>
#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>
<ol><li value="4">Finally, edit the '''/etc/dovecot/conf.d/10-mail.conf ''' file and set indicated where you want your mail delivered:by including the following line</li></ol>
<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?