Changes

Jump to: navigation, search

OPS335 Lab 4b

1,500 bytes removed, 02:02, 2 January 2020
Online Submission (Peter Callaghan's Classes only)
|}
::Note that your username is your full email address(<em>firstname.lastnameyourid@myseneca.ca</em>) and not just <em>firstname.lastnameyourid</em>.
'''Record steps, commands, and your observations in INVESTIGATION 1 in your OPS335 lab log-book'''
 
== INVESTIGATION 2: SETUP A CENTRALIZED MESSAGE STORE ==
::In order for this to work, we need to add a DNS record that will point mail sent to the domain towards one of the SMTP servers configured to accept it.
<ol><li value="5">Add an '''MX''' record to the forward lookup zone on vm1 '''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.ops'''</li><li>Confirm that it arrives on your '''vm3''' machine.</li></ol>
=== Relay Email Through Another Server===
# Direct your '''vm2''' MTA to relay mail through vm3, by making the following editing change for the '''/etc/postfix/main.cf''' file:<br><source>relayhost = vm3.<yourdomain>.ops</source>
# Restart the '''postfix''' service.
# Next, you must instruct your '''vm3''' machine to allow your vm2 machine to pass email through it by making the following editing chnage change to the '''/etc/postfix/main.cf''' file:<br><source>mynetworks = 192.168.X.0/24</source>NOTE: Substitute in your '''own network''' for X<br><br>
# Restart the '''postfix''' service.
::NOTE: Do <u>'''not'''</u> 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://wiki.dovecot.org/LDA/Postfix here] and [http://wiki.dovecot.org/LDA here].
<br>
<ol><li value="4">Finally, edit the '''/etc/dovecot/conf.d/10-mail.conf''' file and indicated 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></ol>
==INVESTIGATION 3: USING THUNDERBIRD (MUA) FOR VM2 and VM3 MACHINES ==
 
=== Accessing Received Mail Messages on VM3 VIA IMAP ===
 
First, we will set up the IMAP server so we can read email. The current way we have configured our mail server on our VM3 machine should allow all the email for anyaccount@yoursenecaid.ops should be delivered to our '''vm3''' machine. We will set up Dovecot with IMAP to get easy access to that email.
 
'''Perform the following steps:'''
 
#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 '''ss''' command to confirm the service is listening, and use nc on the host to confirm you can connect to it.
# Using the information gathered from ss, modify the firewall on vm3 to allow IMAP connections from your local network. Remember to save this change so it will still be there the next time you reboot.
#If you can connect - it's now time to do something wrong, that is allow connections to our IMAP server 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 a later 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.
 
=== 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 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]]
::<ol><li value="3">Try to connect to your IMAP server with Thunderbird by clicking on your '''NOTE:Inbox''' .</li><li>If nothing happens, then check the Thunderbird won't let Activity Manager for any errors. If the connection is successful, you proceed with should see the "Done" button because you will fail to connect to IMAP. '''Trash''' box <olu>appear<li value="3"/u> Use the "Advanced config" button to bypass that checkbelow Inbox.</li><li>Use the Thunderbird application to send an email to your myseneca address. If you've done everything right, it will send the message successfully, but it will fail to save it in the Sent folder since that's done with IMAP and you don't have an IMAP server yet.</li><li>Verify that your message has been sent. Check your myseneca email and look at '''/var/log/maillog''' on vm2 (your email server).</li></ol>
=== Sending a Mail Message from VM2 (Using Thunderbird)===
 
{{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 Thunderbird will permanently hang with a message that it is saving the message. It will never succeed, as we have not yet configured the imap server to accept the connection necessary for that to work.}}
'''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.ops''' 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.ops''' 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.}}
 
=== Viewing Received Mail Message on VM3 VIA IMAP (Using Thunderbird) ===
 
Finally, we will set up the IMAP server so we can read email. The current way we have configured our mail server on our VM3 machine should allow all the email for anyaccount@yoursenecaid.ops should be delivered to our '''vm3''' machine. We will set up Dovecot with IMAP to get easy access to that email.
 
'''Perform the following steps:'''
 
#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 '''ss''' command to confirm the service is listening, and use nc on the host to confirm you can connect to it.
# Using the information gathered from ss, modify the firewall on vm3 to allow IMAP connections from your local network. Remember to save this change so it will still be there the next time you reboot.
#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 a later 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.ops''' to '''yoursenecaid@yoursenecaid.ops''' 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.
{{Admon/important |Backup your VMs!|You MUST perform a '''full backup''' of ALL of your VMs whenever you complete your '''OPS335 labs''' or when working on your '''OPS335 assignments'''. You should be using the dump command, and you should use the Bash shell script that you were adviced to create in order to backup all of your VMs.}}
 
'''Record steps, commands, and your observations in INVESTIGATION 3 in your OPS335 lab log-book'''
'''Depending on your professor you will either be asked to submit the lab in class, or online. Follow the appropriate set of instructions below'''
===Online Submission (Peter CallaghanAhad Mammadov's Classes only)===Follow the instructions for lab 4b on moodleblackboard===Andrew's sections===
===In Class Submission===You may choose to:Students should be prepared with * Submit screenshots of your work on Blackboard, in which case you don'''all required commands (system information) displayed in a terminal (or multiple terminals) prior t need to come to the lab.* Or come to calling the instructor for signoff''lab, show me your work, and talk to me about it. I want to hear what you've learned and answer any questions you have.
You'''Arrange evidence (command output) for each ll get the same grade regardless of these items on how you choose to submit your screen, then ask your instructor to review them and sign off on the lab's completion:'''work.
::<span style="color:green;font-size:1.5em;">&#x2713;</span>Status and configuration of your Postfix service on vm2.
::<span style="color:green;font-size:1.5em;">&#x2713;</span>Your Thunderbird configuration.
::<span style="color:green;font-size:1.5em;">&#x2713;</span>The email you sent to your myseneca account.
::<span style="color:green;font-size:1.5em;">&#x2713;</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;">&#x2713;</span>Completed Lab4b log-book notes.
 
 
==EXPLORATION QUESTIONS==
572
edits

Navigation menu