1,234
edits
Changes
→INVESTIGATION 1: INSTALL THUNDERBIRD (MUA) and SETUP A REFERENCE CLIENT
== OVERVIEW==
In Lab 4a, you configured and ran the '''Postfix''' application for our MTA (a.k.a. SMTP server) on your '''vm2''' and '''vm3''' machines. That setup has some major drawbacks:
:* It required an SMTP server ('''MTA''') to be configured on each machine.
:* The Message Store ('''MS''') would also be unique to each machine - what a user received on one server would not exist on any other.
===Online References===
* [https://help.ubuntu.com/community/Dovecot Dovecot Community Documentation]
* [http://wiki.dovecot.org/LDA Dovecot-lda]
* [http://wiki.dovecot.org/LDA/Postfix Configuring dovecot-lda with postfix]
== INVESTIGATION 1: INSTALL THUNDERBIRD (MUA) and SETUP A REFERENCE CLIENT==
Although we will be eventually setting up the Thunderbird application to perform all the mail operations discussed above, you need to learn to '''"walk before you can run"'''. Eventually, you are going to set up all those mail services, but to begin with, you will set up an email client to connect to a (hopefully) an already working server - which is the '''Seneca email server'''. This will be a good exercise with an Once we learn how to do this for our Seneca email clientaccount, then we can use it for our mail servers for our VM2 and VM3.
'''Perform the following steps:'''
#Switch to your '''host''' machine, and install the '''Thunderbird''' email application.
#When you see first launch the Thunderbird application, a configuration dialog box, configure it in a similar way (''using your own information'') should appear as shown in the diagram below: [[Image:Seneca-student-thunderbird-email-setup.png|600px]]
<br>::Notice that there are [[Image:Seneca-student-thunderbird-email-setup.png|600px]]<br><uol>unencrypted</uli value="3"> options available Use the data in the table below to connect to your SMTP/IMAP servers but those are rarely used these days - configure the potential Thunderbird settings dialog box for abuse is too great. On a free wifi network, the operator would be able to not only read your email, but also obtain your password without any passwordYOUR Seneca e-mail account:</li></encryption cracking tools. In fact, even on a private wired network, it is not uncommon for an employer to use a packet sniffer utility to monitor all the traffic going over their network (Packet Sniffing applications were actually found to be legally acceptable practices if used by the management of organizations).ol>
{| class="wikitable" border="1" style="margin-left:40px;"! Setting !! '''Incoming:The specific IMAP''' !! '''Outgoing: SMTP'''|-| '''Username'''|| yoursenecauserid@myseneca.ca || yoursenecauserid@myseneca.ca|-| '''servername''' || outlook.office365.com || outlook.office365.com|-| '''port''' || 993 || 587|-| '''security settings depend on how your servers were configured. '''The settings for the seneca servers are displayed below|| SSL/TLS || STARTTLS|-| '''References''' | colspan="2" | [1] [https://employees.senecacollege.ca/spaces/77/it-services/wiki/view/2394/other-email-clients ITS - Configuring other Email Clients]|}
::* Mozilla Setup HOWTO:::[https://ssgoku129.wordpress.com/2012/11/29/how-to-setup-seneca-learnid-myseneca-ca-with-email-clients-and-devices/ How-to setup Seneca LearnID @myseneca.ca with Email Clients]<br>(Note that your username is your full email address)(<em>firstname.lastnameyourid@senecaretireesmyseneca.ca</em>) and not just <em>firstname.lastnameyourid</em>.</p>
{{Admon/important |Unencrypted Options|Notice that there are <u>unencrypted</u> options available to connect to your SMTP/IMAP servers but those are rarely used these days - the potential for abuse is too great. On a free wifi network, the operator would be able to not only read your email, but also obtain your password without any password/encryption cracking tools. In fact, even on a private wired network, it is not uncommon for an employer to use a packet sniffer utility to monitor all the traffic going over their network (Packet Sniffing applications were actually found to be legally acceptable practice if used by the management of organizations)}}
<br>
<ol><li value="3">After you create your '''Thunderbird''' account, you should be able to read your existing email and send new email within the Thunderbird application.</li><li>Take time to view your ''Account Settings'' and ''Preferences'' to get a feel for what settings exist. For example:<ul><li>How often will Thunderbird check for new messages?</li><li>Will the messages you write be in HTML or plain text?</li><li>How do you change your SMTP server settings? Why are they in a different section?</li></ul></li><li>The main objective of this section was to learn how to setup your Thunderbird application to read your Seneca email, so in the next section you can use the exact type of setup for your own email server.</li></ol>
'''Record steps, commands, and your observations in INVESTIGATION 1 in your OPS335 lab log-book'''
== INVESTIGATION 2: SETUP A CENTRALIZED MESSAGE STORE ==
== INVESTIGATION 2: SETTING UP = Setup Your MTA FOR RECEIVING EMAIL to Use Correct Domain===
#Edit Issue the '''mail''' command to view the email messages you sent between your '''vm2''' and '''vm3''' in your lab 4a. Notice that each is addressed from root on whichever machine sent it.# On both machines (vm2 and vm3), edit the '''/etc/postfix/main.cf''' fileto change the '''myorigin''' parameter from '''$myhostname''' to '''$mydomain'''. Restart the '''postfix''' service.#Scroll down to Now, send emails messages (via the line containing: '''mydestinationmail''' command) between both of your vm2 and change line to vm3 machines, and view the mail messages by issuing '''mail''' in each vm. The sender address should now read that the text shown below:received mail messages came from '''root@yourdomain.ops'''.
::The next step is to configure what addresses that the server will receive email for. This is done using postfix by setting the '''Note:mydestination''' parameter (configuration variable) to include '''$mydomain'' Even though your machine's name (this is assuming you've set up '''mydomain''', '''myorigin'vm3.yoursenecaid.org'', your postfix MTA will also receive emails addressed to the domain called: yoursenecaidand '''inet_interfaces''' properly).org
<ol><li value="5">Add an '''MX''' record to the forward lookup zone on '''host''' so that all incoming mail addressed to the domain is sent to your vm3.</li><li>Restart the service and use the '''dig''' command to confirm that it works.</li><li>Send an email from your '''vm2 ''' to '''root@yourdomain.org. ops'''</li><li>Confirm that it arrives on your '''vm3.''' machine</li></ol>
=== Relaying Relay Email Through Another Server===
When email is sent from either vm, it is addressed from the domain, but receiving MTAs might query why mail sent from vm2 doesn't match the address of the MX record for the domain. This would be a red-flag for potential spam. To avoid this, we can relay all mail sent from vm2 (or any other machine in our network) through vm3 so that it properly appears to come from the mail server that matches the MX record for the domain.
All mail is now being delivered to a centralized location (and also appears to be coming from that same location), but a user would still have to access that server to retrieve it.
=== Installing Install and Configuring Configure the Local Delivery Agent (LDA/MDA) ===
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''' serverlater in this lab. Using both Postfix and Dovecot will actually increase the performance of our IMAP server.
'''Perform the following steps on vm3:'''
#Move to your '''vm3''' machine.#Dovecot is not installed when you installed your Virtual machines in previous labs.#<br>Install the Dovecot application by issuing the following command:<br><source>yum install dovecot</source>#Edit your '''/etc/postfix/main.cf ''' file and scroll down to (or search for) '''mailbox_command'''. Add the following line:<br><source>mailbox_command = /usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"</source>
::NOTE: Do <preu>mailbox_command = '''not'''</usru> replace any variables, those are set automatically by Postfix when it runs the LDA. If you are interested in learning more about the Dovecot application, you can read about dovecot-lda [http:/libexec/wiki.dovecot.org/LDA/Postfix here] and [http://wiki.dovecot-lda -f .org/LDA here].<br><ol><li value="$SENDER4" >Finally, edit the '''/etc/dovecot/conf.d/10-a "$RECIPIENT"mail.conf''' file and indicate where you want your mail delivered by including the following line:<source>mail_location = maildir:~/Maildir</source></li><li>Restart your postfix service.</li><li>While the emails are still stored only on VM3, they will now be easier for other machines/services to access.</li><li>Due to permissions on the directories where mail will now be stored, root will no longer receive mail. Check the logs for an indication as to why.</li></preol>
==INVESTIGATION 3: USING THUNDERBIRD (MUA) FOR VM2 and VM3 MACHINES = Connecting to IMAP Servers Using Thunderbird===
'''Perform the following steps:'''
#On your '''host ''' machine, return to the Mail Account Setup dialog box (eg. near top of lab).# Set up the a '''new email account'''. You will be using account settings to connect to your '''vm2''' for '''SMTP''' and '''vm3''' for '''IMAP'''. Use <u>no</u> encryption, and use normal password authentication for IMAP (we don't have an IMAP server running yet, but that's ok). Refer to the diagram below for reference:
[[Image:ops335-email-step1.png|600px]]
=== Sending a Mail Message from VM2 (Using Thunderbird)===
'''Perform the following steps:'''
#Use the '''ss''' and '''nc''' commands (like you did in lab 4a) to confirm your service is listening on the correct ports/interfaces. You will probably have to open the appropriate firewall port on '''vm3''' to allow incoming '''SMTP''' connections.<br><br>'''Note:''' You should be able to send email to any regular user <u>on</u> '''vm3''' using the email address '''yourusername@yoursenecaid.orgops''' using the Thunderbird application on your host machine (which is configured to use the account on your vm2).<br><br>
<ol><li value="2">Create a new account on your '''vm3''' machine using only your <u>first</u> name. We will use this account as a one-time "test" if the mail message has been received on your VM3 machine (from your VM2 machine).<br><br>'''Note:''' It is <u>'''important'''</u> that you '''<u>don't</u>''' create this same account name on your vm2 machine, since you want to easily identify the difference between the sending and receiving SMTP servers.<br/><br/></li></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.orgops''' 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 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 cannot properly receive sent e-mail messages, check the '''/var/log/syslog''' file for errors.<br><br> If you locate an error message in that file such as: '''Fatal: Error reading configuration: Invalid settings...''', then add the following <u>parameter</u> in '''/etc/dovecot/dovecot.conf''':<br />'''postmaster_address <nowiki>=</nowiki> DOMAIN''' (where DOMAIN is actually <u>your</u> domain).<br /><br />After you have saved those changes, then '''restart''' your dovecot service. This problem can also be resolved by properly setting the hostname of your machine to include the domain.}}
'''Record steps, commands, and your observations in INVESTIGATION 2 3 in your OPS335 lab log-book'''
== COMPLETING THE LAB ==
::<span style="color:green;font-size:1.5em;">✓</span>Status and configuration of your Postfix service on vm2.
::<span style="color:green;font-size:1.5em;">✓</span>Your Thunderbird configuration.
::<span style="color:green;font-size:1.5em;">✓</span>The email you sent to your myseneca account.
::<span style="color:green;font-size:1.5em;">✓</span>Download the labcheck4b.bash checking bash shell script by issuing the command:<br><br>and run '''wget httphttps://matrixict.senecac.onsenecacollege.ca/~peterandrew.callaghan/filessmith/OPS335ops335/labcheck4b.bash'''<br><br>set execute permission and run the shell script on your '''c7host''' machine. ::*For '''Peter's classes''', follow his Online Submission instructions in Moodle.::*For '''Murray's classes''', run command (piping to the '''more''' command) and show output to instructor.
::<span style="color:green;font-size:1.5em;">✓</span>Completed Lab4b log-book notes.
-->
==EXPLORATION QUESTIONS==
# 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?
# Why is root not able to receive mail with the changed mail location? What could you change to allow mail to be sent to root again?