Open main menu

CDOT Wiki β

Changes

OPS335 Lab 4c

3,207 bytes added, 14:35, 6 April 2016
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'''.
We 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 begin by using the existing '''Postfix<u>not</u>''' service on 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 '''VM3.org''' machine, then add an Local Delivery Agent servers pointing to your DNS server (i.e. you haven'''LDA'''t paid for it) by installing .:* Even if the individuals could read your MX records, your local network is using IP addresses on a '''dovecot-ldaprivate subnet''' package, configure which is not routeable on the Internet, so it, and test ti to make sure that is is working correctlycannot 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 ==
=== 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.
=== Installing and Configuring the Local Delivery Agent (LDA) ===
Postfix is capable of performing the function of an LDA, but its LDA capabilities are limited, thus postfix is generally not used for that purpose. Currently, the most popular LDA is ''LMTP'', but we will be installing, configuring , and using an LDA called '''Dovecot''' since it is also popular and we will later be setting up Dovecot as an '''IMAP''' server. Using both Postfix and Dovecot will actually increase the performance of our IMAP server.
'''Perform the following steps:'''
#Dovecott Dovecot is not installed when you installed your Virtual machines in previous labs.#Install the Dovecott Dovecot application by issuing the following command:<br>yum install dovecot-lda
#Edit your /etc/postfix/main.cf file and scroll down to (or search for) '''mailbox_command'''. Add the following line:
<pre>mail_location = maildir:~/Maildir</pre>
<ol><li value="5">Restart your postfix service. Note that dovecot-lda is just a program invoked by Postfix, it doesn't have an associated service.</li></ol>
=== Test Sending a Mail Message from VM2 (Using Thunderbird)===
First use netstat {{Admon/important |Sent messages will not be saved to the sent folder|During this step the messages you send will not be saved to the sent folder and telnet to confirm your service Thunderbird will permanently hang with a message that it is listening on saving the correct ports/interfacesmessage. You It will probably never succeed, as we have not yet configured the imap server to open accept the appropriate firewall port on vm3 connection necessary for that to allow incoming SMTP connectionswork.}}
If all worked so far - you should be able to send email to any regular user on vm3 using '''Perform the email address yourusername@yoursenecaid.org using Thunderbird on vm2.following steps:'''
Create a new account #Use the '''netstat''' and '''telnet''' commands (like you did in lab 4b) to confirm your service is listening on the correct ports/interfaces. You will probably have to open the appropriate firewall port on '''vm3 using only your first name''' to allow incoming '''SMTP''' connections. We<br><br>'ll use this one time for testing receiving ''Note:''' You should be able to send email to any regular user <u>on</u> '''vm3''' using the emailaddress '''yourusername@yoursenecaid. Itorg''s rather important that you don't create this using the Thunderbird application on your host machine (which is configured to use the account on your vm2 - so that you continue to see the difference between the sending and receiving SMTP servers).<br><br>
<ol><li value="2">Create a new account on your '''vm3''' machine using only your <u>first</u> name. We still haven't set up IMAP (for reading email) but we can will use this account as a one-time "test that " if the mail message has been received on your VM3 machine (from your VM2 machine).<br><br>'''Note:''' It is being delivered. Use the new <u>'''important'''</u> that you '''<u>don't</u>''' create this same account in Thunderbird name on your vm2 machine, since you want to send an email to firstname@yoursenecaideasily identify the difference between the sending and receiving SMTP servers.org and then check the contents of /home/firstname/Maildir<br><br></newli></ on vm3. - there should be a file there with the contents of your email.ol>
<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 there isn't one - is no file, then check the log file '''/var/log/maillog ''' to see what went wrong.</li><li>If you can see a file in the '''/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 many services).</li><li>Refer to the diagram at the top of this lab. Which services have you currently set up? Record your findings in your lab Logbook.</li></ol>
{{Admon/important |Encountering error messages when sending email|If you got it cannot properly receive sent e- this is a good time to stop and ponder how it all workedmail messages, check the '''/var/log/syslog''' file for errors. You<br><br> If you locate an error message in that file such as: 've gone through setting up a lot of services''Fatal: Error reading configuration: Invalid settings. Look at ..''', then add the diagram following <u>parameter</u> in '''/etc/dovecot/dovecot.conf''':<br>'''postmaster_address at the top of the page - which services DOMAIN''' (where DOMAIN is actually <u>your</u> domain).<br><br>After you have you set up?saved those changes, then '''restart''' your dovecot service.}}
== INVESTIGATION 2: READING EMAIL MESSAGES = Viewing Received Mail Message on VM3 VIA IMAP (Using Thunderbird) ===
Finally , we'll will set up the IMAP server so we can read email. The current way we've set it up - have configured our mail server on our VM3 machine should allow all the email for anyaccount@yoursenecaid.org should end up on be delivered to our '''vm3''' machine. We will set up Dovecot (with IMAP, IMAPS in a later the next lab) to get easy access to that email.
The configuration file for the Dovecot service (which is not the same thing as dovecot-lda) is /etc/dovecot/dovecot.conf Modify the '''protocolsPerform the following steps:''' option so that Dovecot will work with IMAP connections, no POP3 or LMTP.
#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.
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 /etc/dovecot/conf.d/10-auth.conf and set '''disable_plaintext_auth''' to '''no'''. Then edit /etc/dovecot/conf.d/10-ssl.conf and set '''ssl''' to '''yes'''. 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.
To try connect to '''Record steps, commands, and your IMAP server with Thunderbird - click on observations in this INVESTIGATION in your Inbox. If nothing seems to happen - check the Thunderbird Activity Manager for any errors. If the connection is successful OPS335 lab log- you should see a Trash show up below Inbox.book'''
Finally - send an email from yoursenecaid@yoursenecaid.org to yoursenecaid@yoursenecaid.org using Thunderbird. The message should go out without errors, you should see a Sent folder appear in the list, and you should see your message arrive in the inbox. If all that happend - your setup is correct.
== 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?
13,420
edits