----------------------- Exercise #06 for NET2003 due February 28, 2006 ----------------------- -Ian! D. Allen - idallen@idallen.ca Remember - knowing how to find out an answer is more important than memorizing the answer. Learn to fish! RTFM! (Read The Fine Manual) Global weight: 4% of your total mark this term Due date: 23h59 Tuesday February 28, 2006 Late-submission date: I will accept without penalty exercises that are submitted late but before 10h00 on Thursday, March 2. After that late-submission date, the exercise is worth zero marks. Exercises submitted by the *due date* will be marked online and your marks will be sent to you by email after the late-submission date. Where to work, location of the course notes on the Course Linux Server, exercise preparation: See exercise01.txt for all the above details. NOTE: For full marks, keep your lines shorter than 80 columns in this course! Keep your terminal window set to 80 columns. The VIM editor will automatically wrap most lines as you type them if you enter "set wrapmargin=5" in your $HOME/.vimrc file. -------------------- Part 0 - Preparation -------------------- Synopsis: Read details on POP and SMTP protocols. Make direct connections to Internet network services using Unix command-line tools. For these exercises you will need to run "script" sessions in which you use the "nc" command to connect to servers, following the models used in these course notes: http_session.txt smtp_session.txt nntp_session.txt The model for running the "script" command is in file "miscellaneous.txt". The model for setting your shell prompt is in file "shell_prompt.txt". "ALN" is Advanced Linux Networking, by Roderick W. Smith You may run "script" on a local Unix system (and copy your session to the Course Linux Server when you are done), or you may connect to the Course Linux Server and run "script" there. ---------------------------------- Part I - HTTP Session - http06.out ---------------------------------- Google.CA --------- Fetch the opening index web page (the root page) from "google.ca". Follow the model given at the end of the file "http_session.txt", substituting the parameters given below. To record your HTTP session, start a "script" session using output file "http06.out". Set your shell prompt to be the string '$USER http$ ' (note the trailing space) once you have started your script session. Once you are running "script" and have set your prompt correctly, connect to "google.ca": idallen http$ nc -v google.ca http google.ca [216.239.59.104] 80 (http) open After issuing your "GET" command to fetch the root web page "/", if the response code from the server is numbered "302", re-issue the GET request using the exact URL given in the "Location:" field. Repeat until you fetch the actual Google HTML index page (containing the search form). Exit your script session after you have succeeded in getting the Google HTML form to return in response to your "GET" command. Verify that the session was recorded in "http06.out". ian.idallen.ca -------------- Start up "script" again with the same file name; however, use the option to script that means "append to this file". Do not accidentally overwrite your existing http06.out file! Set your shell prompt to be the string '$USER http$ ' (note the trailing space) once you have started your script session. Fetch the opening index web page (the root page) from virtual web server "ian.idallen.ca". Follow the model given at the end of the file "http_session.txt", substituting the parameters given below. idallen http$ nc -v ian.idallen.ca http home.idallen.ca [206.47.37.39] 80 (http) open If you see a short response page ending with the line "If you really want to browse my home machine", then you forgot to enter the virtual web server "Host:" line. Redo your "GET" request and follow it with the correct "Host:" line containing the name of the virtual web server. Exit your script session after you have succeeded in fetching the correct HTML index page for virtual web server "ian.idallen.ca". (Note: The correct index page ends with the "Hacker Ideals Emblem" image.) Verify that the session was recorded in (appended to) file "http06.out". ----------------------------------- Part II - SMTP Session - smtp06.out ----------------------------------- Reference: ALN Chapter 19 "Push Mail Protocol: SMTP" Readings: p.477-491 See p.482 "Understanding SMTP Transport" and Listing 19.1. In Listing 19.1, label the mandatory "envelope" From and To address lines set by the SMTP protocol. Label the optional "message header" From and To lines carried in the data part of the message. You need to know which addresses are "envelope" and which are "message headers". Send a test email message to yourself on the Course Linux Server using the SMTP protocol via the "nc" command. Follow the model given in file "smtp_session.txt", substituting the parameters given below. To record your SMTP session, start a "script" session using output file "smtp06.out". Set your shell prompt to be the string '$USER smtp$ ' (note the trailing space) once you have started your script session. Once you are running "script" and have set your prompt correctly, connect to the my home desktop server SMTP daemon using firewall port 2525: idallen smtp$ nc -v net2003.idallen.ca. 2525 DNS fwd/rev mismatch: home.idallen.ca != cpu1808.adsl.bellglobal.com home.idallen.ca [206.47.37.39] 2525 (?) open 220 idallen-home1.home.idallen.ca ESMTP Postfix (2.0.6) (Mandrake Linux) Your EHLO host name can be any host name you like, real or imaginary. The SMTP "envelope" From address can be any address you like, real or imaginary (e.g. frodo@baggins.com). The SMTP "envelope" To address must be your userid on the Course Linux Server, in the form . (Replace abcd0001 with your userid.) You can enter any data you like for the optional message headers lines and the body of the message. (See how easy it is to forge email?) Exit your script session after you have sent the email to yourself and typed the SMTP QUIT command. Verify that the session was recorded in "smtp06.out". Fetching the email ------------------ Log in to the Course Linux Server and get a copy of the mail message you just sent to yourself (above). Add the entire message, including all the header lines, to the end of your smtp06.out file. You will find your incoming email on the Course Linux Server in a file named with your userid located under the mail spool directory. The mail spool directory is configured using the parameter "mail_spool_directory" in the main Postfix configuration file. The name and location of the main postfix configuration file is documented in your course text. (Reference ALN p.508 "Postfix's Configuration Files".) Know how to find this directory information from Postfix in future! ------------------------------------ Part III - POP-3 Session - pop06.out ------------------------------------ (There is no sample POP-3 session in the course notes.) Reference: ALN Chapter 11 "Pull Mail Protocol: POP and IMAP" Readings: p.257-264 See p.262 "A Sample POP Session" and Listing 11.1. While logged in to the Course Linux Server, fetch a mail message from your mailbox on the Course Linux Server via the POP-3 protocol. Follow the model given in ALN p.263, substituting the parameters given below. To record your POP-3 session, start a "script" session using output file "pop06.out". Set your shell prompt to be the string '$USER pop$ ' (note the trailing space) once you have started your script session. Once you are running "script" on the Course Linux Server and have set your prompt correctly, connect to the "localhost" pop3 port: idallen pop$ hostname idallen-home1.home.idallen.ca idallen pop$ nc -v localhost pop3 localhost [127.0.0.1] 110 (pop3) open +OK POP3 localhost v2002.81mdk server ready After you have logged in with your userid and password, the POP-3 command "LIST" will show you what messages you have waiting, and their sizes. Fetch and delete one message using the POP-3 protocol commands. (If you don't have any messages waiting, repeat the above SMTP session to send yourself a message.) Disconnect from the POP-3 server and exit your script session after you have succeeded in fetching and deleting one message. Verify that the session was recorded in "pop06.out". Labelling and Submission ------------------------ NOTE: For full marks, keep your lines shorter than 80 columns in this course! Keep your terminal window set to 80 columns. The VIM editor will automatically wrap most lines as you type them if you enter "set wrapmargin=5" in your $HOME/.vimrc file. *** Process each of the script sessions to remove backspace and *** carriage-return characters, as described in "miscellaneous.txt". *** Files containing these control characters will incur a penalty. After you have processed each file to remove the control characters, add your assignment label to the top of each file. Submit the finished and labelled files for marking as Exercise 06 on the Course Linux Server, using the following netsubmit command line: $ netsubmit 06 http06.out smtp06.out pop06.out $ netsubmit -list Always submit *all* the files for marking at the same time. Class Notes reference: netsubmit.txt - Using the netsubmit command Did you remember to remove all the control characters from the files?