Difference between revisions of "OPS335 - Assignment 1 (Part 1)"
m (Modifying rubric to have a few more marks devoted to a solid basis for iptables.) |
(→Create a "Cloning-Source" VM (335assign Virtual Network)) |
||
(123 intermediate revisions by 5 users not shown) | |||
Line 5: | Line 5: | ||
== General Requirements == | == General Requirements == | ||
− | '''Weight''': ''' | + | '''Weight''': '''2.5%''' of the overall grade |
− | '''Due Date''': | + | '''Due Date''': check with your professor |
== Detailed Requirements == | == Detailed Requirements == | ||
Line 16: | Line 16: | ||
* Assign a newly-created virtual network the name: '''335assign''', and set '''forwarding to any physical device'''<br>(refer to [http://zenit.senecac.on.ca/wiki/index.php/OPS335_Installation_Lab#INVESTIGATION_2:_VIRTUAL_MACHINE_INSTALLATION lab setup]. You can have have 2 different network names: "335assign" and "ops335" without causing any problems). | * Assign a newly-created virtual network the name: '''335assign''', and set '''forwarding to any physical device'''<br>(refer to [http://zenit.senecac.on.ca/wiki/index.php/OPS335_Installation_Lab#INVESTIGATION_2:_VIRTUAL_MACHINE_INSTALLATION lab setup]. You can have have 2 different network names: "335assign" and "ops335" without causing any problems). | ||
− | * Addresses in this network will start with '''172. | + | * Addresses in this network will start with '''172.28.105'''. The subnet mask must be '''255.255.255.0''' |
* There must '''<u>NOT</u>''' be a DHCP server running for this network! | * There must '''<u>NOT</u>''' be a DHCP server running for this network! | ||
* All the machines for this assignment will be connected to your newly-created virtual network called: '''335assign''' | * All the machines for this assignment will be connected to your newly-created virtual network called: '''335assign''' | ||
Line 26: | Line 26: | ||
Details for the cloning-source | Details for the cloning-source | ||
− | #The name of this cloning-source VM will be called: ''' | + | #The name of this cloning-source VM will be called: '''pangaea'''. |
− | #You should use the options that you used in your lab1 to setup the static network, plus you should use the DOMAIN parameter to set the ''' | + | #You should use the options that you used in your lab1 to setup the static network, plus you should use the DOMAIN parameter to set the '''continents.earth.ops''' domain for your cloning-source. |
#The VM should have a command-line interface only. | #The VM should have a command-line interface only. | ||
#Configure it to be a good cloning-source, '''making certain that the cloning-source has all the following elements prior to cloning:''' | #Configure it to be a good cloning-source, '''making certain that the cloning-source has all the following elements prior to cloning:''' | ||
::*Don't make the virtual drive too big: you will need space for it as well as space for the clones you from your cloning-source<br>('''5 GB''' should be enough for any cloning-source and clone VM that you create for this assignment). | ::*Don't make the virtual drive too big: you will need space for it as well as space for the clones you from your cloning-source<br>('''5 GB''' should be enough for any cloning-source and clone VM that you create for this assignment). | ||
− | ::*The hostname for this server will be called: ''' | + | ::*The hostname for this server will be called: '''pangaea''' |
::*Make certain that you can login to your cloning-source. | ::*Make certain that you can login to your cloning-source. | ||
::*Configure your network interface for this cloning-source with a '''static''' configuration and is connected to the '''335assign''' network. Refer to the table below for IP address and hostname.<br> | ::*Configure your network interface for this cloning-source with a '''static''' configuration and is connected to the '''335assign''' network. Refer to the table below for IP address and hostname.<br> | ||
Line 37: | Line 37: | ||
{| class="wikitable" | style="margin-left:50px; style="border: 2px solid black;" | " | {| class="wikitable" | style="margin-left:50px; style="border: 2px solid black;" | " | ||
|- style="font-weight:bold; text-align:center;" | |- style="font-weight:bold; text-align:center;" | ||
− | | style="border: 2px solid black;" | Hostname | + | | style="border: 2px solid black;" | Hostname / Domain |
| style="border: 2px solid black;" | Address | | style="border: 2px solid black;" | Address | ||
| style="border: 2px solid black;" | Purpose | | style="border: 2px solid black;" | Purpose | ||
|- | |- | ||
| style="background-color:#66cccc; border: 2px solid black;" | (your existing host / source) | | style="background-color:#66cccc; border: 2px solid black;" | (your existing host / source) | ||
− | | style="background-color:#66cccc; border: 2px solid black;" | External Facing Address:''' DHCP assigned'''<br>Internal Virtual Bridge (virbr1):''' 172. | + | | style="background-color:#66cccc; border: 2px solid black;" | External Facing Address:''' DHCP assigned'''<br>Internal Virtual Bridge (virbr1):''' 172.28.105.1''' |
| style="background-color:#66cccc; border: 2px solid black;" | Your '''host''' machine | | style="background-color:#66cccc; border: 2px solid black;" | Your '''host''' machine | ||
|- | |- | ||
− | | style="background-color:#66cccc; border: 2px solid black;" | ''' | + | | style="background-color:#66cccc; border: 2px solid black;" | '''pangaea.continents.earth.ops''' |
− | | style="background-color:#66cccc; border: 2px solid black;" | '''172. | + | | style="background-color:#66cccc; border: 2px solid black;" | '''172.28.105.100''' |
| style="background-color:#66cccc; border: 2px solid black;" | '''Cloning-source''' used to create other servers for other assignments. | | style="background-color:#66cccc; border: 2px solid black;" | '''Cloning-source''' used to create other servers for other assignments. | ||
|} | |} | ||
Line 53: | Line 53: | ||
− | <ol><li value="5">Make certain your cloning-source can connect to the Internet using the newer static configuration.</li><li>Run a '''yum update''' for this cloning-source.</li><li>Make certain that SELinux is set to '''enforcing'''.</li><li>Set up an SSH server on this "cloning-source".</li><li> Make sure that '''PermitRootLogin''' is set to '''yes''' for this server.</li><li>Make certain that | + | <ol><li value="5">Make certain your cloning-source can connect to the Internet using the newer static configuration.</li><li>Run a '''yum update''' for this cloning-source.</li><li>Make certain that SELinux is set to '''enforcing''' (unless you're in Andrew or Hans' sections - then have it '''disabled''').</li><li>Set up an SSH server on this "cloning-source".</li><li> Make sure that '''PermitRootLogin''' is set to '''yes''' for this server.</li><li>Make certain that the root account is permitted to login only using key authentication. If other users are required to be created in a later assignment, they should be permitted to log in with their username and password.</li><li>Copy the same public key (already generated for your '''Host Machine''' for your '''root''' account in lab1) to the '''root''' account on your cloning-source.</li><li>Test to make certain that you can login from root on your host machine to your root account on the cloning-course ("pangaea") <u>'''without'''</u> being prompted for a pass-phrase.</li><li>If you have created a '''regular user''' when you installed this machine, '''<u>delete</u> that regular user''' (make certain to '''remove the regular user's home directory!''').</li></ol> |
=== Set-up Firewall Rules for your Cloning-Source=== | === Set-up Firewall Rules for your Cloning-Source=== | ||
Line 67: | Line 67: | ||
:::<li>The host machine (and <b>only</b> the host machine) must be able to ssh to that cloning-source VM.</li> | :::<li>The host machine (and <b>only</b> the host machine) must be able to ssh to that cloning-source VM.</li> | ||
:::<li>ICMP traffic is allowed if it originated with the <b>local network only</b>.</li> | :::<li>ICMP traffic is allowed if it originated with the <b>local network only</b>.</li> | ||
− | :::<li>As this is acting as the secure basis for later machines, no other traffic should be allowed.</li> | + | :::<li>As this is acting as the secure basis for later machines, no other traffic should be allowed, and no response should be sent if any other traffic is received.</li> |
::</ul> | ::</ul> | ||
Line 77: | Line 77: | ||
# Issue the command '''su -''' | # Issue the command '''su -''' | ||
# Create a Bash shell script called '''/root/bin/assnBackup.bash''' to perform a '''full backup''' using the '''gzip''' command to backup the entire file system of your cloning-source VM to save the compressed copy to the directory path: '''/backup/full/'''). | # Create a Bash shell script called '''/root/bin/assnBackup.bash''' to perform a '''full backup''' using the '''gzip''' command to backup the entire file system of your cloning-source VM to save the compressed copy to the directory path: '''/backup/full/'''). | ||
− | # This shell script should | + | # This shell script should read each of any number of VM image files in the '''/var/lib/libvirt/images''' directory that has the extension ".qcow2". In this way, this shell script will safely backup any new VMs that are created later in this course, yet backup the existing labs and assignment VMs. |
# Perform a Net-search to use the '''pv''' (''pipe-viewer'') command to show a text-based indicator of backup for EACH VM image file. You need to add the '''EPEL repository''' to install the pv command. | # Perform a Net-search to use the '''pv''' (''pipe-viewer'') command to show a text-based indicator of backup for EACH VM image file. You need to add the '''EPEL repository''' to install the pv command. | ||
− | # Set execute permissions for this script, and run this Bash shell script prior to exiting your assignment work session to properly backup your cloning source. You should also make a copy of the backup on an external device (such as a USB key). | + | # Set execute permissions for this script, and '''run this Bash shell script prior to exiting your assignment work session to properly backup your cloning source'''. You should also make a copy of the backup on an external device (such as a USB key). |
# Set-up via a crontab entry, an '''incremental backup''' of the '''/etc/''' directory of your cloning-source to be performed every hour to the '''/backup/incremental/cloning-source''' directory. | # Set-up via a crontab entry, an '''incremental backup''' of the '''/etc/''' directory of your cloning-source to be performed every hour to the '''/backup/incremental/cloning-source''' directory. | ||
− | |||
== Assignment Submission == | == Assignment Submission == | ||
Line 89: | Line 88: | ||
===Assignment Evaluation Details=== | ===Assignment Evaluation Details=== | ||
− | *'''Demonstrate working assignment to your instructor in class:'''<ol type="a"><li>Students | + | *'''Demonstrate working assignment to your instructor in class:'''<ol type="a"><li>Students can demonstrate their assignment functionality to their professor during a lab period (like you would for any lab for "sign-off").</li><li>Students are required to prepare everything ahead of time so that you can quickly demonstrate to your instructor that all required parts of your assignment are working.</li><li> The idea of the demonstration of your assignment to your instructor is to check for errors that may cause problems when running the checking script.<br><br></li></ol> |
− | |||
− | |||
− | |||
− | : | + | *Download and run a shell script to check your work: |
− | + | <ol><li>Login as '''root''' on your '''host''' machine.</li><li>Change to the '''/root/bin''' directory.</li><li>Make certain that your '''cloning-source VM is running'''.</li><li>Issue the command to download a checking script for your assignment to your '''host''' machine:<br><span style="font-family:courier;font-size:1em;color:#4d4dff | |
− | + | "> wget https://matrix.senecacollege.ca/~ahad.mammadov/files/OPS335/check-assn1-p1.bash</span><br><br></li><li>Set execute permissions and run the shell script.<br>It will create a tar file for you to upload as your submission to blackboard.</li></ol> | |
− | |||
==Evaluation Rubric== | ==Evaluation Rubric== | ||
Line 107: | Line 102: | ||
{| class="wikitable" width=50% | {| class="wikitable" width=50% | ||
|- | |- | ||
− | | colspan=2 style="text-align:center;background-color:#cccccc;" |'''Student Demonstration | + | | colspan=2 style="text-align:center;background-color:#cccccc;" |'''Student Demonstration''' (optional) |
|- | |- | ||
| style="font-weight:bold" | Evaluation Item | | style="font-weight:bold" | Evaluation Item | ||
Line 132: | Line 127: | ||
| width=10% style="text-align:right;font-weight:bold" | Mark | | width=10% style="text-align:right;font-weight:bold" | Mark | ||
|- | |- | ||
− | | Hostname set to: ''' | + | | Hostname set to: '''pangaea''' only, domain name '''continents.earth.ops''' set as a network parameter |
| style="text-align:right" | /1 | | style="text-align:right" | /1 | ||
|- | |- | ||
Line 159: | Line 154: | ||
| style="text-align:right" | /1 | | style="text-align:right" | /1 | ||
|- | |- | ||
− | | iptables - Other unexpected '''INPUT''' traffic is blocked | + | | iptables - Other unexpected '''INPUT''' traffic is blocked without response |
| style="text-align:right" | /1 | | style="text-align:right" | /1 | ||
|- | |- | ||
− | | iptables - all '''FORWARD''' traffic is blocked | + | | iptables - all '''FORWARD''' traffic is blocked without response |
| style="text-align:right" | /1 | | style="text-align:right" | /1 | ||
|- | |- | ||
Line 172: | Line 167: | ||
|- | |- | ||
| Backup script '''assnBackup.bash''' structure | | Backup script '''assnBackup.bash''' structure | ||
− | | style="text-align:right" | / | + | | style="text-align:right" | /1 |
+ | |- | ||
+ | | Use of '''PV''' command for backup script | ||
+ | | style="text-align:right" | /1 | ||
|- | |- | ||
| Proof that '''VM full backup''' was run | | Proof that '''VM full backup''' was run |
Latest revision as of 09:48, 1 October 2021
Contents
Purpose
For this portion of assignment 1, you will set up the basic functionality for a virtual machine to act as a cloning-source to make it easier for the student to create other servers (VMs) in later assignments. Whenever you clone another server (in later assignments), you MUST make certain to configure the cloned server in order to make it function in the network correctly and meet the requirements of future assignments. All of the assignments for this course are interdependent of each other and belong to the same Virtual Private Network called 335assign.
General Requirements
Weight: 2.5% of the overall grade
Due Date: check with your professor
Detailed Requirements
Set-up a Virtual Network (335assign)
Create a new virtual network on your Host Machine.
- Assign a newly-created virtual network the name: 335assign, and set forwarding to any physical device
(refer to lab setup. You can have have 2 different network names: "335assign" and "ops335" without causing any problems). - Addresses in this network will start with 172.28.105. The subnet mask must be 255.255.255.0
- There must NOT be a DHCP server running for this network!
- All the machines for this assignment will be connected to your newly-created virtual network called: 335assign
Create a "Cloning-Source" VM (335assign Virtual Network)
Create a virtual machine that you will use as a cloning-source.
Details for the cloning-source
- The name of this cloning-source VM will be called: pangaea.
- You should use the options that you used in your lab1 to setup the static network, plus you should use the DOMAIN parameter to set the continents.earth.ops domain for your cloning-source.
- The VM should have a command-line interface only.
- Configure it to be a good cloning-source, making certain that the cloning-source has all the following elements prior to cloning:
- Don't make the virtual drive too big: you will need space for it as well as space for the clones you from your cloning-source
(5 GB should be enough for any cloning-source and clone VM that you create for this assignment). - The hostname for this server will be called: pangaea
- Make certain that you can login to your cloning-source.
- Configure your network interface for this cloning-source with a static configuration and is connected to the 335assign network. Refer to the table below for IP address and hostname.
- Don't make the virtual drive too big: you will need space for it as well as space for the clones you from your cloning-source
Hostname / Domain | Address | Purpose |
(your existing host / source) | External Facing Address: DHCP assigned Internal Virtual Bridge (virbr1): 172.28.105.1 |
Your host machine |
pangaea.continents.earth.ops | 172.28.105.100 | Cloning-source used to create other servers for other assignments. |
- Make certain your cloning-source can connect to the Internet using the newer static configuration.
- Run a yum update for this cloning-source.
- Make certain that SELinux is set to enforcing (unless you're in Andrew or Hans' sections - then have it disabled).
- Set up an SSH server on this "cloning-source".
- Make sure that PermitRootLogin is set to yes for this server.
- Make certain that the root account is permitted to login only using key authentication. If other users are required to be created in a later assignment, they should be permitted to log in with their username and password.
- Copy the same public key (already generated for your Host Machine for your root account in lab1) to the root account on your cloning-source.
- Test to make certain that you can login from root on your host machine to your root account on the cloning-course ("pangaea") without being prompted for a pass-phrase.
- If you have created a regular user when you installed this machine, delete that regular user (make certain to remove the regular user's home directory!).
Set-up Firewall Rules for your Cloning-Source
Perform the following steps for this section:
- Make certain that you have iptables services enabled and running instead of Firewalld.
- Modify the iptables to meet the following conditions:
- All outgoing traffic is allowed.
- Responses to any traffic the machine sends out are allowed.
- Traffic on the loopback interface is allowed.
- The host machine (and only the host machine) must be able to ssh to that cloning-source VM.
- ICMP traffic is allowed if it originated with the local network only.
- As this is acting as the secure basis for later machines, no other traffic should be allowed, and no response should be sent if any other traffic is received.
Create Full and Incremental Backups of cloning-source VM
Perform the following steps for this section:
- This task is to be performed in your host machine.
- Issue the command su -
- Create a Bash shell script called /root/bin/assnBackup.bash to perform a full backup using the gzip command to backup the entire file system of your cloning-source VM to save the compressed copy to the directory path: /backup/full/).
- This shell script should read each of any number of VM image files in the /var/lib/libvirt/images directory that has the extension ".qcow2". In this way, this shell script will safely backup any new VMs that are created later in this course, yet backup the existing labs and assignment VMs.
- Perform a Net-search to use the pv (pipe-viewer) command to show a text-based indicator of backup for EACH VM image file. You need to add the EPEL repository to install the pv command.
- Set execute permissions for this script, and run this Bash shell script prior to exiting your assignment work session to properly backup your cloning source. You should also make a copy of the backup on an external device (such as a USB key).
- Set-up via a crontab entry, an incremental backup of the /etc/ directory of your cloning-source to be performed every hour to the /backup/incremental/cloning-source directory.
Assignment Submission
The student is required to prove to their professor that their set-up works correctly during the regularly-scheduled lab period.
Assignment Evaluation Details
- Demonstrate working assignment to your instructor in class:
- Students can demonstrate their assignment functionality to their professor during a lab period (like you would for any lab for "sign-off").
- Students are required to prepare everything ahead of time so that you can quickly demonstrate to your instructor that all required parts of your assignment are working.
- The idea of the demonstration of your assignment to your instructor is to check for errors that may cause problems when running the checking script.
- Download and run a shell script to check your work:
- Login as root on your host machine.
- Change to the /root/bin directory.
- Make certain that your cloning-source VM is running.
- Issue the command to download a checking script for your assignment to your host machine:
wget https://matrix.senecacollege.ca/~ahad.mammadov/files/OPS335/check-assn1-p1.bash - Set execute permissions and run the shell script.
It will create a tar file for you to upload as your submission to blackboard.
Evaluation Rubric
Here is an evaluation rubric (in table form) showing you how you will be evaluated for this assignment. Part of the rubric is marked from professor observation from student demonstration of assignment in class, and the other part is based on output from the results of an assignment checking script that the student will download and run.
Student Demonstration (optional) | |
Evaluation Item | Mark |
Created Virtual Network: 335assign (correct settings) |
/1 |
Can ping cloning-source from host machine with correct IPADDR | /1 |
root account on host machine can connect to cloning-source VM via ssh application without password | /1 |
cloning-source VM can connect to the Internet (i.e. ping 8.8.8.8) |
/1 |
cloning-source can SSH to student's Matrix account | /1 |
Configuration (Checking Script Output) | |
Evaluation Item | Mark |
Hostname set to: pangaea only, domain name continents.earth.ops set as a network parameter | /1 |
yum update performed | /1 |
No regular users on cloning source (just root) | /1 |
SELinux status set to: enforcing | /1 |
firewalld stopped and inactive | /1 |
iptables active and enabled | /1 |
iptables - All outgoing traffic is allowed | /1 |
iptables - The host machine (and only the host machine) must be able to ssh to the cloning-source | /1 |
iptables - ICMP traffic is allowed if it originated with the local network only | /1 |
iptables - Other unexpected INPUT traffic is blocked without response | /1 |
iptables - all FORWARD traffic is blocked without response | /1 |
correct static network configuration for cloning-source VM (half mark for each network config item) |
/5 |
permitRootLogin set to yes for cloning-source VM | /1 |
Backup script assnBackup.bash structure | /1 |
Use of PV command for backup script | /1 |
Proof that VM full backup was run | /2 |
Crontab entries executed properly | /2 |
Incremental Backup of /etc/ directory of cloning-source to /backup/incremental/cloning-source directory | /2 |
TOTAL | /30 |