Open main menu

CDOT Wiki β

Changes

OPS335 Web Server Lab

631 bytes removed, 22:34, 30 August 2011
no edit summary
FOCUS: Basic Mail Apache (PostfixWeb Server) SetupThis lab will show you how to set up a Postfix email the Apache Web server using a Fedora 13 installed PC.
You will need at least two systems to do this lab. The first could be Fedora on your removable hard drive while the second could be a virtual machine.
PART A - Prerequisites(same as Lab #4)
Your hard drive should have Fedora 13, 64 bit Live edition already installed.
You should have at least one VM installed: also Fedora 13, 64 bit Live edition.
Both host and guest should have all software updated. [ yum update ]
Ensure the clocks on both machines are set to the correct date and time.
PART B - Testing your network(same as Lab #4)
Start Firefox on your host and authenticate yourself on Sene2net with your LEARN account.
Start Firefox on your guest.
Ensure you can surf the web on your guest. NOTE: you should not have to authenticate yourself on the guest.
PART C - Testing email to the outside world using mailx Install and sendmailtest Apache Sendmail is installed Now login to vm01 (your guest VM) and running by default on Fedora 13 so there is no need to install it.the following three packages, if they are not already installed, like thisInstall mailx on both the host and the guest. [ yum install mailx ]httpdTest email from the host by sending an email to your LEARN account. [ mail yum install httpd-s "PART C3" xxxxxx@learn.senecac.on.ca ]toolsNote: xxxxxx is your LEARN ID. yum install system-config-httpdNote: after Still on vm01 you type in can now start your letter, enter a period in the first column web server with this command service httpd startUsing Firefox on the last line and hit the ENTER key.Check your LEARN email vm01 go to see if you got the email. If you did make a note of the return address"localhost".Test email from You should get the host by sending an email to your LEARN account. [ mail -s "PART C4Fedora Test Page" -r hacker@evilwhich indicates your web server is running.com xxxxxx@learnDo not continue until this step works.senecac.on.ca ]Note: xxxxxx is Now create your LEARN IDown test page named index.Note: after you type in your letter, enter a period in the first column on the last line html and hit the ENTER key.Check your LEARN email to see if you got the emailput it into directory /var/www/html/. If you did make a note of Reload the return address.Repeat steps 3 and 4 on the guest machine.PART D Firefox "localhost" web page - Install and configure PostfixOn both machines do the following:Stop sendmailyou should see your own test page now. [ service sendmail stop ]Install Postfix - yum install postfixEdit Try viewing this web page from f13 (the Postfix configuration file, gateway/etc/postfix/mainhost).cf, and change You'll need to enter the following lines:mydomain = exampleIP address of f13 in your Firefox browser.orgmyorigin = $mydomaininet_interfaces = allmynetworks = 127.0.0.0/8, By default this address should be something like 192.168.122.0/24relay_domains =Start Postfix [ service postfix start ] on both host and guest machinesPART E - Testing email using IP Addresses aaa. If you have problems with the following this doesn't work you may have to set SELinux add a rule to permissive mode and/or adjust your the firewall on vm01 to allow traffic to/from incoming connections on port 2580.Try sending an email from your guest to Edit the /etc/hosts file on each PC in your network and include the IP address and hostname for both PCs. [ mail -s "PART E2" yyyyyy@[192.168.122Now try accessing your web site by name in stead of IP number.1] ]Note: yyyyyy is your host IDwe're not using DNS so /etc/hosts file should work in its place.Note: the square brackets around Now, as root on f13 (the gateway/host IP addressTry sending an email from your host ), try to forward incoming http connections to your our server on vm01 (the guest). [ mail Use an iptables command something like this iptables -s "PART E3" zzzzzz@[t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to 192.168.122.ZZZ] ]aaa Note note: zzzzzz aaa is the IP address of your guest IDVMNote: ZZZ is your guest IP addressPART F - Set up a DNS server Refer To test this setup you'll need to Lab #3 and set up ask a DNS server classmate on another PC to try to use Firefox to view your hostweb page.Set your host name S/he'll have to f13.Set enter your guest name to vm01external interface IP number (142.Set your domain name to example204.org141.Test your DNS on both host and guest to ensure it works properlyyyy) in Firefox's address window.PART F - Test email using host namesNow try sending mail to yourself on both machines. For exampleFinally, as joker root on f13vm01, use the following commandto view/adjust your web server parameters: system-config-httpd$ mail joker@f13the machine will prompt for a subject: enter "testing" without the quotes.Now enter the body of and change your letter. When you're done, enter a period (.) in column 1 on the last line of your letter. This will signal end-of-file listen port to 8080 and restart your letter will be mailedweb server. You should end up Go back at the $ prompt. If you mess up use CTRL-C to cancel the email, DO NOT USE CTRL-Z. Use the mailq f13 and redo your iptables command (you will need to be root) forward port 80 connections to view the mail queue. Use the mail command to check if you have mail.PART G - Test your configuration and view your logsRestart your postfix servers new port 8080 on both machinesvm01.Check your /var/log/messages file to see Verify that other students on other PCs can still view your postfix servers started without errorweb page.Send some emails from both guest and host If this doesn't work you may have to each other and add a rule to the outside world.Check your /var/log/maillog file firewall on vm01 to see that your email messages were sent correctly.PART H - Learning the mail commandRead the mail manual page and learn how it worksallow connections on port 8080.
PART I - Answer the following questions and and email them to your teacher in ASCII text format.
What is your full name and 9-digit Seneca student ID?
What HTML code did you use for your own web page in step 4? Include a copy the complete listing.Give the full path names of your mainthe Apache log files.What directory is the default server root? Give the full path name.What directory is the default document root? Give the full path name.cf What is the default configuration file for the Apache web server on vm01 (your guest) with this lab - but delete all commented and blank lines first - like thisFedora 13? Give the full path name. [ cat /etc/postfix/main.cf | grep -v ^# | awk 'NF > 0 {print $0}'What is the output default maximum number of connections allowed on the iptables-save command server by default?What user/group does Apache run under on both your host and guest machinesFedora 13?What firewall rule or rules, if any, exact command did you have use in step 11 of part C?What specific command (give full details) would you need to enter use on f13 to forward ssh connections to vm01?What is the guest and/or host so that email to/from each other would workweb site for Apache?What is Apache's current version number? Note: this may be different from the meaning of version running on Fedora 13.What is displayed by the square brackets surrounding iptables-save command on both f13 and vm01 at the IP address in PART Eend of this lab?What were your results to PART G? Show Finally, show part (a small segment) of the Apache access log segments file that indicate successful access to verify your answersweb site.
1
edit