<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ihitc.net/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JonQuinn</id>
	<title>ITCwiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ihitc.net/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JonQuinn"/>
	<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/w/Special:Contributions/JonQuinn"/>
	<updated>2026-04-30T15:31:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.5</generator>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9604</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9604"/>
		<updated>2021-04-16T01:57:07Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Install the Postfix MTA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=6VsgO5695Z4&amp;amp;feature=youtu.be Video Tutorial - Install Postfix MTA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use a package manager to install the &#039;&#039;postfix&#039;&#039; package.&lt;br /&gt;
* During the installation process select &#039;&#039;Internet Site&#039;&#039; as the type of mail server and set the domain name to &#039;&#039;*.itc2480.campus.ihitc.net&#039;&#039; where * is the hostname letter of your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
: MTA software listens for incoming connections from other MTA servers on port 25 and accepts mail on behalf of users on the system. Once the mail is received it is stored locally for users to retrieve. The most common methods for storing messages is in an .mbox file, where all messages are stored in a single file, or in a Maildir, which is a directory where each message is stored in a separate file. The MTA also listens for connections from client software (MUA) and accepts outbound messages from them and forwards them on to the destination domain&#039;s mail server. Advanced configuration of MTA software can allow for anti-spam filtering, mailing list support or other programs to intercept and manipulate mail as it passes through the server.&lt;br /&gt;
&amp;lt;li&amp;gt;Test the connection an verify the port is open&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Use Telnet to connect to the Postfix SMTP server on port 25: &#039;&#039;&#039;telnet localhost 25&#039;&#039;&#039;&lt;br /&gt;
: [[File:Lab9_open_telnet.png|link=https://wiki.ihitc.net/mediawiki/images/1/10/Lab9_open_telnet.png|500px]]&lt;br /&gt;
: [[Media:Lab9_open_telnet.png | Click here for larger image]]&lt;br /&gt;
:* Type &#039;&#039;&#039;quit&#039;&#039;&#039; and press enter after verifying Postfix is running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Configure Maildir&amp;lt;/li&amp;gt;&lt;br /&gt;
: Because the Courier IMAP and POP3 server software only supports Maildir style message stores and Postfix stores in mbox files by default you must edit the &#039;&#039;/etc/postfix/main.cf&#039;&#039; file to fix this. &lt;br /&gt;
:* Add the line &lt;br /&gt;
:&amp;lt;pre&amp;gt;home_mailbox = Maildir/&amp;lt;/pre&amp;gt; &lt;br /&gt;
: Edit or add the &#039;&#039;mailbox_command&#039;&#039; parameter so there is nothing on the line after the equals sign, delete the portion of the line referencing procmail if it exists. The line should look like: &lt;br /&gt;
:&amp;lt;pre&amp;gt;mailbox_command = &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Restart the &#039;&#039;postfix&#039;&#039; service to apply your change. Postfix is now saving new incoming messages into the Maildir folder inside each user&#039;s home directory. This folder is automatically created by Postfix the first time a new message comes in for a user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Set your shell to recognize the maildir as your mail location&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/login.defs&#039;&#039; file and comment out the &#039;&#039;MAIL_DIR /var/mail&#039;&#039; line (place a # in front of the line) and add a line setting &#039;&#039;MAIL_FILE&#039;&#039; like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#MAIL_DIR        /var/mail&lt;br /&gt;
MAIL_FILE      Maildir/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/login&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so standard&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so standard&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/su&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so nopen&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so nopen&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir nopen&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/sshd&#039;&#039; file, find and comment out the &#039;&#039;session    optional     pam_mail.so standard noenv&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional     pam_mail.so standard noenv&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/profile&#039;&#039; file and at the end of the file add the line: &amp;lt;pre&amp;gt;export MAIL=~/Maildir&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Test sending and receiving mail as a locally logged on user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Install the &#039;&#039;mailutils&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try sending a message (replace username with your username): &amp;lt;pre&amp;gt;echo &amp;quot;This is my message&amp;quot; | mail -s &amp;quot;Email Subject&amp;quot; username@localhost&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Log out of your SSH session and open a new SSH session to apply the changes to the &#039;&#039;/etc/profile&#039;&#039; and &#039;&#039;/etc/login.defs&#039;&#039; files.&lt;br /&gt;
:* Check to see if the message was received using the &#039;&#039;&#039;mail&#039;&#039;&#039; command, press &#039;&#039;q&#039;&#039; to return to the command line.&lt;br /&gt;
:[[File:Lab9_cli_send_mail.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab9_cli_send_mail.png|500px]]&lt;br /&gt;
:[[Media:Lab9_cli_send_mail.png|Click here for a larger image]]&lt;br /&gt;
: You should also be able to see the message in &#039;&#039;~/Maildir/&#039;&#039; in either the &#039;&#039;new/&#039;&#039; or &#039;&#039;cur/&#039;&#039; directory depending on whether you have viewed the message list yet or not. In either case, the message will appear as a text file with a random-looking name. It&#039;s just a text file so you can use &#039;&#039;&#039;cat&#039;&#039;&#039; or &#039;&#039;&#039;less&#039;&#039;&#039; to view it.&lt;br /&gt;
&amp;lt;li&amp;gt; Create Aliases &amp;lt;/li&amp;gt;&lt;br /&gt;
: You can create aliases and forward mail between users by editing the &#039;&#039;/etc/aliases&#039;&#039; file and then running the &#039;&#039;&#039;newaliases&#039;&#039;&#039; program. &lt;br /&gt;
:* Create an &amp;quot;alias&amp;quot; for &#039;&#039;sysadmin&#039;&#039; which forwards mail sent to sysadmin@localhost to your username &lt;br /&gt;
:* Send a copy of all mail to the &#039;&#039;root&#039;&#039; account to your username &lt;br /&gt;
&lt;br /&gt;
: Now would be a good time to try logging on to Webmin again, re-scanning for modules and then taking a look at the Postfix module in the &#039;&#039;Servers&#039;&#039; section.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the mail log file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at your &#039;&#039;/var/log/mail.info&#039;&#039; log to see Postfix sending and receiving messages for users.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install Courier MDA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=uvZlSiQHlxs&amp;amp;feature=youtu.be Video Tutorial - Install Courier MDA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install required courier packages &amp;lt;/li&amp;gt;&lt;br /&gt;
: Most users prefer to retrieve mail from a mail server using an MDA protocol like POP3 or IMAP which can be provided by the Courier programs. Install the &#039;&#039;courier-pop&#039;&#039;, &#039;&#039;courier-imap&#039;&#039;, and &#039;&#039;fam&#039;&#039; packages.&lt;br /&gt;
:* Do not create the directories for web-based administration as they are unneeded for our setup&lt;br /&gt;
: Local users accessing their mailbox with MUA software can read and write to the .mbox file or Maildir directly. If a user not locally logged on to the system wants to access their mailbox the server runs MDA software which typically uses the POP3 or IMAP protocol for accessing the .mbox file or Maildir remotely.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/ping/Maildir/cur -type f -mtime +7  -exec rm {} \;&lt;br /&gt;
find /home/ping/Maildir/new -type f -mtime +7  -exec rm {} \;&lt;br /&gt;
find /home/ping/Maildir/tmp -type f -mtime +7  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9603</id>
		<title>Admin instructions mail server</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9603"/>
		<updated>2021-04-16T01:56:10Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Mail Server Documentation==&lt;br /&gt;
:Basic configuration of server should follow the standard class server (see labs 1 and 9)&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server, capstone group used 172.17.50.28&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install postfix, see lab 9&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/ping/Maildir/cur -type f -mtime +7  -exec rm {} \;&lt;br /&gt;
find /home/ping/Maildir/new -type f -mtime +7  -exec rm {} \;&lt;br /&gt;
find /home/ping/Maildir/tmp -type f -mtime +7  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9602</id>
		<title>Admin instructions mail server</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9602"/>
		<updated>2021-04-16T01:54:52Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Mail Server Documentation==&lt;br /&gt;
:Basic configuration of server should follow the standard class server (see labs 1 and 9)&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server, capstone group used 172.17.50.28&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install postfix, see lab 9&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/ping/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/ping/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/ping/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9601</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9601"/>
		<updated>2021-04-16T01:53:37Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Install the Postfix MTA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=6VsgO5695Z4&amp;amp;feature=youtu.be Video Tutorial - Install Postfix MTA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use a package manager to install the &#039;&#039;postfix&#039;&#039; package.&lt;br /&gt;
* During the installation process select &#039;&#039;Internet Site&#039;&#039; as the type of mail server and set the domain name to &#039;&#039;*.itc2480.campus.ihitc.net&#039;&#039; where * is the hostname letter of your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
: MTA software listens for incoming connections from other MTA servers on port 25 and accepts mail on behalf of users on the system. Once the mail is received it is stored locally for users to retrieve. The most common methods for storing messages is in an .mbox file, where all messages are stored in a single file, or in a Maildir, which is a directory where each message is stored in a separate file. The MTA also listens for connections from client software (MUA) and accepts outbound messages from them and forwards them on to the destination domain&#039;s mail server. Advanced configuration of MTA software can allow for anti-spam filtering, mailing list support or other programs to intercept and manipulate mail as it passes through the server.&lt;br /&gt;
&amp;lt;li&amp;gt;Test the connection an verify the port is open&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Use Telnet to connect to the Postfix SMTP server on port 25: &#039;&#039;&#039;telnet localhost 25&#039;&#039;&#039;&lt;br /&gt;
: [[File:Lab9_open_telnet.png|link=https://wiki.ihitc.net/mediawiki/images/1/10/Lab9_open_telnet.png|500px]]&lt;br /&gt;
: [[Media:Lab9_open_telnet.png | Click here for larger image]]&lt;br /&gt;
:* Type &#039;&#039;&#039;quit&#039;&#039;&#039; and press enter after verifying Postfix is running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Configure Maildir&amp;lt;/li&amp;gt;&lt;br /&gt;
: Because the Courier IMAP and POP3 server software only supports Maildir style message stores and Postfix stores in mbox files by default you must edit the &#039;&#039;/etc/postfix/main.cf&#039;&#039; file to fix this. &lt;br /&gt;
:* Add the line &lt;br /&gt;
:&amp;lt;pre&amp;gt;home_mailbox = Maildir/&amp;lt;/pre&amp;gt; &lt;br /&gt;
: Edit or add the &#039;&#039;mailbox_command&#039;&#039; parameter so there is nothing on the line after the equals sign, delete the portion of the line referencing procmail if it exists. The line should look like: &lt;br /&gt;
:&amp;lt;pre&amp;gt;mailbox_command = &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Restart the &#039;&#039;postfix&#039;&#039; service to apply your change. Postfix is now saving new incoming messages into the Maildir folder inside each user&#039;s home directory. This folder is automatically created by Postfix the first time a new message comes in for a user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Set your shell to recognize the maildir as your mail location&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/login.defs&#039;&#039; file and comment out the &#039;&#039;MAIL_DIR /var/mail&#039;&#039; line (place a # in front of the line) and add a line setting &#039;&#039;MAIL_FILE&#039;&#039; like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#MAIL_DIR        /var/mail&lt;br /&gt;
MAIL_FILE      Maildir/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/login&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so standard&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so standard&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/su&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so nopen&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so nopen&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir nopen&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/sshd&#039;&#039; file, find and comment out the &#039;&#039;session    optional     pam_mail.so standard noenv&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional     pam_mail.so standard noenv&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/profile&#039;&#039; file and at the end of the file add the line: &amp;lt;pre&amp;gt;export MAIL=~/Maildir&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Test sending and receiving mail as a locally logged on user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Install the &#039;&#039;mailutils&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try sending a message (replace username with your username): &amp;lt;pre&amp;gt;echo &amp;quot;This is my message&amp;quot; | mail -s &amp;quot;Email Subject&amp;quot; username@localhost&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Log out of your SSH session and open a new SSH session to apply the changes to the &#039;&#039;/etc/profile&#039;&#039; and &#039;&#039;/etc/login.defs&#039;&#039; files.&lt;br /&gt;
:* Check to see if the message was received using the &#039;&#039;&#039;mail&#039;&#039;&#039; command, press &#039;&#039;q&#039;&#039; to return to the command line.&lt;br /&gt;
:[[File:Lab9_cli_send_mail.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab9_cli_send_mail.png|500px]]&lt;br /&gt;
:[[Media:Lab9_cli_send_mail.png|Click here for a larger image]]&lt;br /&gt;
: You should also be able to see the message in &#039;&#039;~/Maildir/&#039;&#039; in either the &#039;&#039;new/&#039;&#039; or &#039;&#039;cur/&#039;&#039; directory depending on whether you have viewed the message list yet or not. In either case, the message will appear as a text file with a random-looking name. It&#039;s just a text file so you can use &#039;&#039;&#039;cat&#039;&#039;&#039; or &#039;&#039;&#039;less&#039;&#039;&#039; to view it.&lt;br /&gt;
&amp;lt;li&amp;gt; Create Aliases &amp;lt;/li&amp;gt;&lt;br /&gt;
: You can create aliases and forward mail between users by editing the &#039;&#039;/etc/aliases&#039;&#039; file and then running the &#039;&#039;&#039;newaliases&#039;&#039;&#039; program. &lt;br /&gt;
:* Create an &amp;quot;alias&amp;quot; for &#039;&#039;sysadmin&#039;&#039; which forwards mail sent to sysadmin@localhost to your username &lt;br /&gt;
:* Send a copy of all mail to the &#039;&#039;root&#039;&#039; account to your username &lt;br /&gt;
&lt;br /&gt;
: Now would be a good time to try logging on to Webmin again, re-scanning for modules and then taking a look at the Postfix module in the &#039;&#039;Servers&#039;&#039; section.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the mail log file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at your &#039;&#039;/var/log/mail.info&#039;&#039; log to see Postfix sending and receiving messages for users.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install Courier MDA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=uvZlSiQHlxs&amp;amp;feature=youtu.be Video Tutorial - Install Courier MDA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install required courier packages &amp;lt;/li&amp;gt;&lt;br /&gt;
: Most users prefer to retrieve mail from a mail server using an MDA protocol like POP3 or IMAP which can be provided by the Courier programs. Install the &#039;&#039;courier-pop&#039;&#039;, &#039;&#039;courier-imap&#039;&#039;, and &#039;&#039;fam&#039;&#039; packages.&lt;br /&gt;
:* Do not create the directories for web-based administration as they are unneeded for our setup&lt;br /&gt;
: Local users accessing their mailbox with MUA software can read and write to the .mbox file or Maildir directly. If a user not locally logged on to the system wants to access their mailbox the server runs MDA software which typically uses the POP3 or IMAP protocol for accessing the .mbox file or Maildir remotely.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/ping/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/ping/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/ping/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9598</id>
		<title>Lab 1 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9598"/>
		<updated>2021-04-05T23:42:02Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Curl */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
:In this lab you will perform the following tasks:&lt;br /&gt;
*Access NetLab to access the environment for you virtual machine&lt;br /&gt;
*Install the latest version of Debian Linux in a virtual machine&lt;br /&gt;
*Learn how to login and check the IP address of the system&lt;br /&gt;
*Learn to remotely access the system with SSH and SFTP.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/apt apt]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/sudo sudo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/useradd adduser]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ip ip address show]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Netlab Access==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=-hLejbDfPGM&amp;amp;feature=youtu.be Video Tutorial - NetLab Access]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Connect to the ITCnet &amp;lt;/li&amp;gt; &lt;br /&gt;
: This can be accomplished by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the [[ITC_VPN_Instructions|VPN]].&lt;br /&gt;
:&#039;&#039; Note: If you want to connect using a wireless connection on campus you need to [[Connecting to Eduroam|connect to the eduroam network]] before connecting to the VPN.&lt;br /&gt;
&amp;lt;li&amp;gt; After you are connected to ITCnet (by VPN or wired connection) you simply need to open a web browser and access https://ihcc-netlab.campus.ihitc.net&amp;lt;/li&amp;gt;&lt;br /&gt;
*  The first time you visit this site in a browser you may need to accept a self-signed security certificate&lt;br /&gt;
*  You will need to log in with a username and password established by your instructor.&lt;br /&gt;
*  The first time you log in you will need to change your password and set your timezone. Make sure your timezone is set correctly so you can schedule reservations to work with equipment at convenient times.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are logged in click the blue &amp;quot;New Lab Reservation&amp;quot; button&amp;lt;/li&amp;gt;&lt;br /&gt;
: Next, in the lower left corner of the screen, select &amp;quot;Schedule a Lab for Myself&amp;quot;. Reservations are used to hold a place on the Netlab system to work on labs during a specific time. You only need reservations in this class when working with the GUI, which will come later in the class, if you need to turn the power back on to your VM, or during the installation process. The rest of the time you will be able to connect directly to your Linux server using the SSH protocol, but more on that in a bit.&lt;br /&gt;
:&#039;&#039; Note: If you are enrolled in more than one class that is using Netlab you will be presented with a list of classes you are enrolled in, click on your Linux System Administration course of you see this screen.&lt;br /&gt;
: All of our lab work in this class is done in a single &amp;quot;Lab Environment&amp;quot; and your progress will be saved from one reservation to another. As a result there is only one lab listed in this course &amp;quot;Linux System Administration Labs&amp;quot;. Click on this lab title.&lt;br /&gt;
&amp;lt;li&amp;gt; Use the calendar to choose a date, time, and specific pod to reserve for your lab activity (when you will begin your Debian server installation).&amp;lt;/li&amp;gt;&lt;br /&gt;
: The red line on this screen indicates the current time. If you want to get started right away you can click just below this line. Pay attention to the title of the column at the top, it will say something like &amp;quot;LSA Pod Z&amp;quot;. The letter at the end of this pod name is your &amp;quot;pod letter&amp;quot; which you will use to set the host name and IP address of your machine in the future so make note of it.&lt;br /&gt;
: You will be presented with a summary screen for your reservation where you can set the end time of your reservation (up to a maximum). It is suggested to make your reservation a couple hours long the first time you plan to install Debian, though you can extend it if needed. Click submit once you are ready to make the reservation.&lt;br /&gt;
&amp;lt;li&amp;gt;You will see a confirmation screen that your reservation has been made.&amp;lt;/li&amp;gt;&lt;br /&gt;
: You are now ready to progress on to the Debian Linux Installation (as long as your reservation is right away).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debian Linux Installation==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=H0DcdEytpFQ&amp;amp;feature=youtu.be Video Tutorial - Debian Linux Installation]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Log in to the Netlab system&amp;lt;/li&amp;gt;&lt;br /&gt;
: Access this using a web browser at https://ihcc-netlab.campus.ihitc.net if you are not already logged in.&lt;br /&gt;
: If you have a currently active reservation you will see a green &amp;quot;Enter Lab&amp;quot; button on your list of reservations. Click the green &amp;quot;Enter Lab&amp;quot; button. If not, you will need to make a reservation (see above) and then click the &amp;quot;Enter Lab&amp;quot; button.&lt;br /&gt;
: Your virtual machines (VMs) will automatically power on when your reservation begins and because there is no operating system currently installed to their virtual hard drives they will boot from their virtual CD/DVD drives which have been pre-loaded with the installation discs for Linux.&lt;br /&gt;
&amp;lt;li&amp;gt; Access you virtual machine console&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you are in your pod you can either click on the image of the &amp;quot;Linux Server&amp;quot; on the topology diagram or use the tabs across the top of your screen to access the console of your Linux Server VM.&lt;br /&gt;
: The console shows the display of your VM and allows you to type and interact with your VM just as if you were physically sitting down in front of a server with a monitor, keyboard, and mouse attached. Just like a separate physical machine you will not be able to copy and paste text or drag and drop files in and out of this console window. We will use other utilities across the network connection to do those things just like we would with a physical server.&lt;br /&gt;
&amp;lt;li&amp;gt;Learn to &amp;quot;Power Cycle&amp;quot; your virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: By now your VM has likely already booted from it&#039;s virtual CD/DVD drive and should be at the &amp;quot;Debian GNU/Linux installer menu&amp;quot;. Before continuing let&#039;s practice rebooting your system so you can watch the system boot and see how to reboot the system if needed. Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power Off&amp;quot; then click the red &amp;quot;Power Off&amp;quot; button on the popup to power off your VM. This is the equivalent of just pulling out the power cord, at least until we install the VMware Tools software which allows for a graceful shutdown, so you&#039;ll want to be careful to only do this if absolutely needed until then.&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power On&amp;quot;, or press the blue &amp;quot;Power On&amp;quot; button in the middle of your screen, then press the green &amp;quot;Power On&amp;quot; button to boot your system.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has rebooted and is back to the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Installing sudo and Checking Your IP Address==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=TwXp5YfAvlw&amp;amp;feature=youtu.be Video Tutorial - Installing sudo and checking your IP address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Log in to NetLab&amp;lt;/li&amp;gt;&lt;br /&gt;
: Login through the Netlab local console with your root account and password (username &#039;&#039;root&#039;&#039;, password as set during the installation)&lt;br /&gt;
:&#039;&#039; Note: When entering a password on the command line of a Linux system it is normal that nothing should appear and the cursor will not move when you are typing. This prevents someone who is able to see your computer screen from seeing what your password is or even how long it is. Just type your password and trust that the system is receiving it, press enter to submit your password.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
[[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Logging in to a Remote Terminal==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Logging into a remote terminal]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A faster way to interact with your system is not through the Netlab local console but through a remote SSH session over the network directly to your server. Once you have mastered this you will be able to copy and paste text to your Linux server and will not need to make a reservation in Netlab to work on labs. For our purposes you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Putty&amp;lt;/li&amp;gt;&lt;br /&gt;
: Assuming you are running Windows, install the PuTTY software on your home PC from [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html this website].&lt;br /&gt;
: &#039;&#039;  Note: For other operating systems there are other ways and software you can use to make an SSH connection, you will need to research what tools are used for making SSH connections from your particular operating system.&lt;br /&gt;
&amp;lt;li&amp;gt;Open an SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the PuTTY software on your computer and enter in the IP address of your VM in the &amp;quot;Host Name&amp;quot; box and click the &amp;quot;Open&amp;quot; button.&lt;br /&gt;
:[[File:Lab1_putty.png|link=https://wiki.ihitc.net/mediawiki/images/f/f5/Lab1_putty.png|500px]]&lt;br /&gt;
:[[Media:Lab1_putty.png| Click here for larger image]]&lt;br /&gt;
:* Click Yes to save the host key on your system&lt;br /&gt;
: [[File:Lab1_puttycert.png|link=https://wiki.ihitc.net/mediawiki/images/4/4b/Lab1_puttycert.png|500px]]&lt;br /&gt;
: [[Media:Lab1_puttycert.png|Click here for larger image]]&lt;br /&gt;
:* Enter the standard username and password for your Linux system to connect.&lt;br /&gt;
: &#039;&#039;  Note: You should receive a prompt just like the one you had on the Netlab local console but it is now a direct connection from your computer over the ITCnet to your server.&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Remote File Transfer==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Remote File Transfer]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The easiest way to transfer files to and from your VM is with SFTP software. For our purposes, you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install FileZilla&amp;lt;/li&amp;gt;&lt;br /&gt;
: Install the FileZilla client software on your home PC from [https://filezilla-project.org/download.php?type=client this website]&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SFTP session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run FileZilla and use the Quick Connect bar at the top of the screen to access your system. &lt;br /&gt;
:*  Enter the IP address of your Linux system in the &amp;quot;Host:&amp;quot; box&lt;br /&gt;
:*  Enter your standard username and password in the appropriate boxes&lt;br /&gt;
:*  Enter &#039;&#039;22&#039;&#039; in the &amp;quot;Port:&amp;quot; box&lt;br /&gt;
:*  Click the &amp;quot;Quickconnect&amp;quot; button.&lt;br /&gt;
: [[File:Lab1_filezillanew.png|link=https://wiki.ihitc.net/mediawiki/images/b/b1/Lab1_filezillanew.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillanew.png|Click here for larger image]]&lt;br /&gt;
: You should see some connection text scroll on the top of the screen and some files on the right side of the screen now such as &#039;&#039;.bashrc&#039;&#039; and &#039;&#039;.profile&#039;&#039; The right side of the screen is the drive on your Linux system and the left side of the screen is the drive on your home system. Files and folders can be dragged between the two sides to transfer them back and forth.&lt;br /&gt;
: [[File:Lab1_filezillaconnected.png|link=https://wiki.ihitc.net/mediawiki/images/c/ca/Lab1_filezillaconnected.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillaconnected.png|Click here for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Close the FileZilla software to disconnect.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install VM Tools==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Install VM Tools]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect into your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Python==&lt;br /&gt;
In order to check your work in the labs of this course you will need to have an application called [https://www.python.org/ Python] installed on your Linux system.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Download &#039;&#039;python3&#039;&#039; using &#039;&#039;&#039;apt&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
* When prompted type Y to install the app and its dependencies&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&#039;&#039;NOTE: This may take a while.&#039;&#039;&amp;lt;/ul&amp;gt;&lt;br /&gt;
* When prompted to specify the name of the host where the TANGO database server is running, just select ok.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_tango.png|link=https://wiki.ihitc.net/mediawiki/images/4/4c/Python_tango.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_tango.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to verify that python version 3.6 is installed.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;python3 --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_version.png|link=https://wiki.ihitc.net/mediawiki/images/7/70/Python_version.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_version.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Nmap==&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:* &#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the following command at the command line.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install nmap&amp;lt;/code&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Curl==&lt;br /&gt;
:Curl is a tool that lets you run scripts that are not saved to your virtual machine. It will be used to check the labs for completion while working through the course.  &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command at the command line. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install curl&amp;lt;/code&amp;gt;&lt;br /&gt;
: If prompted to install additional packages type &amp;quot;y&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
:     Installing Curl will allow you to check each of your labs for completion of some of the critical objectives of the lab work using a command in the &amp;quot;Checking your Work&amp;quot; section of the labs.  This will usually be completed as the last step of the lab, but for this lab please run the following command now to check your work.&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Safely Shutdown==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Safely Shutdown]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
:We will normally leave our VM running but it is important that you know how to shutdown a Linux system correctly so this time we&#039;ll turn it off.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect in to your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt; Safely shutdown you server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the &#039;&#039;&#039;sudo shutdown -h now&#039;&#039;&#039; at the command line to safely shutdown the system.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo shutdown -h now&amp;lt;/code&amp;gt;&lt;br /&gt;
: You should soon get a message that PuTTY has lost it&#039;s connection. Click OK and then you can close the PuTTY window.&lt;br /&gt;
&amp;lt;li&amp;gt;End NetLab Reservation&amp;lt;/li&amp;gt;&lt;br /&gt;
: If you still have time left in your reservation in Netlab it&#039;s polite to end the reservation so other users can work on the system, only a limited number of reservations can be made at one time. You can do this by logging into Netlab, opening your lab, and clicking the &amp;quot;Reservation&amp;quot; menu at the top of the screen and choose to &amp;quot;End Reservation Now&amp;quot; followed by confirming that you want to end the reservation.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;This section will cover ways to manually check your work&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;ul&amp;gt;For this lab each section was tested in the process of the lab.  You should have successfully connected an SSH session with putty, and an ftp session with FileZilla.&amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;ul&amp;gt;You should have shut down you server in one of the last steps, so no further testing is necessary at this time.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9597</id>
		<title>Lab 1 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9597"/>
		<updated>2021-04-05T23:41:31Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Curl */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
:In this lab you will perform the following tasks:&lt;br /&gt;
*Access NetLab to access the environment for you virtual machine&lt;br /&gt;
*Install the latest version of Debian Linux in a virtual machine&lt;br /&gt;
*Learn how to login and check the IP address of the system&lt;br /&gt;
*Learn to remotely access the system with SSH and SFTP.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/apt apt]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/sudo sudo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/useradd adduser]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ip ip address show]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Netlab Access==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=-hLejbDfPGM&amp;amp;feature=youtu.be Video Tutorial - NetLab Access]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Connect to the ITCnet &amp;lt;/li&amp;gt; &lt;br /&gt;
: This can be accomplished by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the [[ITC_VPN_Instructions|VPN]].&lt;br /&gt;
:&#039;&#039; Note: If you want to connect using a wireless connection on campus you need to [[Connecting to Eduroam|connect to the eduroam network]] before connecting to the VPN.&lt;br /&gt;
&amp;lt;li&amp;gt; After you are connected to ITCnet (by VPN or wired connection) you simply need to open a web browser and access https://ihcc-netlab.campus.ihitc.net&amp;lt;/li&amp;gt;&lt;br /&gt;
*  The first time you visit this site in a browser you may need to accept a self-signed security certificate&lt;br /&gt;
*  You will need to log in with a username and password established by your instructor.&lt;br /&gt;
*  The first time you log in you will need to change your password and set your timezone. Make sure your timezone is set correctly so you can schedule reservations to work with equipment at convenient times.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are logged in click the blue &amp;quot;New Lab Reservation&amp;quot; button&amp;lt;/li&amp;gt;&lt;br /&gt;
: Next, in the lower left corner of the screen, select &amp;quot;Schedule a Lab for Myself&amp;quot;. Reservations are used to hold a place on the Netlab system to work on labs during a specific time. You only need reservations in this class when working with the GUI, which will come later in the class, if you need to turn the power back on to your VM, or during the installation process. The rest of the time you will be able to connect directly to your Linux server using the SSH protocol, but more on that in a bit.&lt;br /&gt;
:&#039;&#039; Note: If you are enrolled in more than one class that is using Netlab you will be presented with a list of classes you are enrolled in, click on your Linux System Administration course of you see this screen.&lt;br /&gt;
: All of our lab work in this class is done in a single &amp;quot;Lab Environment&amp;quot; and your progress will be saved from one reservation to another. As a result there is only one lab listed in this course &amp;quot;Linux System Administration Labs&amp;quot;. Click on this lab title.&lt;br /&gt;
&amp;lt;li&amp;gt; Use the calendar to choose a date, time, and specific pod to reserve for your lab activity (when you will begin your Debian server installation).&amp;lt;/li&amp;gt;&lt;br /&gt;
: The red line on this screen indicates the current time. If you want to get started right away you can click just below this line. Pay attention to the title of the column at the top, it will say something like &amp;quot;LSA Pod Z&amp;quot;. The letter at the end of this pod name is your &amp;quot;pod letter&amp;quot; which you will use to set the host name and IP address of your machine in the future so make note of it.&lt;br /&gt;
: You will be presented with a summary screen for your reservation where you can set the end time of your reservation (up to a maximum). It is suggested to make your reservation a couple hours long the first time you plan to install Debian, though you can extend it if needed. Click submit once you are ready to make the reservation.&lt;br /&gt;
&amp;lt;li&amp;gt;You will see a confirmation screen that your reservation has been made.&amp;lt;/li&amp;gt;&lt;br /&gt;
: You are now ready to progress on to the Debian Linux Installation (as long as your reservation is right away).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debian Linux Installation==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=H0DcdEytpFQ&amp;amp;feature=youtu.be Video Tutorial - Debian Linux Installation]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Log in to the Netlab system&amp;lt;/li&amp;gt;&lt;br /&gt;
: Access this using a web browser at https://ihcc-netlab.campus.ihitc.net if you are not already logged in.&lt;br /&gt;
: If you have a currently active reservation you will see a green &amp;quot;Enter Lab&amp;quot; button on your list of reservations. Click the green &amp;quot;Enter Lab&amp;quot; button. If not, you will need to make a reservation (see above) and then click the &amp;quot;Enter Lab&amp;quot; button.&lt;br /&gt;
: Your virtual machines (VMs) will automatically power on when your reservation begins and because there is no operating system currently installed to their virtual hard drives they will boot from their virtual CD/DVD drives which have been pre-loaded with the installation discs for Linux.&lt;br /&gt;
&amp;lt;li&amp;gt; Access you virtual machine console&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you are in your pod you can either click on the image of the &amp;quot;Linux Server&amp;quot; on the topology diagram or use the tabs across the top of your screen to access the console of your Linux Server VM.&lt;br /&gt;
: The console shows the display of your VM and allows you to type and interact with your VM just as if you were physically sitting down in front of a server with a monitor, keyboard, and mouse attached. Just like a separate physical machine you will not be able to copy and paste text or drag and drop files in and out of this console window. We will use other utilities across the network connection to do those things just like we would with a physical server.&lt;br /&gt;
&amp;lt;li&amp;gt;Learn to &amp;quot;Power Cycle&amp;quot; your virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: By now your VM has likely already booted from it&#039;s virtual CD/DVD drive and should be at the &amp;quot;Debian GNU/Linux installer menu&amp;quot;. Before continuing let&#039;s practice rebooting your system so you can watch the system boot and see how to reboot the system if needed. Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power Off&amp;quot; then click the red &amp;quot;Power Off&amp;quot; button on the popup to power off your VM. This is the equivalent of just pulling out the power cord, at least until we install the VMware Tools software which allows for a graceful shutdown, so you&#039;ll want to be careful to only do this if absolutely needed until then.&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power On&amp;quot;, or press the blue &amp;quot;Power On&amp;quot; button in the middle of your screen, then press the green &amp;quot;Power On&amp;quot; button to boot your system.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has rebooted and is back to the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Installing sudo and Checking Your IP Address==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=TwXp5YfAvlw&amp;amp;feature=youtu.be Video Tutorial - Installing sudo and checking your IP address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Log in to NetLab&amp;lt;/li&amp;gt;&lt;br /&gt;
: Login through the Netlab local console with your root account and password (username &#039;&#039;root&#039;&#039;, password as set during the installation)&lt;br /&gt;
:&#039;&#039; Note: When entering a password on the command line of a Linux system it is normal that nothing should appear and the cursor will not move when you are typing. This prevents someone who is able to see your computer screen from seeing what your password is or even how long it is. Just type your password and trust that the system is receiving it, press enter to submit your password.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
[[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Logging in to a Remote Terminal==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Logging into a remote terminal]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A faster way to interact with your system is not through the Netlab local console but through a remote SSH session over the network directly to your server. Once you have mastered this you will be able to copy and paste text to your Linux server and will not need to make a reservation in Netlab to work on labs. For our purposes you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Putty&amp;lt;/li&amp;gt;&lt;br /&gt;
: Assuming you are running Windows, install the PuTTY software on your home PC from [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html this website].&lt;br /&gt;
: &#039;&#039;  Note: For other operating systems there are other ways and software you can use to make an SSH connection, you will need to research what tools are used for making SSH connections from your particular operating system.&lt;br /&gt;
&amp;lt;li&amp;gt;Open an SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the PuTTY software on your computer and enter in the IP address of your VM in the &amp;quot;Host Name&amp;quot; box and click the &amp;quot;Open&amp;quot; button.&lt;br /&gt;
:[[File:Lab1_putty.png|link=https://wiki.ihitc.net/mediawiki/images/f/f5/Lab1_putty.png|500px]]&lt;br /&gt;
:[[Media:Lab1_putty.png| Click here for larger image]]&lt;br /&gt;
:* Click Yes to save the host key on your system&lt;br /&gt;
: [[File:Lab1_puttycert.png|link=https://wiki.ihitc.net/mediawiki/images/4/4b/Lab1_puttycert.png|500px]]&lt;br /&gt;
: [[Media:Lab1_puttycert.png|Click here for larger image]]&lt;br /&gt;
:* Enter the standard username and password for your Linux system to connect.&lt;br /&gt;
: &#039;&#039;  Note: You should receive a prompt just like the one you had on the Netlab local console but it is now a direct connection from your computer over the ITCnet to your server.&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Remote File Transfer==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Remote File Transfer]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The easiest way to transfer files to and from your VM is with SFTP software. For our purposes, you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install FileZilla&amp;lt;/li&amp;gt;&lt;br /&gt;
: Install the FileZilla client software on your home PC from [https://filezilla-project.org/download.php?type=client this website]&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SFTP session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run FileZilla and use the Quick Connect bar at the top of the screen to access your system. &lt;br /&gt;
:*  Enter the IP address of your Linux system in the &amp;quot;Host:&amp;quot; box&lt;br /&gt;
:*  Enter your standard username and password in the appropriate boxes&lt;br /&gt;
:*  Enter &#039;&#039;22&#039;&#039; in the &amp;quot;Port:&amp;quot; box&lt;br /&gt;
:*  Click the &amp;quot;Quickconnect&amp;quot; button.&lt;br /&gt;
: [[File:Lab1_filezillanew.png|link=https://wiki.ihitc.net/mediawiki/images/b/b1/Lab1_filezillanew.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillanew.png|Click here for larger image]]&lt;br /&gt;
: You should see some connection text scroll on the top of the screen and some files on the right side of the screen now such as &#039;&#039;.bashrc&#039;&#039; and &#039;&#039;.profile&#039;&#039; The right side of the screen is the drive on your Linux system and the left side of the screen is the drive on your home system. Files and folders can be dragged between the two sides to transfer them back and forth.&lt;br /&gt;
: [[File:Lab1_filezillaconnected.png|link=https://wiki.ihitc.net/mediawiki/images/c/ca/Lab1_filezillaconnected.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillaconnected.png|Click here for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Close the FileZilla software to disconnect.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install VM Tools==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Install VM Tools]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect into your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Python==&lt;br /&gt;
In order to check your work in the labs of this course you will need to have an application called [https://www.python.org/ Python] installed on your Linux system.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Download &#039;&#039;python3&#039;&#039; using &#039;&#039;&#039;apt&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
* When prompted type Y to install the app and its dependencies&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&#039;&#039;NOTE: This may take a while.&#039;&#039;&amp;lt;/ul&amp;gt;&lt;br /&gt;
* When prompted to specify the name of the host where the TANGO database server is running, just select ok.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_tango.png|link=https://wiki.ihitc.net/mediawiki/images/4/4c/Python_tango.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_tango.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to verify that python version 3.6 is installed.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;python3 --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_version.png|link=https://wiki.ihitc.net/mediawiki/images/7/70/Python_version.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_version.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Nmap==&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:* &#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the following command at the command line.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install nmap&amp;lt;/code&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Curl==&lt;br /&gt;
:Curl is a tool that lets you run scripts that are not saved to your virtual machine. It will be used to check the labs for completion while working through the course.  &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command at the command line. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install curl&amp;lt;/code&amp;gt;&lt;br /&gt;
: If prompted to install additional packages type &amp;quot;y&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
:     Installing Curl will allow you to check each of your labs for completion of some of the critical objectives of the lab work using a command in the Checking your Work section of the labs.  This will usually be completed as the last step of the lab, but for this lab please run the following command now to check your work.&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Safely Shutdown==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Safely Shutdown]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
:We will normally leave our VM running but it is important that you know how to shutdown a Linux system correctly so this time we&#039;ll turn it off.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect in to your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt; Safely shutdown you server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the &#039;&#039;&#039;sudo shutdown -h now&#039;&#039;&#039; at the command line to safely shutdown the system.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo shutdown -h now&amp;lt;/code&amp;gt;&lt;br /&gt;
: You should soon get a message that PuTTY has lost it&#039;s connection. Click OK and then you can close the PuTTY window.&lt;br /&gt;
&amp;lt;li&amp;gt;End NetLab Reservation&amp;lt;/li&amp;gt;&lt;br /&gt;
: If you still have time left in your reservation in Netlab it&#039;s polite to end the reservation so other users can work on the system, only a limited number of reservations can be made at one time. You can do this by logging into Netlab, opening your lab, and clicking the &amp;quot;Reservation&amp;quot; menu at the top of the screen and choose to &amp;quot;End Reservation Now&amp;quot; followed by confirming that you want to end the reservation.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;This section will cover ways to manually check your work&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;ul&amp;gt;For this lab each section was tested in the process of the lab.  You should have successfully connected an SSH session with putty, and an ftp session with FileZilla.&amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;ul&amp;gt;You should have shut down you server in one of the last steps, so no further testing is necessary at this time.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9596</id>
		<title>Lab 1 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9596"/>
		<updated>2021-04-05T23:40:13Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Curl */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
:In this lab you will perform the following tasks:&lt;br /&gt;
*Access NetLab to access the environment for you virtual machine&lt;br /&gt;
*Install the latest version of Debian Linux in a virtual machine&lt;br /&gt;
*Learn how to login and check the IP address of the system&lt;br /&gt;
*Learn to remotely access the system with SSH and SFTP.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/apt apt]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/sudo sudo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/useradd adduser]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ip ip address show]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Netlab Access==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=-hLejbDfPGM&amp;amp;feature=youtu.be Video Tutorial - NetLab Access]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Connect to the ITCnet &amp;lt;/li&amp;gt; &lt;br /&gt;
: This can be accomplished by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the [[ITC_VPN_Instructions|VPN]].&lt;br /&gt;
:&#039;&#039; Note: If you want to connect using a wireless connection on campus you need to [[Connecting to Eduroam|connect to the eduroam network]] before connecting to the VPN.&lt;br /&gt;
&amp;lt;li&amp;gt; After you are connected to ITCnet (by VPN or wired connection) you simply need to open a web browser and access https://ihcc-netlab.campus.ihitc.net&amp;lt;/li&amp;gt;&lt;br /&gt;
*  The first time you visit this site in a browser you may need to accept a self-signed security certificate&lt;br /&gt;
*  You will need to log in with a username and password established by your instructor.&lt;br /&gt;
*  The first time you log in you will need to change your password and set your timezone. Make sure your timezone is set correctly so you can schedule reservations to work with equipment at convenient times.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are logged in click the blue &amp;quot;New Lab Reservation&amp;quot; button&amp;lt;/li&amp;gt;&lt;br /&gt;
: Next, in the lower left corner of the screen, select &amp;quot;Schedule a Lab for Myself&amp;quot;. Reservations are used to hold a place on the Netlab system to work on labs during a specific time. You only need reservations in this class when working with the GUI, which will come later in the class, if you need to turn the power back on to your VM, or during the installation process. The rest of the time you will be able to connect directly to your Linux server using the SSH protocol, but more on that in a bit.&lt;br /&gt;
:&#039;&#039; Note: If you are enrolled in more than one class that is using Netlab you will be presented with a list of classes you are enrolled in, click on your Linux System Administration course of you see this screen.&lt;br /&gt;
: All of our lab work in this class is done in a single &amp;quot;Lab Environment&amp;quot; and your progress will be saved from one reservation to another. As a result there is only one lab listed in this course &amp;quot;Linux System Administration Labs&amp;quot;. Click on this lab title.&lt;br /&gt;
&amp;lt;li&amp;gt; Use the calendar to choose a date, time, and specific pod to reserve for your lab activity (when you will begin your Debian server installation).&amp;lt;/li&amp;gt;&lt;br /&gt;
: The red line on this screen indicates the current time. If you want to get started right away you can click just below this line. Pay attention to the title of the column at the top, it will say something like &amp;quot;LSA Pod Z&amp;quot;. The letter at the end of this pod name is your &amp;quot;pod letter&amp;quot; which you will use to set the host name and IP address of your machine in the future so make note of it.&lt;br /&gt;
: You will be presented with a summary screen for your reservation where you can set the end time of your reservation (up to a maximum). It is suggested to make your reservation a couple hours long the first time you plan to install Debian, though you can extend it if needed. Click submit once you are ready to make the reservation.&lt;br /&gt;
&amp;lt;li&amp;gt;You will see a confirmation screen that your reservation has been made.&amp;lt;/li&amp;gt;&lt;br /&gt;
: You are now ready to progress on to the Debian Linux Installation (as long as your reservation is right away).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debian Linux Installation==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=H0DcdEytpFQ&amp;amp;feature=youtu.be Video Tutorial - Debian Linux Installation]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Log in to the Netlab system&amp;lt;/li&amp;gt;&lt;br /&gt;
: Access this using a web browser at https://ihcc-netlab.campus.ihitc.net if you are not already logged in.&lt;br /&gt;
: If you have a currently active reservation you will see a green &amp;quot;Enter Lab&amp;quot; button on your list of reservations. Click the green &amp;quot;Enter Lab&amp;quot; button. If not, you will need to make a reservation (see above) and then click the &amp;quot;Enter Lab&amp;quot; button.&lt;br /&gt;
: Your virtual machines (VMs) will automatically power on when your reservation begins and because there is no operating system currently installed to their virtual hard drives they will boot from their virtual CD/DVD drives which have been pre-loaded with the installation discs for Linux.&lt;br /&gt;
&amp;lt;li&amp;gt; Access you virtual machine console&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you are in your pod you can either click on the image of the &amp;quot;Linux Server&amp;quot; on the topology diagram or use the tabs across the top of your screen to access the console of your Linux Server VM.&lt;br /&gt;
: The console shows the display of your VM and allows you to type and interact with your VM just as if you were physically sitting down in front of a server with a monitor, keyboard, and mouse attached. Just like a separate physical machine you will not be able to copy and paste text or drag and drop files in and out of this console window. We will use other utilities across the network connection to do those things just like we would with a physical server.&lt;br /&gt;
&amp;lt;li&amp;gt;Learn to &amp;quot;Power Cycle&amp;quot; your virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: By now your VM has likely already booted from it&#039;s virtual CD/DVD drive and should be at the &amp;quot;Debian GNU/Linux installer menu&amp;quot;. Before continuing let&#039;s practice rebooting your system so you can watch the system boot and see how to reboot the system if needed. Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power Off&amp;quot; then click the red &amp;quot;Power Off&amp;quot; button on the popup to power off your VM. This is the equivalent of just pulling out the power cord, at least until we install the VMware Tools software which allows for a graceful shutdown, so you&#039;ll want to be careful to only do this if absolutely needed until then.&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power On&amp;quot;, or press the blue &amp;quot;Power On&amp;quot; button in the middle of your screen, then press the green &amp;quot;Power On&amp;quot; button to boot your system.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has rebooted and is back to the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Installing sudo and Checking Your IP Address==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=TwXp5YfAvlw&amp;amp;feature=youtu.be Video Tutorial - Installing sudo and checking your IP address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Log in to NetLab&amp;lt;/li&amp;gt;&lt;br /&gt;
: Login through the Netlab local console with your root account and password (username &#039;&#039;root&#039;&#039;, password as set during the installation)&lt;br /&gt;
:&#039;&#039; Note: When entering a password on the command line of a Linux system it is normal that nothing should appear and the cursor will not move when you are typing. This prevents someone who is able to see your computer screen from seeing what your password is or even how long it is. Just type your password and trust that the system is receiving it, press enter to submit your password.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
[[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Logging in to a Remote Terminal==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Logging into a remote terminal]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A faster way to interact with your system is not through the Netlab local console but through a remote SSH session over the network directly to your server. Once you have mastered this you will be able to copy and paste text to your Linux server and will not need to make a reservation in Netlab to work on labs. For our purposes you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Putty&amp;lt;/li&amp;gt;&lt;br /&gt;
: Assuming you are running Windows, install the PuTTY software on your home PC from [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html this website].&lt;br /&gt;
: &#039;&#039;  Note: For other operating systems there are other ways and software you can use to make an SSH connection, you will need to research what tools are used for making SSH connections from your particular operating system.&lt;br /&gt;
&amp;lt;li&amp;gt;Open an SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the PuTTY software on your computer and enter in the IP address of your VM in the &amp;quot;Host Name&amp;quot; box and click the &amp;quot;Open&amp;quot; button.&lt;br /&gt;
:[[File:Lab1_putty.png|link=https://wiki.ihitc.net/mediawiki/images/f/f5/Lab1_putty.png|500px]]&lt;br /&gt;
:[[Media:Lab1_putty.png| Click here for larger image]]&lt;br /&gt;
:* Click Yes to save the host key on your system&lt;br /&gt;
: [[File:Lab1_puttycert.png|link=https://wiki.ihitc.net/mediawiki/images/4/4b/Lab1_puttycert.png|500px]]&lt;br /&gt;
: [[Media:Lab1_puttycert.png|Click here for larger image]]&lt;br /&gt;
:* Enter the standard username and password for your Linux system to connect.&lt;br /&gt;
: &#039;&#039;  Note: You should receive a prompt just like the one you had on the Netlab local console but it is now a direct connection from your computer over the ITCnet to your server.&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Remote File Transfer==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Remote File Transfer]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The easiest way to transfer files to and from your VM is with SFTP software. For our purposes, you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install FileZilla&amp;lt;/li&amp;gt;&lt;br /&gt;
: Install the FileZilla client software on your home PC from [https://filezilla-project.org/download.php?type=client this website]&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SFTP session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run FileZilla and use the Quick Connect bar at the top of the screen to access your system. &lt;br /&gt;
:*  Enter the IP address of your Linux system in the &amp;quot;Host:&amp;quot; box&lt;br /&gt;
:*  Enter your standard username and password in the appropriate boxes&lt;br /&gt;
:*  Enter &#039;&#039;22&#039;&#039; in the &amp;quot;Port:&amp;quot; box&lt;br /&gt;
:*  Click the &amp;quot;Quickconnect&amp;quot; button.&lt;br /&gt;
: [[File:Lab1_filezillanew.png|link=https://wiki.ihitc.net/mediawiki/images/b/b1/Lab1_filezillanew.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillanew.png|Click here for larger image]]&lt;br /&gt;
: You should see some connection text scroll on the top of the screen and some files on the right side of the screen now such as &#039;&#039;.bashrc&#039;&#039; and &#039;&#039;.profile&#039;&#039; The right side of the screen is the drive on your Linux system and the left side of the screen is the drive on your home system. Files and folders can be dragged between the two sides to transfer them back and forth.&lt;br /&gt;
: [[File:Lab1_filezillaconnected.png|link=https://wiki.ihitc.net/mediawiki/images/c/ca/Lab1_filezillaconnected.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillaconnected.png|Click here for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Close the FileZilla software to disconnect.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install VM Tools==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Install VM Tools]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect into your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Python==&lt;br /&gt;
In order to check your work in the labs of this course you will need to have an application called [https://www.python.org/ Python] installed on your Linux system.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Download &#039;&#039;python3&#039;&#039; using &#039;&#039;&#039;apt&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
* When prompted type Y to install the app and its dependencies&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&#039;&#039;NOTE: This may take a while.&#039;&#039;&amp;lt;/ul&amp;gt;&lt;br /&gt;
* When prompted to specify the name of the host where the TANGO database server is running, just select ok.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_tango.png|link=https://wiki.ihitc.net/mediawiki/images/4/4c/Python_tango.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_tango.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to verify that python version 3.6 is installed.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;python3 --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_version.png|link=https://wiki.ihitc.net/mediawiki/images/7/70/Python_version.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_version.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Nmap==&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:* &#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the following command at the command line.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install nmap&amp;lt;/code&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Curl==&lt;br /&gt;
:Curl is a tool that lets you run scripts that are not saved to your virtual machine. It will be used to check the labs for completion while working through the course.  &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command at the command line. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install curl&amp;lt;/code&amp;gt;&lt;br /&gt;
: If prompted to install additional packages type &amp;quot;y&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
:     Installing Curl will allow you to check each of your labs for completion of some of the critical objectives of the lab work using a command in the Checking your work section of the labs.&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Safely Shutdown==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Safely Shutdown]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
:We will normally leave our VM running but it is important that you know how to shutdown a Linux system correctly so this time we&#039;ll turn it off.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect in to your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt; Safely shutdown you server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the &#039;&#039;&#039;sudo shutdown -h now&#039;&#039;&#039; at the command line to safely shutdown the system.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo shutdown -h now&amp;lt;/code&amp;gt;&lt;br /&gt;
: You should soon get a message that PuTTY has lost it&#039;s connection. Click OK and then you can close the PuTTY window.&lt;br /&gt;
&amp;lt;li&amp;gt;End NetLab Reservation&amp;lt;/li&amp;gt;&lt;br /&gt;
: If you still have time left in your reservation in Netlab it&#039;s polite to end the reservation so other users can work on the system, only a limited number of reservations can be made at one time. You can do this by logging into Netlab, opening your lab, and clicking the &amp;quot;Reservation&amp;quot; menu at the top of the screen and choose to &amp;quot;End Reservation Now&amp;quot; followed by confirming that you want to end the reservation.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;This section will cover ways to manually check your work&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;ul&amp;gt;For this lab each section was tested in the process of the lab.  You should have successfully connected an SSH session with putty, and an ftp session with FileZilla.&amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;ul&amp;gt;You should have shut down you server in one of the last steps, so no further testing is necessary at this time.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_9_mnjk&amp;diff=9589</id>
		<title>Lab 9 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_9_mnjk&amp;diff=9589"/>
		<updated>2021-03-22T23:44:31Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking Your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Install a basic email server &lt;br /&gt;
*Install Courier MDA software&lt;br /&gt;
*Learn how to allow remote users to send mail&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/telnet telnet]&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This lab assumes that you know the IP address of your Linux system and are connected to the ITCnet VPN network.  Additionally, this lab assumes that you have completed the Bind DNS and have created a MX record that directs mail to your mail server. &lt;br /&gt;
*[[Lab_8_mnjk#Install_BIND_&amp;amp;_Enable_Caching | Installing Bind]]&lt;br /&gt;
*[[Lab_8_mnjk#Adding_a_Delegated_Domain | Creating a MX record in DNS]]&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software, login with your standard user account&lt;br /&gt;
# Make sure that webmin is installed on your system. &lt;br /&gt;
# Get the username and domain name of someone else&#039;s system in the class who you can send mail to&lt;br /&gt;
# This lab requires that you have appropriate domain name records (at least a correct A and MX record) for your system working from the DNS lab before things will work.&lt;br /&gt;
&lt;br /&gt;
== Install the Postfix MTA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=6VsgO5695Z4&amp;amp;feature=youtu.be Video Tutorial - Install Postfix MTA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use a package manager to install the &#039;&#039;postfix&#039;&#039; package.&lt;br /&gt;
* During the installation process select &#039;&#039;Internet Site&#039;&#039; as the type of mail server and set the domain name to &#039;&#039;*.itc2480.campus.ihitc.net&#039;&#039; where * is the hostname letter of your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
: MTA software listens for incoming connections from other MTA servers on port 25 and accepts mail on behalf of users on the system. Once the mail is received it is stored locally for users to retrieve. The most common methods for storing messages is in an .mbox file, where all messages are stored in a single file, or in a Maildir, which is a directory where each message is stored in a separate file. The MTA also listens for connections from client software (MUA) and accepts outbound messages from them and forwards them on to the destination domain&#039;s mail server. Advanced configuration of MTA software can allow for anti-spam filtering, mailing list support or other programs to intercept and manipulate mail as it passes through the server.&lt;br /&gt;
&amp;lt;li&amp;gt;Test the connection an verify the port is open&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Use Telnet to connect to the Postfix SMTP server on port 25: &#039;&#039;&#039;telnet localhost 25&#039;&#039;&#039;&lt;br /&gt;
: [[File:Lab9_open_telnet.png|link=https://wiki.ihitc.net/mediawiki/images/1/10/Lab9_open_telnet.png|500px]]&lt;br /&gt;
: [[Media:Lab9_open_telnet.png | Click here for larger image]]&lt;br /&gt;
:* Type &#039;&#039;&#039;quit&#039;&#039;&#039; and press enter after verifying Postfix is running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Configure Maildir&amp;lt;/li&amp;gt;&lt;br /&gt;
: Because the Courier IMAP and POP3 server software only supports Maildir style message stores and Postfix stores in mbox files by default you must edit the &#039;&#039;/etc/postfix/main.cf&#039;&#039; file to fix this. &lt;br /&gt;
:* Add the line &lt;br /&gt;
:&amp;lt;pre&amp;gt;home_mailbox = Maildir/&amp;lt;/pre&amp;gt; &lt;br /&gt;
: Edit or add the &#039;&#039;mailbox_command&#039;&#039; parameter so there is nothing on the line after the equals sign, delete the portion of the line referencing procmail if it exists. The line should look like: &lt;br /&gt;
:&amp;lt;pre&amp;gt;mailbox_command = &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Restart the &#039;&#039;postfix&#039;&#039; service to apply your change. Postfix is now saving new incoming messages into the Maildir folder inside each user&#039;s home directory. This folder is automatically created by Postfix the first time a new message comes in for a user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Set your shell to recognize the maildir as your mail location&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/login.defs&#039;&#039; file and comment out the &#039;&#039;MAIL_DIR /var/mail&#039;&#039; line (place a # in front of the line) and add a line setting &#039;&#039;MAIL_FILE&#039;&#039; like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#MAIL_DIR        /var/mail&lt;br /&gt;
MAIL_FILE      Maildir/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/login&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so standard&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so standard&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/su&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so nopen&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so nopen&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir nopen&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/sshd&#039;&#039; file, find and comment out the &#039;&#039;session    optional     pam_mail.so standard noenv&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional     pam_mail.so standard noenv&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/profile&#039;&#039; file and at the end of the file add the line: &amp;lt;pre&amp;gt;export MAIL=~/Maildir&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Test sending and receiving mail as a locally logged on user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Install the &#039;&#039;mailutils&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try sending a message (replace username with your username): &amp;lt;pre&amp;gt;echo &amp;quot;This is my message&amp;quot; | mail -s &amp;quot;Email Subject&amp;quot; username@localhost&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Log out of your SSH session and open a new SSH session to apply the changes to the &#039;&#039;/etc/profile&#039;&#039; and &#039;&#039;/etc/login.defs&#039;&#039; files.&lt;br /&gt;
:* Check to see if the message was received using the &#039;&#039;&#039;mail&#039;&#039;&#039; command, press &#039;&#039;q&#039;&#039; to return to the command line.&lt;br /&gt;
:[[File:Lab9_cli_send_mail.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab9_cli_send_mail.png|500px]]&lt;br /&gt;
:[[Media:Lab9_cli_send_mail.png|Click here for a larger image]]&lt;br /&gt;
: You should also be able to see the message in &#039;&#039;~/Maildir/&#039;&#039; in either the &#039;&#039;new/&#039;&#039; or &#039;&#039;cur/&#039;&#039; directory depending on whether you have viewed the message list yet or not. In either case, the message will appear as a text file with a random-looking name. It&#039;s just a text file so you can use &#039;&#039;&#039;cat&#039;&#039;&#039; or &#039;&#039;&#039;less&#039;&#039;&#039; to view it.&lt;br /&gt;
&amp;lt;li&amp;gt; Create Aliases &amp;lt;/li&amp;gt;&lt;br /&gt;
: You can create aliases and forward mail between users by editing the &#039;&#039;/etc/aliases&#039;&#039; file and then running the &#039;&#039;&#039;newaliases&#039;&#039;&#039; program. &lt;br /&gt;
:* Create an &amp;quot;alias&amp;quot; for &#039;&#039;sysadmin&#039;&#039; which forwards mail sent to sysadmin@localhost to your username &lt;br /&gt;
:* Send a copy of all mail to the &#039;&#039;root&#039;&#039; account to your username &lt;br /&gt;
&lt;br /&gt;
: Now would be a good time to try logging on to Webmin again, re-scanning for modules and then taking a look at the Postfix module in the &#039;&#039;Servers&#039;&#039; section.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the mail log file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at your &#039;&#039;/var/log/mail.info&#039;&#039; log to see Postfix sending and receiving messages for users.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install Courier MDA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=uvZlSiQHlxs&amp;amp;feature=youtu.be Video Tutorial - Install Courier MDA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install required courier packages &amp;lt;/li&amp;gt;&lt;br /&gt;
: Most users prefer to retrieve mail from a mail server using an MDA protocol like POP3 or IMAP which can be provided by the Courier programs. Install the &#039;&#039;courier-pop&#039;&#039;, &#039;&#039;courier-imap&#039;&#039;, and &#039;&#039;fam&#039;&#039; packages.&lt;br /&gt;
:* Do not create the directories for web-based administration as they are unneeded for our setup&lt;br /&gt;
: Local users accessing their mailbox with MUA software can read and write to the .mbox file or Maildir directly. If a user not locally logged on to the system wants to access their mailbox the server runs MDA software which typically uses the POP3 or IMAP protocol for accessing the .mbox file or Maildir remotely.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Install MUA Client on remote system&amp;lt;/li&amp;gt;&lt;br /&gt;
:*Install an email client (MUA) on your host (home) system such as [http://www.mozilla.org/en-US/thunderbird/ Mozilla Thunderbird]&lt;br /&gt;
:* Setup two user accounts in your MUA, the usernames and passwords should be the same as users and their passwords on your system. Use &#039;&#039;IMAP&#039;&#039; as the protocol for retrieving mail. The email address for each should be &#039;&#039;username@*.itc2480.campus.ihitc.net&#039;&#039; where the * is replaced by the host letter of your system. You can verify the IMAP and SMTP settings that are detected, both server addresses should be &#039;&#039;*.itc2480.campus.ihitc.net&#039;&#039; where the * is replaced by the host letter of your system.&lt;br /&gt;
:&#039;&#039; NOTE: The first time you check messages and the first time you send messages to your server from Thunderbird you will need to accept an invalid security certificate in the Thunderbird window.&lt;br /&gt;
:[[File:Lab9_thunderbird_cert.png|link=https://wiki.ihitc.net/mediawiki/images/9/9a/Lab9_thunderbird_cert.png|500px]]&lt;br /&gt;
:[[Media:Lab9_thunderbird_cert.png|Click here for a larger image]]&lt;br /&gt;
:&#039;&#039; NOTE: To see the &#039;&#039;Tools&#039;&#039; menu with the &#039;&#039;Account Settings&#039;&#039; window in recent versions of Thunderbird (where you can add more accounts) you need to press ALT-F and then the menu bar will temporarily appear.&lt;br /&gt;
:[[File:Lab9_thunderbird_menu.png|link=https://wiki.ihitc.net/mediawiki/images/6/60/Lab9_thunderbird_menu.png|500px]]&lt;br /&gt;
:[[Media:Lab9_thunderbird_menu.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Send mail between local users&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try sending a message from one user to the other user by sending a message to the other account like &#039;&#039;username@localhost&#039;&#039; Verify that you can receive and read the messages.&lt;br /&gt;
:* Note: If a user has not yet received any mail Postfix has not created a Maildir for the user and the Courier software will send an error to the client software. Use the mail program explained above to send some mail to the user, see that the &#039;&#039;~/Maildir&#039;&#039; is then created and try retrieving the messages again with your MUA.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Allow Remote Users to Send Mail ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=0qh3mCMIzn4&amp;amp;feature=youtu.be Video tutorial - Allow Remote Users to Send Mail]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Testing SMTP mail to another domain&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try setting up your MUA software to send mail by creating an SMTP server entry and sending an email to &#039;&#039;anotheruser@localhost&#039;&#039; This should work because localhost is your own server but if you try sending email to &#039;&#039;someuser@somedomain.com&#039;&#039; like &#039;&#039;root@ben.itc2480.campus.ihitc.net&#039;&#039; that will fail.&lt;br /&gt;
: The problem is you don&#039;t want just anyone to send mail through your mailserver (we did allow this in the olden days) because a spammer could then use your server to send mail worldwide and it would all trace back to the IP of your server, we call servers setup like this &amp;quot;open relays&amp;quot; because they relay mail for anyone and they are generally considered very bad practice and can get your mailserver on lists of servers to ignore all messages from. There are a number of ways to solve this. By default Postfix will only allow mail relaying from computers on the same network (based on IP) as set in the &#039;&#039;/etc/postfix/main.cf&#039;&#039; &#039;&#039;mynetworks&#039;&#039; parameter but this is inconvenient for remote users as you would need to know the remote IP address they are connecting from. The SASL protocol allows users to authenticate with a username and password before sending mail and then relay messages are accepted from them.&lt;br /&gt;
&amp;lt;li&amp;gt;Configure Simple Autherntication and Security Layer - SASL&amp;lt;/li&amp;gt;&lt;br /&gt;
:* See if you can follow [https://wiki.debian.org/PostfixAndSASL these instructions] for setting up SASL with Postfix.&lt;br /&gt;
:&#039;&#039; Note: You do NOT need to setup TLS to support SASL (more on that in the additional considerations section below)&lt;br /&gt;
&amp;lt;li&amp;gt;Test and troubleshoot SASL&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Modify your MUA to use a username and password when connecting to your SMTP server and try sending mail to someone else&#039;s system from your MUA using a destination address like &#039;&#039;root@*.itc2480.campus.ihitc.net&#039;&#039; where the * is replaced by the host letter of your system.&lt;br /&gt;
:&#039;&#039; NOTE: You MUST actually exchange messages with someone else in the class (both sending to them and receiving from them). It is not possible to test using an outside email account of your own (you will not be able to send a message back to your server because it is behind a firewall). It is not enough to just be able to send a message to another system. It is not enough to just be able to receive a message from another user.&lt;br /&gt;
:* Troubleshoot as needed using the mail log files on your system.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Additional Considerations=&lt;br /&gt;
Running a mailserver is tricky business. The basic server we have setup does not use valid certificates for encrypting connections meaning usernames, passwords, and mail contents are all being sent to an unverified server. This is very undesirable from a security standpoint and it would be suggested to support SSL/TLS encryption for both the MTA and MDA portions with a valid certificate purchased from a certificate authority (CA) or from a free CA like [https://letsencrypt.org/ Let&#039;s Encrypt]. In addition, you will almost certainly want spam filtering at the server. More complicated setups also use database tables for users, passwords and domains so that you can host multiple domains on a single server and have email user boxes for people who do not have local logins on the system.&lt;br /&gt;
&lt;br /&gt;
=Additional Resources=&lt;br /&gt;
* [https://help.ubuntu.com/community/PostfixBasicSetupHowto Ubuntu Postfix Basic Setup]&lt;br /&gt;
* [https://wiki.debian.org/Postfix Debian Wiki - Postfix Installation]&lt;br /&gt;
&lt;br /&gt;
==Checking Your Work==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Send a test email to ping@itc2480.camus.ihitc.net from your Thunderbird or other MTA mail program.&amp;lt;/li&amp;gt;&lt;br /&gt;
     &amp;lt;ul&amp;gt;You should receive a response titled &amp;quot;Success! Auto Response form Ping Auto Mailer&amp;quot;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_09_test.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9588</id>
		<title>Lab 5 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9588"/>
		<updated>2021-03-22T23:37:32Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking Your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Learn about static network configuration of Debian Linux systems&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net PHP]&#039;&#039;&#039;&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net MariaDB]&#039;&#039;&#039; on your server, this is an open-source MySQL alternative&lt;br /&gt;
*Experiment with websites and databases&lt;br /&gt;
*Explore the standard log files on your system.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifup ifup]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifdown ifdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ping ping]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2ensite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2dissite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/wget wget]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/zcat zcat]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/service service]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/tail tail]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will also use the following MySQL (MariaDB) commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/use USE]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/show SHOW]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/select SELECT]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/drop-database DROP database]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software, login with your standard user account&lt;br /&gt;
# Make a note of the static IP address information for your particular system in the table below, it is based on the system name identification letter in vmWare. These IP addresses will ONLY be valid in the ITC vmWare Linux class subnet. If you are working on a local VirtualBox system you will need to select an available static IP from the correct subnet for your system or skip the static IP addressing section. All vmWare systems will use a gateway address of 172.17.50.1 and a subnet mask of 255.255.255.0 with two nameservers 172.17.139.11 and 172.17.139.111&lt;br /&gt;
{| {{table}}&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;System ID&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Static IP&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| A||172.17.50.11&lt;br /&gt;
|-&lt;br /&gt;
| B||172.17.50.12&lt;br /&gt;
|-&lt;br /&gt;
| C||172.17.50.13&lt;br /&gt;
|-&lt;br /&gt;
| D||172.17.50.14&lt;br /&gt;
|-&lt;br /&gt;
| E||172.17.50.15&lt;br /&gt;
|-&lt;br /&gt;
| F||172.17.50.16&lt;br /&gt;
|-&lt;br /&gt;
| G||172.17.50.17&lt;br /&gt;
|-&lt;br /&gt;
| H||172.17.50.18&lt;br /&gt;
|-&lt;br /&gt;
| I||172.17.50.19&lt;br /&gt;
|-&lt;br /&gt;
| J||172.17.50.20&lt;br /&gt;
|-&lt;br /&gt;
| K||172.17.50.21&lt;br /&gt;
|-&lt;br /&gt;
| L||172.17.50.22&lt;br /&gt;
|-&lt;br /&gt;
| M||172.17.50.23&lt;br /&gt;
|-&lt;br /&gt;
| N||172.17.50.24&lt;br /&gt;
|-&lt;br /&gt;
| O||172.17.50.25&lt;br /&gt;
|-&lt;br /&gt;
| P||172.17.50.26&lt;br /&gt;
|-&lt;br /&gt;
| Q||172.17.50.27&lt;br /&gt;
|-&lt;br /&gt;
| R||172.17.50.28&lt;br /&gt;
|-&lt;br /&gt;
| S||172.17.50.29&lt;br /&gt;
|-&lt;br /&gt;
| T||172.17.50.30&lt;br /&gt;
|-&lt;br /&gt;
| U||172.17.50.31&lt;br /&gt;
|-&lt;br /&gt;
| V||172.17.50.32&lt;br /&gt;
|-&lt;br /&gt;
| W||172.17.50.33&lt;br /&gt;
|-&lt;br /&gt;
| X||172.17.50.34&lt;br /&gt;
|-&lt;br /&gt;
| Y||172.17.50.35&lt;br /&gt;
|-&lt;br /&gt;
| Z||172.17.50.36&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set a static IP==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=VcPA6gJ0Ohw&amp;amp;feature=youtu.be Video Tutorial - Setting a Static IP Address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
:&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install PHP &amp;amp; MySQL/MariaDB==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=Az0qtg4LSjA&amp;amp;feature=youtu.be Video Tutorial -  Install PHP and MySQL MariaDB]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install packages&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using &#039;&#039;&#039;apt&#039;&#039;&#039;, install the &#039;&#039;php&#039;&#039; and &#039;&#039;mariadb-server&#039;&#039; packages as well as the &#039;&#039;php-mysql&#039;&#039; package which provides the link between php and mysql and the &#039;&#039;libapache2-mod-php&#039;&#039; package which provides a copy of PHP which allows the Apache webserver to run website PHP scripts.&lt;br /&gt;
&#039;&#039; Note: Remember to do an &#039;&#039;&#039;apt update&#039;&#039;&#039; before installing packages to make sure you get the latest versions&lt;br /&gt;
&#039;&#039; Note: Maria-DB is a fully compatible replacement for MySQL that isn&#039;t controlled by Oracle.&lt;br /&gt;
* After the dependencies are found, go ahead and accept them to continue the install.&lt;br /&gt;
&amp;lt;li&amp;gt; After the install is complete, &#039;&#039;&#039;cd&#039;&#039;&#039; to &#039;&#039;/var/www/html&#039;&#039; which is the root directory of your webserver and so where all website files are served from.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; In order to fully enable the PHP-MySQL module you should restart your Apache webserver. You don&#039;t need to restart your entire system to do this. Do some research on the &amp;quot;apache2ctl&amp;quot; or the &amp;quot;service apache2&amp;quot;  commands which can be used to do this.&lt;br /&gt;
&amp;lt;li&amp;gt; At this point we will test to verify that php is working properly with Apache. Create a new file named &#039;&#039;phptest.php&#039;&#039;, and then open it in a text editor.&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039; Note: you may have to use sudo to create and edit files in this directory.  as your standard user account may not have privilidges to create and edit files in this directory.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo touch phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Enter the following into the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;?php&lt;br /&gt;
phpinfo();&lt;br /&gt;
?&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Now save the file, and on your local machine go to xxx.xxx.xxx.xxx/phptest.php in a web browser where xxx.xxx.xxx.xxx is your VM&#039;s static IP. You should now be on a page that shows your PHP Version, and system information.&amp;lt;/li&amp;gt; &lt;br /&gt;
:[[File:Lab5_php_info.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Use the &amp;quot;View Source&amp;quot; option in your browser to see what the HTML source code is for the page you&#039;re viewing is. Is it the same or different than the .php file you created? Why? How is this different than a standard .html file?&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Lab5_php_info_devtab.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info_devtab.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Website PHP==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=m_sUrt_quX4&amp;amp;feature=youtu.be Video Tutorial - Experiment with Website PHP]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore Apache symlinks&amp;lt;/li&amp;gt;&lt;br /&gt;
:In a previous lab we learned about editing the &#039;&#039;/var/www/index.html&#039;&#039; file to change the default web page displayed by your server. In a future lab you will install some PHP/MySQL based software which powers many Internet sites with forums, blogs, etc. Before we can do that we need to learn a little more about PHP and about databases. Like most software on Linux the Apache webserver configuration files are stored in the &#039;&#039;/etc&#039;&#039; directory. Specifically, you can find several of them which work together and are called from each other in &#039;&#039;/etc/apache2/&#039;&#039; take a look in the &#039;&#039;/etc/apache2/sites-enabled/&#039;&#039; directory. See how symlinks are used to point to configuration files which actually reside in the &#039;&#039;/etc/apache2/sites-available/&#039;&#039; directory? This allows us to turn off and on various sites by creating or removing a symlink rather than by deleting the actual configuration file, a handy thing if we just want to temporarily disable a site. In fact Apache provides a utility to automatically add and remove these links called &#039;&#039;&#039;a2ensite&#039;&#039;&#039; and &#039;&#039;&#039;a2dissite&#039;&#039;&#039;. Check the &#039;&#039;&#039;man&#039;&#039;&#039; pages for these commands to see how they work.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore &#039;&#039;&#039;/etc/apche2/sites-enabled&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:As you might have guessed the default site for your system is configured by the file linked to at &#039;&#039;/etc/apache2/sites-enabled/000-default&#039;&#039; If you open this file in your favorite text editor you will see a series of what Apache calls &amp;quot;directives&amp;quot; which explain how the webserver should function, what port it should listen on, where the website files will reside (&#039;&#039;/var/www/html&#039;&#039;), etc. &lt;br /&gt;
:&#039;&#039; NOTE: Going into all of the different Apache directives is outside of the scope of this course but you will find a lot of documentation about them on the Internet.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the Apache configuration files in Webmin&amp;lt;/li&amp;gt;&lt;br /&gt;
:In addition to configuring Apache directly through it&#039;s configuration files you can also configure it through an interface like Webmin which we installed in a previous lab. Bring up the Webmin configuration page for Apache and take a look at the settings for the default site. Note how the things you saw directly in the configuration file match up with what you see in Webmin. One of the things you may be interested in seeing is how the webserver knows to display the index.html file from a directory if it exists and no specific file is requested in the URL. Take a look on the &amp;quot;Directory Indexing&amp;quot; page for the default virtualhost and see if you can find this information. You&#039;ll notice that there is a list of files, not just index.html which the server will display.&lt;br /&gt;
:&#039;&#039; NOTE: You may need to refresh your Webmin modules or &amp;quot;scan for new modules&amp;quot; if you haven&#039;t done that since installing Apache and Webmin. Webmin scans your system for compatible server software packages (like Apache) when it is installed but needs to re-scan it&#039;s modules after you install new server software before you can configure it through Webmin.&lt;br /&gt;
&amp;lt;li&amp;gt;Expiriment with and learn PHP basics&amp;lt;/li&amp;gt;&lt;br /&gt;
:In another section of this lab you created a basic &#039;&#039;phptest.php&#039;&#039; file and saw how the server executed the PHP code and turned it into an HTML page your browser could display. Because PHP offers an easy way to write web applications it powers much of the Internet. To prepare us for setting up some PHP applications in a future lab it will be helpful to know a little about how PHP scripts work. Read through the [http://www.w3schools.com/php/default.asp W3 Schools PHP Basics Tutorial] (PHP Intro through PHP Superglobals) and try creating some PHP scripts on your own Linux server like the examples given in the tutorial pages to see if you can get them to run, try modifying them a little bit and see what the results are. There are many great Internet resources devoted to understanding how to do things with PHP so take some time to see how this language can be easily integrated in websites. You should definitely be familiar with editing PHP files to change variables, echo statements, etc. work which are all skills you&#039;ll need when installing PHP based website software.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own PHP files&amp;lt;/li&amp;gt;&lt;br /&gt;
:*Try writing some simple PHP scripts on your own using variables and echo statements and make them available through your webserver.&lt;br /&gt;
:*A good place to create these would be in your home directory, using your favorite text editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own &amp;quot;home&amp;quot; page by editing your &#039;&#039;index.html&#039;&#039; file located in the &#039;&#039;&#039;/var/www/html&#039;&#039;&#039; directory.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You will need to be familiar with the very basics of editing HTML files in order to create links, etc. If you haven&#039;t done this before there are many introductory HTML tutorials available online.  A good starting place is [https://www.w3schools.com/html/html_basic.asp W3 Schools HTML Basics Examples]&lt;br /&gt;
:&#039;&#039; NOTE:It is importatnt to know that an &#039;&#039;&#039;html&#039;&#039;&#039; file must include the &amp;lt;!DOCTYPE HTML&amp;gt; tag.  Additionally, you will notice that all tags have an opening tag and a closing tag.  The information between the tags is what will have the features of the tag&lt;br /&gt;
:*Backup your &#039;&#039;index.html&#039;&#039; file by copying to a new file name.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo cp /var/www/html/index.html /var/www/html/index.html.bak&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Edit your &#039;&#039;index.html&#039;&#039; file (or create a new &#039;&#039;index.php&#039;&#039; file which will be loaded instead if it exists) so there is a list and links to the various scripts you have created as part of your PHP experimentation.&lt;br /&gt;
:* Open your index.html file in your favorite text editor,&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano /var/www/html/index.html&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Since you have backed up the original index.html file I would edit this file to only include the basics.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;My ITC-2480 Server&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;This is a server on Pod-R in NetLab at 172.17.50.XX&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Here are some of the Projects I am working on:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;http://172.17.50.XX/phptest.php&amp;quot;&amp;gt;PHP Version Information&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Make sure to replace the XX in the IP with the IP address of your server.&lt;br /&gt;
:&lt;br /&gt;
:[[File:Lab5_basic_html.png|link=https://wiki.ihitc.net/mediawiki/images/2/29/Lab5_basic_html.png|500px]]&lt;br /&gt;
:[[Media:Lab5_basic_html.png|Click here for a larger image]]&lt;br /&gt;
:A first look for a basic page&lt;br /&gt;
:[[File:Lab5_initial_home.png|link=https://wiki.ihitc.net/mediawiki/images/9/92/Lab5_initial_home.png|500px]]&lt;br /&gt;
:[[Media:Lab5_initial_home.png|Click for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Try to add additional features to your &amp;quot;home&amp;quot; page.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You may get some ideas of features you might like to add by looking at the original &#039;&#039;index.html&#039;&#039; file that we backed up in step 6 of this lab.&lt;br /&gt;
:*As you complete your labs consider what you can add to this page.&lt;br /&gt;
:*Add links to the PHP scripts you created&lt;br /&gt;
:*A few good chalanges would be to add a title, change font size, style or color.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Databases==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=1zYXiWLoGdM&amp;amp;feature=youtu.be Video Tutorial - Experiment with Databases]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: In order to do really powerful things with a website we need a database where we can store dynamic content which can be queried to automatically build site pages from a template. One of the most common databases is an SQL database, and MySQL has long been the most prevalent Linux SQL software. These days MariaDB, which we installed, has been taking some MySQL marketshare because it is a community developed program instead of MySQL which is now owned by Oracle. The MariaDB software and MySQL software are essentially equivalent, especially for small sites/databases, and the same commands are used interchangeably including using the &#039;&#039;&#039;mysql&#039;&#039;&#039; command to access them. SQL itself is a standard language for interacting with a specific type of database called a relational database, we&#039;ll see why it&#039;s called a relational database in a minute. Each database is a collection of data stored in tables. You can think of a table as something like a spreadsheet with rows and columns, except we call the columns fields and the rows records (sometimes we actually call them rows too). The different tables are often related to one another, of course they are usually being used by the same web application, but usually the relationship goes deeper than that as we&#039;ll see in a little bit.&lt;br /&gt;
&amp;lt;li&amp;gt;Download a sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To jumpstart our exploration of databases we&#039;ll download a pre-built sample database with a few tables and many records already in it and import it into our MySQL database server. Download the employees database file [https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2 employees_db-full-1.0.6.tar.bz2] (about 26MB) and get it into your home directory. Instead of using the &#039;&#039;&#039;links&#039;&#039;&#039; browser to do this or downloading to your computer and then pushing this large file back across the Internet with an SCP/SFTP client like FileZilla a better choice might be to learn about the &#039;&#039;&#039;wget&#039;&#039;&#039; program which can be used like &amp;quot;&#039;&#039;&#039;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&#039;&#039;&#039;&amp;quot; to download the file into your current working directory.&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Unpack the database file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Figure out how to use the &#039;&#039;&#039;tar&#039;&#039;&#039; program to unpack this .tar.bz2 file. Note that this file uses bz2 compression which takes longer to compress than gzip but can compress the files more. Once unpacked you should have an &amp;quot;employees_db&amp;quot; folder.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the files included with sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: Inside the &#039;&#039;employees_db&#039;&#039; folder you should have a number of &#039;&#039;.sql&#039;&#039; script files and dump files which can be used to restore the database to your system.&lt;br /&gt;
:*Take a look at the &#039;&#039;employees.sql&#039;&#039; file, it&#039;s just a text file, which describes the format of the database. &lt;br /&gt;
:*Also take a look at the &#039;&#039;load_employees.dump&#039;&#039; file, also just a text file, which contains all of the records from the employees table of the database. :&#039;&#039; NOTE: there are 300,000 some employee records in this database so you probably don&#039;t want to just use &#039;&#039;&#039;cat&#039;&#039;&#039; to view these files as it could take a while to print them out to your screen. Using the &#039;&#039;&#039;less&#039;&#039;&#039; program would be a better choice as it will allow you to exit viewing the file by pressing q at any time.&lt;br /&gt;
&amp;lt;li&amp;gt;Open the MySQL (MariaDB) command line&amp;lt;/li&amp;gt;&lt;br /&gt;
: We can interact with the MySQL/MariaDB server in many different ways. The first way we&#039;ll take a look at is through the command line &#039;&#039;&#039;mysql&#039;&#039;&#039; program. Run the &amp;quot;&#039;&#039;&#039;sudo mysql&#039;&#039;&#039;&amp;quot; command. &lt;br /&gt;
:&#039;&#039; NOTE: that we are running this command with system administrator permissions which allows us to log in to the MySQL server with database administrator permissions as well. The MySQL program actually stores it&#039;s own usernames and passwords as a MySQL database itself, you can create and modify these permissions from the mysql command line but we&#039;ll learn more about modifying them through the Webmin interface later.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo MySQL&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_cli.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab5_mariadb_cli.png|500px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_cli.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Explore MySQL (MariaDB) Commands&amp;lt;/li&amp;gt;&lt;br /&gt;
: MySQL has it&#039;s own command line language the you can use through the &amp;quot;mysql&amp;gt;&amp;quot; prompt you are now running. For example, if we want to see a list of databases on the system we can run &amp;quot;&#039;&#039;&#039;SHOW databases;&#039;&#039;&#039;&amp;quot; run the command and note the databases that already exist by default.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW databases;&amp;lt;/code&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Each MySQL/MariaDB statement ends with a semicolon (;) if you do not put the semicolon at the end of the line the command will not execute when you press enter and you will be able to continue to add more commands to the statement before finishing with a semicolon. If you accidentally press enter without ending with a semicolon you can just enter a semicolon on the next line and press enter.&lt;br /&gt;
&amp;lt;li&amp;gt;Import the sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To import the employee database we can use the &amp;quot;&#039;&#039;&#039;source employees.sql;&#039;&#039;&#039;&amp;quot; command (assuming we were already working in the directory which contains the employees.sql file when we launched mysql. Import the employee database and verify the system now has an employees database.&lt;br /&gt;
&amp;lt;code&amp;gt;SOURCE employees.sql;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the employees database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;USE employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
: If we want to see all of the tables in the employees database we must first select the database we want to work on using the &amp;quot;&#039;&#039;&#039;USE employees;&#039;&#039;&#039;&amp;quot; command.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the employee table&amp;lt;/li&amp;gt;&lt;br /&gt;
: Use the &amp;quot;&#039;&#039;&#039;SHOW tables;&#039;&#039;&#039;&amp;quot; command to see a list of tables.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW tables;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View a list of employees in table&amp;lt;/li&amp;gt;&lt;br /&gt;
: To see a list of all the records in a table we need to run a SELECT query &amp;quot;&#039;&#039;&#039;SELECT * from &#039;&#039;&amp;lt;tablename&amp;gt;&#039;&#039;&#039;&#039;&#039;&amp;quot; like &amp;quot;&#039;&#039;&#039;SELECT * from employees&#039;&#039;&#039;&amp;quot; which will list all the records in the &#039;&#039;employees&#039;&#039; table of the employees database and display them.&lt;br /&gt;
&amp;lt;code&amp;gt;SELECT * from employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_show_tables.png|link=https://wiki.ihitc.net/mediawiki/images/d/d5/Lab5_mariadb_show_tables.png|350px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_show_tables.png|Click here for a larger image]]&lt;br /&gt;
:* Remember that we previously selected to USE the &#039;&#039;employees&#039;&#039; database, this will be remembered until we USE a different database. Try displaying the records in a couple of different tables like employees and departments.&lt;br /&gt;
:&#039;&#039; NOTE: The output can be broken by using CTRL-C on your local machine if you do not wish to wait for all of the records to be displayed.&lt;br /&gt;
:&lt;br /&gt;
: There is much more that we can do from the MySQL/MariaDB command line but that would be a whole class or more itself. The MySQL/MariaDB programs are well documented on the Internet and with these basic skills you should be able to figure out most of it. Remember, the vast majority of what you read about MySQL will also work in MariaDB and vice-versa.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the MySQL interface in Webmin&lt;br /&gt;
: Now that you have learned a bit about MySQL databases from the command line let&#039;s see how they look in the Webmin web management interface. Log back in to your Webmin interface through a browser on your host system.&lt;br /&gt;
:* Because MySQL was not installed when we first setup Webmin you need to &amp;quot;scan for new modules&amp;quot; first. Once that process has finished refresh the page to see that MySQL has been added to the server section of Webmin.&lt;br /&gt;
:* Take a look at the Webmin MySQL module and see how MySQL users and permissions are configured.&lt;br /&gt;
:* Try browsing through the &#039;&#039;employees&#039;&#039; database using the Webmin interface including viewing tables and records inside of the tables.&lt;br /&gt;
&amp;lt;li&amp;gt;Drop database and exit MySQL (MariaDB)&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Go back to your MySQL command line window and run the command &amp;quot;&#039;&#039;&#039;DROP DATABASE employees;&#039;&#039;&#039;&amp;quot; to delete the entire database.&lt;br /&gt;
:* Type &amp;quot;&#039;&#039;&#039;exit;&#039;&#039;&#039;&amp;quot; to quit the MySQL program and return to a Linux shell.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039; NOTE: Obviously, the DROP command is one to be careful with as you can easily wipe out a huge database with one line! &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==View Logfiles==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=cxIOQF-eMy0&amp;amp;feature=youtu.be Video Tutorial - Tutorial 5 View Logfiles]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: Linux stores most of log files in the &#039;&#039;/var/log&#039;&#039; directory so change your working directory to &#039;&#039;/var/log&#039;&#039;.&lt;br /&gt;
: Some log files are viewable by all users on the system but other log files may be restricted and you will need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to view them.&lt;br /&gt;
&amp;lt;li&amp;gt;View last 20 lines in &#039;&#039;&#039;/var/log/syslog&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;tail -20 /var/log/syslog&amp;lt;/code&amp;gt;&lt;br /&gt;
:[[File:Lab5_tail.png|link=https://wiki.ihitc.net/mediawiki/images/8/88/Lab5_tail.png|500px]]&lt;br /&gt;
:[[Media:Lab5_tail.png|Click here for a larger image]]&lt;br /&gt;
: Linux log files are typically standard text files and can be read with standard text file utilities like cat or less. One additional utility which comes in hand is the &#039;&#039;&#039;tail&#039;&#039;&#039; program which displays the last 10 lines (by default) of a text file and which can be configured to display more or less lines using a command like &#039;&#039;&#039;tail -20 /var/log/syslog&#039;&#039;&#039; which will display the last 20 lines of the main system log file. The manual page for the &#039;&#039;&#039;tail&#039;&#039;&#039; command contains additional information like how to use the &#039;&#039;-f&#039;&#039; option to view a log in realtime (exit with Ctrl-C).&lt;br /&gt;
&amp;lt;li&amp;gt;Save the tail output to a file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Often we may want to save the output from a &#039;&#039;&#039;tail&#039;&#039;&#039; command to share with others or document an issue.  This can easily be done using redirection we learned in a previous lab.  Experiment with how to save some tail commands.  Keep in mind you may need to escalate privileges for some files to be redirected.  Try the following:&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo tail -20 /var/log/syslog &amp;gt; logtail.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Explore some other log files&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at some of the log files on your system and see what kinds of information they contain specifically you should probably look at &#039;&#039;syslog&#039;&#039;, &#039;&#039;auth.log&#039;&#039;, &#039;&#039;kern.log&#039;&#039;, &#039;&#039;apache2/access.log&#039;&#039;, and &#039;&#039;apache2/error.log&#039;&#039; &lt;br /&gt;
:* Use the tail command to explore these logs&lt;br /&gt;
: In order to prevent log files from completely filling your drive old log files are eventually rotated on the system and compressed and then finally deleted. Take a look at some of the rotated log files like &#039;&#039;/var/log/syslog.1&#039;&#039; or &#039;&#039;/var/log/kern.log.1&#039;&#039; which will contain slightly older log entries.&lt;br /&gt;
:&#039;&#039; Note: After the first rotated file other files are usually compressed with gzip. You can decompress and view these on the fly using the &#039;&#039;&#039;zcat&#039;&#039;&#039; program.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Checking Your Work==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ping your assigned IP for your pod&amp;lt;/li&amp;gt;&lt;br /&gt;
     &amp;lt;ul&amp;gt;Your ping should return a response.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a browser on your own PC and navigate to your IP address.&amp;lt;/li&amp;gt;&lt;br /&gt;
     &amp;lt;ul&amp;gt;Your custom link page should appear in your browser window.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check your home directory for the logtail.txt file you created.&amp;lt;/li&amp;gt;&lt;br /&gt;
     &amp;lt;ul&amp;gt;The logtail.txt file should be in your home directory.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_05_test.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9587</id>
		<title>Lab 5 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9587"/>
		<updated>2021-03-22T23:35:14Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking Your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Learn about static network configuration of Debian Linux systems&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net PHP]&#039;&#039;&#039;&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net MariaDB]&#039;&#039;&#039; on your server, this is an open-source MySQL alternative&lt;br /&gt;
*Experiment with websites and databases&lt;br /&gt;
*Explore the standard log files on your system.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifup ifup]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifdown ifdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ping ping]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2ensite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2dissite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/wget wget]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/zcat zcat]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/service service]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/tail tail]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will also use the following MySQL (MariaDB) commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/use USE]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/show SHOW]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/select SELECT]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/drop-database DROP database]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software, login with your standard user account&lt;br /&gt;
# Make a note of the static IP address information for your particular system in the table below, it is based on the system name identification letter in vmWare. These IP addresses will ONLY be valid in the ITC vmWare Linux class subnet. If you are working on a local VirtualBox system you will need to select an available static IP from the correct subnet for your system or skip the static IP addressing section. All vmWare systems will use a gateway address of 172.17.50.1 and a subnet mask of 255.255.255.0 with two nameservers 172.17.139.11 and 172.17.139.111&lt;br /&gt;
{| {{table}}&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;System ID&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Static IP&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| A||172.17.50.11&lt;br /&gt;
|-&lt;br /&gt;
| B||172.17.50.12&lt;br /&gt;
|-&lt;br /&gt;
| C||172.17.50.13&lt;br /&gt;
|-&lt;br /&gt;
| D||172.17.50.14&lt;br /&gt;
|-&lt;br /&gt;
| E||172.17.50.15&lt;br /&gt;
|-&lt;br /&gt;
| F||172.17.50.16&lt;br /&gt;
|-&lt;br /&gt;
| G||172.17.50.17&lt;br /&gt;
|-&lt;br /&gt;
| H||172.17.50.18&lt;br /&gt;
|-&lt;br /&gt;
| I||172.17.50.19&lt;br /&gt;
|-&lt;br /&gt;
| J||172.17.50.20&lt;br /&gt;
|-&lt;br /&gt;
| K||172.17.50.21&lt;br /&gt;
|-&lt;br /&gt;
| L||172.17.50.22&lt;br /&gt;
|-&lt;br /&gt;
| M||172.17.50.23&lt;br /&gt;
|-&lt;br /&gt;
| N||172.17.50.24&lt;br /&gt;
|-&lt;br /&gt;
| O||172.17.50.25&lt;br /&gt;
|-&lt;br /&gt;
| P||172.17.50.26&lt;br /&gt;
|-&lt;br /&gt;
| Q||172.17.50.27&lt;br /&gt;
|-&lt;br /&gt;
| R||172.17.50.28&lt;br /&gt;
|-&lt;br /&gt;
| S||172.17.50.29&lt;br /&gt;
|-&lt;br /&gt;
| T||172.17.50.30&lt;br /&gt;
|-&lt;br /&gt;
| U||172.17.50.31&lt;br /&gt;
|-&lt;br /&gt;
| V||172.17.50.32&lt;br /&gt;
|-&lt;br /&gt;
| W||172.17.50.33&lt;br /&gt;
|-&lt;br /&gt;
| X||172.17.50.34&lt;br /&gt;
|-&lt;br /&gt;
| Y||172.17.50.35&lt;br /&gt;
|-&lt;br /&gt;
| Z||172.17.50.36&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set a static IP==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=VcPA6gJ0Ohw&amp;amp;feature=youtu.be Video Tutorial - Setting a Static IP Address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
:&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install PHP &amp;amp; MySQL/MariaDB==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=Az0qtg4LSjA&amp;amp;feature=youtu.be Video Tutorial -  Install PHP and MySQL MariaDB]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install packages&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using &#039;&#039;&#039;apt&#039;&#039;&#039;, install the &#039;&#039;php&#039;&#039; and &#039;&#039;mariadb-server&#039;&#039; packages as well as the &#039;&#039;php-mysql&#039;&#039; package which provides the link between php and mysql and the &#039;&#039;libapache2-mod-php&#039;&#039; package which provides a copy of PHP which allows the Apache webserver to run website PHP scripts.&lt;br /&gt;
&#039;&#039; Note: Remember to do an &#039;&#039;&#039;apt update&#039;&#039;&#039; before installing packages to make sure you get the latest versions&lt;br /&gt;
&#039;&#039; Note: Maria-DB is a fully compatible replacement for MySQL that isn&#039;t controlled by Oracle.&lt;br /&gt;
* After the dependencies are found, go ahead and accept them to continue the install.&lt;br /&gt;
&amp;lt;li&amp;gt; After the install is complete, &#039;&#039;&#039;cd&#039;&#039;&#039; to &#039;&#039;/var/www/html&#039;&#039; which is the root directory of your webserver and so where all website files are served from.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; In order to fully enable the PHP-MySQL module you should restart your Apache webserver. You don&#039;t need to restart your entire system to do this. Do some research on the &amp;quot;apache2ctl&amp;quot; or the &amp;quot;service apache2&amp;quot;  commands which can be used to do this.&lt;br /&gt;
&amp;lt;li&amp;gt; At this point we will test to verify that php is working properly with Apache. Create a new file named &#039;&#039;phptest.php&#039;&#039;, and then open it in a text editor.&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039; Note: you may have to use sudo to create and edit files in this directory.  as your standard user account may not have privilidges to create and edit files in this directory.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo touch phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Enter the following into the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;?php&lt;br /&gt;
phpinfo();&lt;br /&gt;
?&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Now save the file, and on your local machine go to xxx.xxx.xxx.xxx/phptest.php in a web browser where xxx.xxx.xxx.xxx is your VM&#039;s static IP. You should now be on a page that shows your PHP Version, and system information.&amp;lt;/li&amp;gt; &lt;br /&gt;
:[[File:Lab5_php_info.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Use the &amp;quot;View Source&amp;quot; option in your browser to see what the HTML source code is for the page you&#039;re viewing is. Is it the same or different than the .php file you created? Why? How is this different than a standard .html file?&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Lab5_php_info_devtab.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info_devtab.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Website PHP==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=m_sUrt_quX4&amp;amp;feature=youtu.be Video Tutorial - Experiment with Website PHP]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore Apache symlinks&amp;lt;/li&amp;gt;&lt;br /&gt;
:In a previous lab we learned about editing the &#039;&#039;/var/www/index.html&#039;&#039; file to change the default web page displayed by your server. In a future lab you will install some PHP/MySQL based software which powers many Internet sites with forums, blogs, etc. Before we can do that we need to learn a little more about PHP and about databases. Like most software on Linux the Apache webserver configuration files are stored in the &#039;&#039;/etc&#039;&#039; directory. Specifically, you can find several of them which work together and are called from each other in &#039;&#039;/etc/apache2/&#039;&#039; take a look in the &#039;&#039;/etc/apache2/sites-enabled/&#039;&#039; directory. See how symlinks are used to point to configuration files which actually reside in the &#039;&#039;/etc/apache2/sites-available/&#039;&#039; directory? This allows us to turn off and on various sites by creating or removing a symlink rather than by deleting the actual configuration file, a handy thing if we just want to temporarily disable a site. In fact Apache provides a utility to automatically add and remove these links called &#039;&#039;&#039;a2ensite&#039;&#039;&#039; and &#039;&#039;&#039;a2dissite&#039;&#039;&#039;. Check the &#039;&#039;&#039;man&#039;&#039;&#039; pages for these commands to see how they work.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore &#039;&#039;&#039;/etc/apche2/sites-enabled&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:As you might have guessed the default site for your system is configured by the file linked to at &#039;&#039;/etc/apache2/sites-enabled/000-default&#039;&#039; If you open this file in your favorite text editor you will see a series of what Apache calls &amp;quot;directives&amp;quot; which explain how the webserver should function, what port it should listen on, where the website files will reside (&#039;&#039;/var/www/html&#039;&#039;), etc. &lt;br /&gt;
:&#039;&#039; NOTE: Going into all of the different Apache directives is outside of the scope of this course but you will find a lot of documentation about them on the Internet.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the Apache configuration files in Webmin&amp;lt;/li&amp;gt;&lt;br /&gt;
:In addition to configuring Apache directly through it&#039;s configuration files you can also configure it through an interface like Webmin which we installed in a previous lab. Bring up the Webmin configuration page for Apache and take a look at the settings for the default site. Note how the things you saw directly in the configuration file match up with what you see in Webmin. One of the things you may be interested in seeing is how the webserver knows to display the index.html file from a directory if it exists and no specific file is requested in the URL. Take a look on the &amp;quot;Directory Indexing&amp;quot; page for the default virtualhost and see if you can find this information. You&#039;ll notice that there is a list of files, not just index.html which the server will display.&lt;br /&gt;
:&#039;&#039; NOTE: You may need to refresh your Webmin modules or &amp;quot;scan for new modules&amp;quot; if you haven&#039;t done that since installing Apache and Webmin. Webmin scans your system for compatible server software packages (like Apache) when it is installed but needs to re-scan it&#039;s modules after you install new server software before you can configure it through Webmin.&lt;br /&gt;
&amp;lt;li&amp;gt;Expiriment with and learn PHP basics&amp;lt;/li&amp;gt;&lt;br /&gt;
:In another section of this lab you created a basic &#039;&#039;phptest.php&#039;&#039; file and saw how the server executed the PHP code and turned it into an HTML page your browser could display. Because PHP offers an easy way to write web applications it powers much of the Internet. To prepare us for setting up some PHP applications in a future lab it will be helpful to know a little about how PHP scripts work. Read through the [http://www.w3schools.com/php/default.asp W3 Schools PHP Basics Tutorial] (PHP Intro through PHP Superglobals) and try creating some PHP scripts on your own Linux server like the examples given in the tutorial pages to see if you can get them to run, try modifying them a little bit and see what the results are. There are many great Internet resources devoted to understanding how to do things with PHP so take some time to see how this language can be easily integrated in websites. You should definitely be familiar with editing PHP files to change variables, echo statements, etc. work which are all skills you&#039;ll need when installing PHP based website software.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own PHP files&amp;lt;/li&amp;gt;&lt;br /&gt;
:*Try writing some simple PHP scripts on your own using variables and echo statements and make them available through your webserver.&lt;br /&gt;
:*A good place to create these would be in your home directory, using your favorite text editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own &amp;quot;home&amp;quot; page by editing your &#039;&#039;index.html&#039;&#039; file located in the &#039;&#039;&#039;/var/www/html&#039;&#039;&#039; directory.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You will need to be familiar with the very basics of editing HTML files in order to create links, etc. If you haven&#039;t done this before there are many introductory HTML tutorials available online.  A good starting place is [https://www.w3schools.com/html/html_basic.asp W3 Schools HTML Basics Examples]&lt;br /&gt;
:&#039;&#039; NOTE:It is importatnt to know that an &#039;&#039;&#039;html&#039;&#039;&#039; file must include the &amp;lt;!DOCTYPE HTML&amp;gt; tag.  Additionally, you will notice that all tags have an opening tag and a closing tag.  The information between the tags is what will have the features of the tag&lt;br /&gt;
:*Backup your &#039;&#039;index.html&#039;&#039; file by copying to a new file name.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo cp /var/www/html/index.html /var/www/html/index.html.bak&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Edit your &#039;&#039;index.html&#039;&#039; file (or create a new &#039;&#039;index.php&#039;&#039; file which will be loaded instead if it exists) so there is a list and links to the various scripts you have created as part of your PHP experimentation.&lt;br /&gt;
:* Open your index.html file in your favorite text editor,&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano /var/www/html/index.html&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Since you have backed up the original index.html file I would edit this file to only include the basics.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;My ITC-2480 Server&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;This is a server on Pod-R in NetLab at 172.17.50.XX&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Here are some of the Projects I am working on:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;http://172.17.50.XX/phptest.php&amp;quot;&amp;gt;PHP Version Information&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Make sure to replace the XX in the IP with the IP address of your server.&lt;br /&gt;
:&lt;br /&gt;
:[[File:Lab5_basic_html.png|link=https://wiki.ihitc.net/mediawiki/images/2/29/Lab5_basic_html.png|500px]]&lt;br /&gt;
:[[Media:Lab5_basic_html.png|Click here for a larger image]]&lt;br /&gt;
:A first look for a basic page&lt;br /&gt;
:[[File:Lab5_initial_home.png|link=https://wiki.ihitc.net/mediawiki/images/9/92/Lab5_initial_home.png|500px]]&lt;br /&gt;
:[[Media:Lab5_initial_home.png|Click for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Try to add additional features to your &amp;quot;home&amp;quot; page.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You may get some ideas of features you might like to add by looking at the original &#039;&#039;index.html&#039;&#039; file that we backed up in step 6 of this lab.&lt;br /&gt;
:*As you complete your labs consider what you can add to this page.&lt;br /&gt;
:*Add links to the PHP scripts you created&lt;br /&gt;
:*A few good chalanges would be to add a title, change font size, style or color.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Databases==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=1zYXiWLoGdM&amp;amp;feature=youtu.be Video Tutorial - Experiment with Databases]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: In order to do really powerful things with a website we need a database where we can store dynamic content which can be queried to automatically build site pages from a template. One of the most common databases is an SQL database, and MySQL has long been the most prevalent Linux SQL software. These days MariaDB, which we installed, has been taking some MySQL marketshare because it is a community developed program instead of MySQL which is now owned by Oracle. The MariaDB software and MySQL software are essentially equivalent, especially for small sites/databases, and the same commands are used interchangeably including using the &#039;&#039;&#039;mysql&#039;&#039;&#039; command to access them. SQL itself is a standard language for interacting with a specific type of database called a relational database, we&#039;ll see why it&#039;s called a relational database in a minute. Each database is a collection of data stored in tables. You can think of a table as something like a spreadsheet with rows and columns, except we call the columns fields and the rows records (sometimes we actually call them rows too). The different tables are often related to one another, of course they are usually being used by the same web application, but usually the relationship goes deeper than that as we&#039;ll see in a little bit.&lt;br /&gt;
&amp;lt;li&amp;gt;Download a sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To jumpstart our exploration of databases we&#039;ll download a pre-built sample database with a few tables and many records already in it and import it into our MySQL database server. Download the employees database file [https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2 employees_db-full-1.0.6.tar.bz2] (about 26MB) and get it into your home directory. Instead of using the &#039;&#039;&#039;links&#039;&#039;&#039; browser to do this or downloading to your computer and then pushing this large file back across the Internet with an SCP/SFTP client like FileZilla a better choice might be to learn about the &#039;&#039;&#039;wget&#039;&#039;&#039; program which can be used like &amp;quot;&#039;&#039;&#039;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&#039;&#039;&#039;&amp;quot; to download the file into your current working directory.&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Unpack the database file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Figure out how to use the &#039;&#039;&#039;tar&#039;&#039;&#039; program to unpack this .tar.bz2 file. Note that this file uses bz2 compression which takes longer to compress than gzip but can compress the files more. Once unpacked you should have an &amp;quot;employees_db&amp;quot; folder.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the files included with sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: Inside the &#039;&#039;employees_db&#039;&#039; folder you should have a number of &#039;&#039;.sql&#039;&#039; script files and dump files which can be used to restore the database to your system.&lt;br /&gt;
:*Take a look at the &#039;&#039;employees.sql&#039;&#039; file, it&#039;s just a text file, which describes the format of the database. &lt;br /&gt;
:*Also take a look at the &#039;&#039;load_employees.dump&#039;&#039; file, also just a text file, which contains all of the records from the employees table of the database. :&#039;&#039; NOTE: there are 300,000 some employee records in this database so you probably don&#039;t want to just use &#039;&#039;&#039;cat&#039;&#039;&#039; to view these files as it could take a while to print them out to your screen. Using the &#039;&#039;&#039;less&#039;&#039;&#039; program would be a better choice as it will allow you to exit viewing the file by pressing q at any time.&lt;br /&gt;
&amp;lt;li&amp;gt;Open the MySQL (MariaDB) command line&amp;lt;/li&amp;gt;&lt;br /&gt;
: We can interact with the MySQL/MariaDB server in many different ways. The first way we&#039;ll take a look at is through the command line &#039;&#039;&#039;mysql&#039;&#039;&#039; program. Run the &amp;quot;&#039;&#039;&#039;sudo mysql&#039;&#039;&#039;&amp;quot; command. &lt;br /&gt;
:&#039;&#039; NOTE: that we are running this command with system administrator permissions which allows us to log in to the MySQL server with database administrator permissions as well. The MySQL program actually stores it&#039;s own usernames and passwords as a MySQL database itself, you can create and modify these permissions from the mysql command line but we&#039;ll learn more about modifying them through the Webmin interface later.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo MySQL&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_cli.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab5_mariadb_cli.png|500px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_cli.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Explore MySQL (MariaDB) Commands&amp;lt;/li&amp;gt;&lt;br /&gt;
: MySQL has it&#039;s own command line language the you can use through the &amp;quot;mysql&amp;gt;&amp;quot; prompt you are now running. For example, if we want to see a list of databases on the system we can run &amp;quot;&#039;&#039;&#039;SHOW databases;&#039;&#039;&#039;&amp;quot; run the command and note the databases that already exist by default.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW databases;&amp;lt;/code&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Each MySQL/MariaDB statement ends with a semicolon (;) if you do not put the semicolon at the end of the line the command will not execute when you press enter and you will be able to continue to add more commands to the statement before finishing with a semicolon. If you accidentally press enter without ending with a semicolon you can just enter a semicolon on the next line and press enter.&lt;br /&gt;
&amp;lt;li&amp;gt;Import the sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To import the employee database we can use the &amp;quot;&#039;&#039;&#039;source employees.sql;&#039;&#039;&#039;&amp;quot; command (assuming we were already working in the directory which contains the employees.sql file when we launched mysql. Import the employee database and verify the system now has an employees database.&lt;br /&gt;
&amp;lt;code&amp;gt;SOURCE employees.sql;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the employees database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;USE employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
: If we want to see all of the tables in the employees database we must first select the database we want to work on using the &amp;quot;&#039;&#039;&#039;USE employees;&#039;&#039;&#039;&amp;quot; command.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the employee table&amp;lt;/li&amp;gt;&lt;br /&gt;
: Use the &amp;quot;&#039;&#039;&#039;SHOW tables;&#039;&#039;&#039;&amp;quot; command to see a list of tables.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW tables;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View a list of employees in table&amp;lt;/li&amp;gt;&lt;br /&gt;
: To see a list of all the records in a table we need to run a SELECT query &amp;quot;&#039;&#039;&#039;SELECT * from &#039;&#039;&amp;lt;tablename&amp;gt;&#039;&#039;&#039;&#039;&#039;&amp;quot; like &amp;quot;&#039;&#039;&#039;SELECT * from employees&#039;&#039;&#039;&amp;quot; which will list all the records in the &#039;&#039;employees&#039;&#039; table of the employees database and display them.&lt;br /&gt;
&amp;lt;code&amp;gt;SELECT * from employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_show_tables.png|link=https://wiki.ihitc.net/mediawiki/images/d/d5/Lab5_mariadb_show_tables.png|350px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_show_tables.png|Click here for a larger image]]&lt;br /&gt;
:* Remember that we previously selected to USE the &#039;&#039;employees&#039;&#039; database, this will be remembered until we USE a different database. Try displaying the records in a couple of different tables like employees and departments.&lt;br /&gt;
:&#039;&#039; NOTE: The output can be broken by using CTRL-C on your local machine if you do not wish to wait for all of the records to be displayed.&lt;br /&gt;
:&lt;br /&gt;
: There is much more that we can do from the MySQL/MariaDB command line but that would be a whole class or more itself. The MySQL/MariaDB programs are well documented on the Internet and with these basic skills you should be able to figure out most of it. Remember, the vast majority of what you read about MySQL will also work in MariaDB and vice-versa.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the MySQL interface in Webmin&lt;br /&gt;
: Now that you have learned a bit about MySQL databases from the command line let&#039;s see how they look in the Webmin web management interface. Log back in to your Webmin interface through a browser on your host system.&lt;br /&gt;
:* Because MySQL was not installed when we first setup Webmin you need to &amp;quot;scan for new modules&amp;quot; first. Once that process has finished refresh the page to see that MySQL has been added to the server section of Webmin.&lt;br /&gt;
:* Take a look at the Webmin MySQL module and see how MySQL users and permissions are configured.&lt;br /&gt;
:* Try browsing through the &#039;&#039;employees&#039;&#039; database using the Webmin interface including viewing tables and records inside of the tables.&lt;br /&gt;
&amp;lt;li&amp;gt;Drop database and exit MySQL (MariaDB)&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Go back to your MySQL command line window and run the command &amp;quot;&#039;&#039;&#039;DROP DATABASE employees;&#039;&#039;&#039;&amp;quot; to delete the entire database.&lt;br /&gt;
:* Type &amp;quot;&#039;&#039;&#039;exit;&#039;&#039;&#039;&amp;quot; to quit the MySQL program and return to a Linux shell.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039; NOTE: Obviously, the DROP command is one to be careful with as you can easily wipe out a huge database with one line! &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==View Logfiles==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=cxIOQF-eMy0&amp;amp;feature=youtu.be Video Tutorial - Tutorial 5 View Logfiles]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: Linux stores most of log files in the &#039;&#039;/var/log&#039;&#039; directory so change your working directory to &#039;&#039;/var/log&#039;&#039;.&lt;br /&gt;
: Some log files are viewable by all users on the system but other log files may be restricted and you will need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to view them.&lt;br /&gt;
&amp;lt;li&amp;gt;View last 20 lines in &#039;&#039;&#039;/var/log/syslog&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;tail -20 /var/log/syslog&amp;lt;/code&amp;gt;&lt;br /&gt;
:[[File:Lab5_tail.png|link=https://wiki.ihitc.net/mediawiki/images/8/88/Lab5_tail.png|500px]]&lt;br /&gt;
:[[Media:Lab5_tail.png|Click here for a larger image]]&lt;br /&gt;
: Linux log files are typically standard text files and can be read with standard text file utilities like cat or less. One additional utility which comes in hand is the &#039;&#039;&#039;tail&#039;&#039;&#039; program which displays the last 10 lines (by default) of a text file and which can be configured to display more or less lines using a command like &#039;&#039;&#039;tail -20 /var/log/syslog&#039;&#039;&#039; which will display the last 20 lines of the main system log file. The manual page for the &#039;&#039;&#039;tail&#039;&#039;&#039; command contains additional information like how to use the &#039;&#039;-f&#039;&#039; option to view a log in realtime (exit with Ctrl-C).&lt;br /&gt;
&amp;lt;li&amp;gt;Save the tail output to a file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Often we may want to save the output from a &#039;&#039;&#039;tail&#039;&#039;&#039; command to share with others or document an issue.  This can easily be done using redirection we learned in a previous lab.  Experiment with how to save some tail commands.  Keep in mind you may need to escalate privileges for some files to be redirected.  Try the following:&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo tail -20 /var/log/syslog &amp;gt; logtail.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Explore some other log files&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at some of the log files on your system and see what kinds of information they contain specifically you should probably look at &#039;&#039;syslog&#039;&#039;, &#039;&#039;auth.log&#039;&#039;, &#039;&#039;kern.log&#039;&#039;, &#039;&#039;apache2/access.log&#039;&#039;, and &#039;&#039;apache2/error.log&#039;&#039; &lt;br /&gt;
:* Use the tail command to explore these logs&lt;br /&gt;
: In order to prevent log files from completely filling your drive old log files are eventually rotated on the system and compressed and then finally deleted. Take a look at some of the rotated log files like &#039;&#039;/var/log/syslog.1&#039;&#039; or &#039;&#039;/var/log/kern.log.1&#039;&#039; which will contain slightly older log entries.&lt;br /&gt;
:&#039;&#039; Note: After the first rotated file other files are usually compressed with gzip. You can decompress and view these on the fly using the &#039;&#039;&#039;zcat&#039;&#039;&#039; program.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Checking Your Work==&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ping your assigned IP for your pod&amp;lt;/li&amp;gt;&lt;br /&gt;
     &amp;lt;ul&amp;gt;Your ping should return a response.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a browser on your own PC and navigate to your IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
     &amp;lt;ul&amp;gt;Your custom link page should appear in your browser window.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check your home directory for the logtail.txt file you created&amp;lt;/li&amp;gt;&lt;br /&gt;
     &amp;lt;ul&amp;gt;The logtail.yxy file should be in your home directory&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_05_test.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9586</id>
		<title>Lab 1 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9586"/>
		<updated>2021-03-22T23:25:17Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
:In this lab you will perform the following tasks:&lt;br /&gt;
*Access NetLab to access the environment for you virtual machine&lt;br /&gt;
*Install the latest version of Debian Linux in a virtual machine&lt;br /&gt;
*Learn how to login and check the IP address of the system&lt;br /&gt;
*Learn to remotely access the system with SSH and SFTP.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/apt apt]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/sudo sudo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/useradd adduser]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ip ip address show]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Netlab Access==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=-hLejbDfPGM&amp;amp;feature=youtu.be Video Tutorial - NetLab Access]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Connect to the ITCnet &amp;lt;/li&amp;gt; &lt;br /&gt;
: This can be accomplished by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the [[ITC_VPN_Instructions|VPN]].&lt;br /&gt;
:&#039;&#039; Note: If you want to connect using a wireless connection on campus you need to [[Connecting to Eduroam|connect to the eduroam network]] before connecting to the VPN.&lt;br /&gt;
&amp;lt;li&amp;gt; After you are connected to ITCnet (by VPN or wired connection) you simply need to open a web browser and access https://ihcc-netlab.campus.ihitc.net&amp;lt;/li&amp;gt;&lt;br /&gt;
*  The first time you visit this site in a browser you may need to accept a self-signed security certificate&lt;br /&gt;
*  You will need to log in with a username and password established by your instructor.&lt;br /&gt;
*  The first time you log in you will need to change your password and set your timezone. Make sure your timezone is set correctly so you can schedule reservations to work with equipment at convenient times.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are logged in click the blue &amp;quot;New Lab Reservation&amp;quot; button&amp;lt;/li&amp;gt;&lt;br /&gt;
: Next, in the lower left corner of the screen, select &amp;quot;Schedule a Lab for Myself&amp;quot;. Reservations are used to hold a place on the Netlab system to work on labs during a specific time. You only need reservations in this class when working with the GUI, which will come later in the class, if you need to turn the power back on to your VM, or during the installation process. The rest of the time you will be able to connect directly to your Linux server using the SSH protocol, but more on that in a bit.&lt;br /&gt;
:&#039;&#039; Note: If you are enrolled in more than one class that is using Netlab you will be presented with a list of classes you are enrolled in, click on your Linux System Administration course of you see this screen.&lt;br /&gt;
: All of our lab work in this class is done in a single &amp;quot;Lab Environment&amp;quot; and your progress will be saved from one reservation to another. As a result there is only one lab listed in this course &amp;quot;Linux System Administration Labs&amp;quot;. Click on this lab title.&lt;br /&gt;
&amp;lt;li&amp;gt; Use the calendar to choose a date, time, and specific pod to reserve for your lab activity (when you will begin your Debian server installation).&amp;lt;/li&amp;gt;&lt;br /&gt;
: The red line on this screen indicates the current time. If you want to get started right away you can click just below this line. Pay attention to the title of the column at the top, it will say something like &amp;quot;LSA Pod Z&amp;quot;. The letter at the end of this pod name is your &amp;quot;pod letter&amp;quot; which you will use to set the host name and IP address of your machine in the future so make note of it.&lt;br /&gt;
: You will be presented with a summary screen for your reservation where you can set the end time of your reservation (up to a maximum). It is suggested to make your reservation a couple hours long the first time you plan to install Debian, though you can extend it if needed. Click submit once you are ready to make the reservation.&lt;br /&gt;
&amp;lt;li&amp;gt;You will see a confirmation screen that your reservation has been made.&amp;lt;/li&amp;gt;&lt;br /&gt;
: You are now ready to progress on to the Debian Linux Installation (as long as your reservation is right away).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debian Linux Installation==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=H0DcdEytpFQ&amp;amp;feature=youtu.be Video Tutorial - Debian Linux Installation]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Log in to the Netlab system&amp;lt;/li&amp;gt;&lt;br /&gt;
: Access this using a web browser at https://ihcc-netlab.campus.ihitc.net if you are not already logged in.&lt;br /&gt;
: If you have a currently active reservation you will see a green &amp;quot;Enter Lab&amp;quot; button on your list of reservations. Click the green &amp;quot;Enter Lab&amp;quot; button. If not, you will need to make a reservation (see above) and then click the &amp;quot;Enter Lab&amp;quot; button.&lt;br /&gt;
: Your virtual machines (VMs) will automatically power on when your reservation begins and because there is no operating system currently installed to their virtual hard drives they will boot from their virtual CD/DVD drives which have been pre-loaded with the installation discs for Linux.&lt;br /&gt;
&amp;lt;li&amp;gt; Access you virtual machine console&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you are in your pod you can either click on the image of the &amp;quot;Linux Server&amp;quot; on the topology diagram or use the tabs across the top of your screen to access the console of your Linux Server VM.&lt;br /&gt;
: The console shows the display of your VM and allows you to type and interact with your VM just as if you were physically sitting down in front of a server with a monitor, keyboard, and mouse attached. Just like a separate physical machine you will not be able to copy and paste text or drag and drop files in and out of this console window. We will use other utilities across the network connection to do those things just like we would with a physical server.&lt;br /&gt;
&amp;lt;li&amp;gt;Learn to &amp;quot;Power Cycle&amp;quot; your virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: By now your VM has likely already booted from it&#039;s virtual CD/DVD drive and should be at the &amp;quot;Debian GNU/Linux installer menu&amp;quot;. Before continuing let&#039;s practice rebooting your system so you can watch the system boot and see how to reboot the system if needed. Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power Off&amp;quot; then click the red &amp;quot;Power Off&amp;quot; button on the popup to power off your VM. This is the equivalent of just pulling out the power cord, at least until we install the VMware Tools software which allows for a graceful shutdown, so you&#039;ll want to be careful to only do this if absolutely needed until then.&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power On&amp;quot;, or press the blue &amp;quot;Power On&amp;quot; button in the middle of your screen, then press the green &amp;quot;Power On&amp;quot; button to boot your system.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has rebooted and is back to the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Installing sudo and Checking Your IP Address==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=TwXp5YfAvlw&amp;amp;feature=youtu.be Video Tutorial - Installing sudo and checking your IP address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Log in to NetLab&amp;lt;/li&amp;gt;&lt;br /&gt;
: Login through the Netlab local console with your root account and password (username &#039;&#039;root&#039;&#039;, password as set during the installation)&lt;br /&gt;
:&#039;&#039; Note: When entering a password on the command line of a Linux system it is normal that nothing should appear and the cursor will not move when you are typing. This prevents someone who is able to see your computer screen from seeing what your password is or even how long it is. Just type your password and trust that the system is receiving it, press enter to submit your password.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
[[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Logging in to a Remote Terminal==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Logging into a remote terminal]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A faster way to interact with your system is not through the Netlab local console but through a remote SSH session over the network directly to your server. Once you have mastered this you will be able to copy and paste text to your Linux server and will not need to make a reservation in Netlab to work on labs. For our purposes you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Putty&amp;lt;/li&amp;gt;&lt;br /&gt;
: Assuming you are running Windows, install the PuTTY software on your home PC from [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html this website].&lt;br /&gt;
: &#039;&#039;  Note: For other operating systems there are other ways and software you can use to make an SSH connection, you will need to research what tools are used for making SSH connections from your particular operating system.&lt;br /&gt;
&amp;lt;li&amp;gt;Open an SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the PuTTY software on your computer and enter in the IP address of your VM in the &amp;quot;Host Name&amp;quot; box and click the &amp;quot;Open&amp;quot; button.&lt;br /&gt;
:[[File:Lab1_putty.png|link=https://wiki.ihitc.net/mediawiki/images/f/f5/Lab1_putty.png|500px]]&lt;br /&gt;
:[[Media:Lab1_putty.png| Click here for larger image]]&lt;br /&gt;
:* Click Yes to save the host key on your system&lt;br /&gt;
: [[File:Lab1_puttycert.png|link=https://wiki.ihitc.net/mediawiki/images/4/4b/Lab1_puttycert.png|500px]]&lt;br /&gt;
: [[Media:Lab1_puttycert.png|Click here for larger image]]&lt;br /&gt;
:* Enter the standard username and password for your Linux system to connect.&lt;br /&gt;
: &#039;&#039;  Note: You should receive a prompt just like the one you had on the Netlab local console but it is now a direct connection from your computer over the ITCnet to your server.&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Remote File Transfer==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Remote File Transfer]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The easiest way to transfer files to and from your VM is with SFTP software. For our purposes, you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install FileZilla&amp;lt;/li&amp;gt;&lt;br /&gt;
: Install the FileZilla client software on your home PC from [https://filezilla-project.org/download.php?type=client this website]&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SFTP session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run FileZilla and use the Quick Connect bar at the top of the screen to access your system. &lt;br /&gt;
:*  Enter the IP address of your Linux system in the &amp;quot;Host:&amp;quot; box&lt;br /&gt;
:*  Enter your standard username and password in the appropriate boxes&lt;br /&gt;
:*  Enter &#039;&#039;22&#039;&#039; in the &amp;quot;Port:&amp;quot; box&lt;br /&gt;
:*  Click the &amp;quot;Quickconnect&amp;quot; button.&lt;br /&gt;
: [[File:Lab1_filezillanew.png|link=https://wiki.ihitc.net/mediawiki/images/b/b1/Lab1_filezillanew.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillanew.png|Click here for larger image]]&lt;br /&gt;
: You should see some connection text scroll on the top of the screen and some files on the right side of the screen now such as &#039;&#039;.bashrc&#039;&#039; and &#039;&#039;.profile&#039;&#039; The right side of the screen is the drive on your Linux system and the left side of the screen is the drive on your home system. Files and folders can be dragged between the two sides to transfer them back and forth.&lt;br /&gt;
: [[File:Lab1_filezillaconnected.png|link=https://wiki.ihitc.net/mediawiki/images/c/ca/Lab1_filezillaconnected.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillaconnected.png|Click here for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Close the FileZilla software to disconnect.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install VM Tools==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Install VM Tools]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect into your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Python==&lt;br /&gt;
In order to check your work in the labs of this course you will need to have an application called [https://www.python.org/ Python] installed on your Linux system.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Download &#039;&#039;python3&#039;&#039; using &#039;&#039;&#039;apt&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
* When prompted type Y to install the app and its dependencies&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&#039;&#039;NOTE: This may take a while.&#039;&#039;&amp;lt;/ul&amp;gt;&lt;br /&gt;
* When prompted to specify the name of the host where the TANGO database server is running, just select ok.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_tango.png|link=https://wiki.ihitc.net/mediawiki/images/4/4c/Python_tango.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_tango.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to verify that python version 3.6 is installed.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;python3 --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_version.png|link=https://wiki.ihitc.net/mediawiki/images/7/70/Python_version.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_version.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Nmap==&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:* &#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the following command at the command line.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install nmap&amp;lt;/code&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Curl==&lt;br /&gt;
:Curl is a tool that lets you run scripts that are not saved to your virtual machine. It will be used to check the labs for completion while working through the course.  &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command at the command line. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install curl&amp;lt;/code&amp;gt;&lt;br /&gt;
: If prompted to install additional packages type &amp;quot;y&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Safely Shutdown==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Safely Shutdown]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
:We will normally leave our VM running but it is important that you know how to shutdown a Linux system correctly so this time we&#039;ll turn it off.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect in to your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt; Safely shutdown you server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the &#039;&#039;&#039;sudo shutdown -h now&#039;&#039;&#039; at the command line to safely shutdown the system.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo shutdown -h now&amp;lt;/code&amp;gt;&lt;br /&gt;
: You should soon get a message that PuTTY has lost it&#039;s connection. Click OK and then you can close the PuTTY window.&lt;br /&gt;
&amp;lt;li&amp;gt;End NetLab Reservation&amp;lt;/li&amp;gt;&lt;br /&gt;
: If you still have time left in your reservation in Netlab it&#039;s polite to end the reservation so other users can work on the system, only a limited number of reservations can be made at one time. You can do this by logging into Netlab, opening your lab, and clicking the &amp;quot;Reservation&amp;quot; menu at the top of the screen and choose to &amp;quot;End Reservation Now&amp;quot; followed by confirming that you want to end the reservation.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;This section will cover ways to manually check your work&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;ul&amp;gt;For this lab each section was tested in the process of the lab.  You should have successfully connected an SSH session with putty, and an ftp session with FileZilla.&amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;ul&amp;gt;You should have shut down you server in one of the last steps, so no further testing is necessary at this time.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Automatically check your results by running this command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9566</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9566"/>
		<updated>2021-03-05T01:24:17Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install the Postfix MTA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Install the Postfix MTA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=6VsgO5695Z4&amp;amp;feature=youtu.be Video Tutorial - Install Postfix MTA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use a package manager to install the &#039;&#039;postfix&#039;&#039; package.&lt;br /&gt;
* During the installation process select &#039;&#039;Internet Site&#039;&#039; as the type of mail server and set the domain name to &#039;&#039;*.itc2480.campus.ihitc.net&#039;&#039; where * is the hostname letter of your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
: MTA software listens for incoming connections from other MTA servers on port 25 and accepts mail on behalf of users on the system. Once the mail is received it is stored locally for users to retrieve. The most common methods for storing messages is in an .mbox file, where all messages are stored in a single file, or in a Maildir, which is a directory where each message is stored in a separate file. The MTA also listens for connections from client software (MUA) and accepts outbound messages from them and forwards them on to the destination domain&#039;s mail server. Advanced configuration of MTA software can allow for anti-spam filtering, mailing list support or other programs to intercept and manipulate mail as it passes through the server.&lt;br /&gt;
&amp;lt;li&amp;gt;Test the connection an verify the port is open&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Use Telnet to connect to the Postfix SMTP server on port 25: &#039;&#039;&#039;telnet localhost 25&#039;&#039;&#039;&lt;br /&gt;
: [[File:Lab9_open_telnet.png|link=https://wiki.ihitc.net/mediawiki/images/1/10/Lab9_open_telnet.png|500px]]&lt;br /&gt;
: [[Media:Lab9_open_telnet.png | Click here for larger image]]&lt;br /&gt;
:* Type &#039;&#039;&#039;quit&#039;&#039;&#039; and press enter after verifying Postfix is running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Configure Maildir&amp;lt;/li&amp;gt;&lt;br /&gt;
: Because the Courier IMAP and POP3 server software only supports Maildir style message stores and Postfix stores in mbox files by default you must edit the &#039;&#039;/etc/postfix/main.cf&#039;&#039; file to fix this. &lt;br /&gt;
:* Add the line &lt;br /&gt;
:&amp;lt;pre&amp;gt;home_mailbox = Maildir/&amp;lt;/pre&amp;gt; &lt;br /&gt;
: Edit or add the &#039;&#039;mailbox_command&#039;&#039; parameter so there is nothing on the line after the equals sign, delete the portion of the line referencing procmail if it exists. The line should look like: &lt;br /&gt;
:&amp;lt;pre&amp;gt;mailbox_command = &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Restart the &#039;&#039;postfix&#039;&#039; service to apply your change. Postfix is now saving new incoming messages into the Maildir folder inside each user&#039;s home directory. This folder is automatically created by Postfix the first time a new message comes in for a user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Set your shell to recognize the maildir as your mail location&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/login.defs&#039;&#039; file and comment out the &#039;&#039;MAIL_DIR /var/mail&#039;&#039; line (place a # in front of the line) and add a line setting &#039;&#039;MAIL_FILE&#039;&#039; like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#MAIL_DIR        /var/mail&lt;br /&gt;
MAIL_FILE      Maildir/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/login&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so standard&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so standard&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/su&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so nopen&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so nopen&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir nopen&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/sshd&#039;&#039; file, find and comment out the &#039;&#039;session    optional     pam_mail.so standard noenv&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional     pam_mail.so standard noenv&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/profile&#039;&#039; file and at the end of the file add the line: &amp;lt;pre&amp;gt;export MAIL=~/Maildir&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Test sending and receiving mail as a locally logged on user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Install the &#039;&#039;mailutils&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try sending a message (replace username with your username): &amp;lt;pre&amp;gt;echo &amp;quot;This is my message&amp;quot; | mail -s &amp;quot;Email Subject&amp;quot; username@localhost&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Log out of your SSH session and open a new SSH session to apply the changes to the &#039;&#039;/etc/profile&#039;&#039; and &#039;&#039;/etc/login.defs&#039;&#039; files.&lt;br /&gt;
:* Check to see if the message was received using the &#039;&#039;&#039;mail&#039;&#039;&#039; command, press &#039;&#039;q&#039;&#039; to return to the command line.&lt;br /&gt;
:[[File:Lab9_cli_send_mail.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab9_cli_send_mail.png|500px]]&lt;br /&gt;
:[[Media:Lab9_cli_send_mail.png|Click here for a larger image]]&lt;br /&gt;
: You should also be able to see the message in &#039;&#039;~/Maildir/&#039;&#039; in either the &#039;&#039;new/&#039;&#039; or &#039;&#039;cur/&#039;&#039; directory depending on whether you have viewed the message list yet or not. In either case, the message will appear as a text file with a random-looking name. It&#039;s just a text file so you can use &#039;&#039;&#039;cat&#039;&#039;&#039; or &#039;&#039;&#039;less&#039;&#039;&#039; to view it.&lt;br /&gt;
&amp;lt;li&amp;gt; Create Aliases &amp;lt;/li&amp;gt;&lt;br /&gt;
: You can create aliases and forward mail between users by editing the &#039;&#039;/etc/aliases&#039;&#039; file and then running the &#039;&#039;&#039;newaliases&#039;&#039;&#039; program. &lt;br /&gt;
:* Create an &amp;quot;alias&amp;quot; for &#039;&#039;sysadmin&#039;&#039; which forwards mail sent to sysadmin@localhost to your username &lt;br /&gt;
:* Send a copy of all mail to the &#039;&#039;root&#039;&#039; account to your username &lt;br /&gt;
&lt;br /&gt;
: Now would be a good time to try logging on to Webmin again, re-scanning for modules and then taking a look at the Postfix module in the &#039;&#039;Servers&#039;&#039; section.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the mail log file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at your &#039;&#039;/var/log/mail.info&#039;&#039; log to see Postfix sending and receiving messages for users.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install Courier MDA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=uvZlSiQHlxs&amp;amp;feature=youtu.be Video Tutorial - Install Courier MDA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install required courier packages &amp;lt;/li&amp;gt;&lt;br /&gt;
: Most users prefer to retrieve mail from a mail server using an MDA protocol like POP3 or IMAP which can be provided by the Courier programs. Install the &#039;&#039;courier-pop&#039;&#039;, &#039;&#039;courier-imap&#039;&#039;, and &#039;&#039;fam&#039;&#039; packages.&lt;br /&gt;
:* Do not create the directories for web-based administration as they are unneeded for our setup&lt;br /&gt;
: Local users accessing their mailbox with MUA software can read and write to the .mbox file or Maildir directly. If a user not locally logged on to the system wants to access their mailbox the server runs MDA software which typically uses the POP3 or IMAP protocol for accessing the .mbox file or Maildir remotely.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9565</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9565"/>
		<updated>2021-03-05T01:23:13Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Postfix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Install the Postfix MTA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=6VsgO5695Z4&amp;amp;feature=youtu.be Video Tutorial - Install Postfix MTA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use a package manager to install the &#039;&#039;postfix&#039;&#039; package.&lt;br /&gt;
* During the installation process select &#039;&#039;Internet Site&#039;&#039; as the type of mail server and set the domain name to &#039;&#039;*.itc2480.campus.ihitc.net&#039;&#039; where * is the hostname letter of your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
: MTA software listens for incoming connections from other MTA servers on port 25 and accepts mail on behalf of users on the system. Once the mail is received it is stored locally for users to retrieve. The most common methods for storing messages is in an .mbox file, where all messages are stored in a single file, or in a Maildir, which is a directory where each message is stored in a separate file. The MTA also listens for connections from client software (MUA) and accepts outbound messages from them and forwards them on to the destination domain&#039;s mail server. Advanced configuration of MTA software can allow for anti-spam filtering, mailing list support or other programs to intercept and manipulate mail as it passes through the server.&lt;br /&gt;
&amp;lt;li&amp;gt;Test the connection an verify the port is open&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Use Telnet to connect to the Postfix SMTP server on port 25: &#039;&#039;&#039;telnet localhost 25&#039;&#039;&#039;&lt;br /&gt;
: [[File:Lab9_open_telnet.png|link=https://wiki.ihitc.net/mediawiki/images/1/10/Lab9_open_telnet.png|500px]]&lt;br /&gt;
: [[Media:Lab9_open_telnet.png | Click here for larger image]]&lt;br /&gt;
:* Type &#039;&#039;&#039;quit&#039;&#039;&#039; and press enter after verifying Postfix is running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Configure Maildir&amp;lt;/li&amp;gt;&lt;br /&gt;
: Because the Courier IMAP and POP3 server software only supports Maildir style message stores and Postfix stores in mbox files by default you must edit the &#039;&#039;/etc/postfix/main.cf&#039;&#039; file to fix this. &lt;br /&gt;
:* Add the line &lt;br /&gt;
:&amp;lt;pre&amp;gt;home_mailbox = Maildir/&amp;lt;/pre&amp;gt; &lt;br /&gt;
: Edit or add the &#039;&#039;mailbox_command&#039;&#039; parameter so there is nothing on the line after the equals sign, delete the portion of the line referencing procmail if it exists. The line should look like: &lt;br /&gt;
:&amp;lt;pre&amp;gt;mailbox_command = &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Restart the &#039;&#039;postfix&#039;&#039; service to apply your change. Postfix is now saving new incoming messages into the Maildir folder inside each user&#039;s home directory. This folder is automatically created by Postfix the first time a new message comes in for a user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Set your shell to recognize the maildir as your mail location&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/login.defs&#039;&#039; file and comment out the &#039;&#039;MAIL_DIR /var/mail&#039;&#039; line (place a # in front of the line) and add a line setting &#039;&#039;MAIL_FILE&#039;&#039; like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#MAIL_DIR        /var/mail&lt;br /&gt;
MAIL_FILE      Maildir/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/login&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so standard&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so standard&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/su&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so nopen&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so nopen&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir nopen&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/sshd&#039;&#039; file, find and comment out the &#039;&#039;session    optional     pam_mail.so standard noenv&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional     pam_mail.so standard noenv&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/profile&#039;&#039; file and at the end of the file add the line: &amp;lt;pre&amp;gt;export MAIL=~/Maildir&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Test sending and receiving mail as a locally logged on user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Install the &#039;&#039;mailutils&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try sending a message (replace username with your username): &amp;lt;pre&amp;gt;echo &amp;quot;This is my message&amp;quot; | mail -s &amp;quot;Email Subject&amp;quot; username@localhost&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Log out of your SSH session and open a new SSH session to apply the changes to the &#039;&#039;/etc/profile&#039;&#039; and &#039;&#039;/etc/login.defs&#039;&#039; files.&lt;br /&gt;
:* Check to see if the message was received using the &#039;&#039;&#039;mail&#039;&#039;&#039; command, press &#039;&#039;q&#039;&#039; to return to the command line.&lt;br /&gt;
:[[File:Lab9_cli_send_mail.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab9_cli_send_mail.png|500px]]&lt;br /&gt;
:[[Media:Lab9_cli_send_mail.png|Click here for a larger image]]&lt;br /&gt;
: You should also be able to see the message in &#039;&#039;~/Maildir/&#039;&#039; in either the &#039;&#039;new/&#039;&#039; or &#039;&#039;cur/&#039;&#039; directory depending on whether you have viewed the message list yet or not. In either case, the message will appear as a text file with a random-looking name. It&#039;s just a text file so you can use &#039;&#039;&#039;cat&#039;&#039;&#039; or &#039;&#039;&#039;less&#039;&#039;&#039; to view it.&lt;br /&gt;
&amp;lt;li&amp;gt; Create Aliases &amp;lt;/li&amp;gt;&lt;br /&gt;
: You can create aliases and forward mail between users by editing the &#039;&#039;/etc/aliases&#039;&#039; file and then running the &#039;&#039;&#039;newaliases&#039;&#039;&#039; program. &lt;br /&gt;
:* Create an &amp;quot;alias&amp;quot; for &#039;&#039;sysadmin&#039;&#039; which forwards mail sent to sysadmin@localhost to your username &lt;br /&gt;
:* Send a copy of all mail to the &#039;&#039;root&#039;&#039; account to your username &lt;br /&gt;
&lt;br /&gt;
: Now would be a good time to try logging on to Webmin again, re-scanning for modules and then taking a look at the Postfix module in the &#039;&#039;Servers&#039;&#039; section.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the mail log file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at your &#039;&#039;/var/log/mail.info&#039;&#039; log to see Postfix sending and receiving messages for users.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
== Install Courier MDA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=uvZlSiQHlxs&amp;amp;feature=youtu.be Video Tutorial - Install Courier MDA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install required courier packages &amp;lt;/li&amp;gt;&lt;br /&gt;
: Most users prefer to retrieve mail from a mail server using an MDA protocol like POP3 or IMAP which can be provided by the Courier programs. Install the &#039;&#039;courier-pop&#039;&#039;, &#039;&#039;courier-imap&#039;&#039;, and &#039;&#039;fam&#039;&#039; packages.&lt;br /&gt;
:* Do not create the directories for web-based administration as they are unneeded for our setup&lt;br /&gt;
: Local users accessing their mailbox with MUA software can read and write to the .mbox file or Maildir directly. If a user not locally logged on to the system wants to access their mailbox the server runs MDA software which typically uses the POP3 or IMAP protocol for accessing the .mbox file or Maildir remotely.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9564</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9564"/>
		<updated>2021-03-05T01:21:05Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Reply Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Postfix==&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9545</id>
		<title>Lab 10 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9545"/>
		<updated>2021-03-02T01:36:35Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=dQw4w9WgXcQ Watch the video introduction]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This lab assumes you have successfully set up [[Lab_8_mnjk#Install_BIND_.26_Enable_Caching | DNS]] and [[Lab_9_mnjk#Install_the_Postfix_MTA |email]].  If you had any issues with those labs, you should resolve them before attempting this lab, since you will be unable to properly test the tasks in this lab if those are not fully functional.&lt;br /&gt;
&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Configuring a [https://firewalld.org/ Firewall]&lt;br /&gt;
*Enabling a 2nd interface&lt;br /&gt;
*Configuring [https://en.wikipedia.org/wiki/Network_address_translation NAT]&lt;br /&gt;
*Setting up [https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol DHCP]&lt;br /&gt;
*Installing [https://linuxmint.com/ Linux Mint] on a second VM&lt;br /&gt;
*Enabling [https://en.wikipedia.org/wiki/Port_forwarding Port Forwarding]&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
*&#039;&#039;&#039;[https://firewalld.org/documentation/man-pages/firewall-cmd.html firewall-cmd]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/echo echo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifconfig ifconfig]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software.&lt;br /&gt;
# Login with your standard user account.&lt;br /&gt;
# Have a browser window set to the webmin interface for your linux VM.&lt;br /&gt;
&lt;br /&gt;
== Configure a Firewall ==&lt;br /&gt;
&#039;&#039;NOTE: It is suggested that instead of managing a firewall directly  using nftables tools (which would also require us to create a script to reload our rules each time the system is restarted) we use a firewall daemon program to manage it based on a set of rules we create and automatically setup the firewall based on those rules each time the system boots. There are many command line firewall management programs out there but for this lab we will use the [https://firewalld.org/ firewalld] package suggested by Debian. &#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Begin by installing the &#039;&#039;firewalld&#039;&#039; package on your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s check to see if the firewall is now up and running using the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --state&amp;lt;/code&amp;gt;&lt;br /&gt;
: The firewall has been pre-configured with a couple of rules in it to prevent us from getting locked out. &lt;br /&gt;
: [[File:Lab10_firewalld_state.png | link=https://wiki.ihitc.net/mediawiki/images/1/11/Lab10_firewalld_state.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_state.png | Click for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Let&#039;s see what those rules are by using this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: [[File:Lab10_firewalld_initial_rules.png | link=https://wiki.ihitc.net/mediawiki/images/1/14/Lab10_firewalld_initial_rules.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_initial_rules.png | Click for larger image]]&lt;br /&gt;
: By default all interfaces are in the public zone (this is set in the &#039;&#039;/etc/firewalld/firewalld.conf&#039;&#039; file). &lt;br /&gt;
: Before we start working on rules for our firewall we should assign our outside interface to the external zone which is designed for NAT routing which we&#039;ll be setting up shortly. &lt;br /&gt;
&amp;lt;li&amp;gt; We can do this with the command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-interface=ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
: We can create custom zones or use pre-defined security zones which will speed up configuring the firewall. Learn more about the [https://firewalld.org/documentation/zone/predefined-zones.html pre-defined zones in firewalld documentation].&lt;br /&gt;
&amp;lt;li&amp;gt;Since we have changed zones on our interface let&#039;s check and see what rules we have started with. Let&#039;s see what those rules are:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: You can also use the &#039;&#039;&#039;firewall-cmd --list-all-zones&#039;&#039;&#039; command to see a list of all available zones and their rules.&amp;lt;/li&amp;gt;&#039;&#039;&lt;br /&gt;
: If you were watching carefully you may have noted that the dhcpv6-client service which was allowed in the public zone but is not allowed by default on the external zone. &lt;br /&gt;
&amp;lt;li&amp;gt;In our case we want to allow DHCPv6 to operate on our outside interface so we can re-enable it with the following command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --zone=external --add-service=&amp;quot;dhcpv6-client&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check to see what other services can be allowed on an interface with:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --get-services&amp;lt;/code&amp;gt;&lt;br /&gt;
: If you check you will see that although you can connect with ssh (by default it&#039;s on the allowed service list you saw above) you can&#039;t connect to your webserver or Webmin anymore. Webmin is not a pre-defined service in the list we saw above so we could either set it up as a new service and then allow it or we could create a manual rule to allow the TCP traffic on port 10000 needed to access Webmin. In this case because the service only uses a single port and to see how manual rules can be created let&#039;s manually create a rule to allow access to TCP port 10000. &lt;br /&gt;
&amp;lt;li&amp;gt;Do this by running this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-port=10000/tcp &amp;lt;/code&amp;gt;&lt;br /&gt;
:You should now be able to access Webmin again.&lt;br /&gt;
&amp;lt;li&amp;gt; Using either service rules or manual port rules create additional rules so that the other services on your VM are again accessible from the outside (such as from your home PC over the VPN). &amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;HINT: Services we have setup so far include SSH, DNS, SMTP, IMAP, Samba, and HTTP.&#039;&#039;&lt;br /&gt;
: Make sure to test and ensure they are all working again!&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --runtime-to-permanent &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd NIC Interface ==&lt;br /&gt;
To start this lab we will need to configure a second network interface, named ens224 on our virtual machines. In our simulated setup our existing ens192 interface will be our WAN interface and ens224 will be our LAN interface which could be connected to a switch and then to multiple allow other computers which will connect to the Internet through our server.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open &#039;&#039;/etc/network/interfaces&#039;&#039; with your favorite text editor. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Go to the bottom of the file.&lt;br /&gt;
: [[File:Lab10_network_interfaces_before.png | link=https://wiki.ihitc.net/mediawiki/images/f/f8/Lab10_network_interfaces_before.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_before.png | Click for larger image]]&lt;br /&gt;
* Add the following to configure the second interface with a static IP of 192.168.1.1/24:&lt;br /&gt;
&amp;lt;pre&amp;gt;auto ens224&lt;br /&gt;
iface ens224 inet static&lt;br /&gt;
	address 192.168.1.1&lt;br /&gt;
	netmask 255.255.255.0&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: [[File:Lab10_network_interfaces_after.png | link=https://wiki.ihitc.net/mediawiki/images/8/80/Lab10_network_interfaces_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_after.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: As this is a LAN only interface, we do not need to define a gateway for the server VM, as the server VM itself will be the gateway for this network.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Once this is done, save the file &lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to enable the new interface.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ifup ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the second interface is up and running with the correct IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enable Routing ==&lt;br /&gt;
Now we will need to enable NAT so we can route LAN traffic to the Internet and responding Internet traffic back to our LAN interface.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your console, you will need to edit &#039;&#039;/etc/sysctl.conf&#039;&#039;. This file is used to change and tweak multiple system variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Scroll down until you find the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;# Uncomment the next line to enable packet forwarding for IPv4&lt;br /&gt;
#net.ipv4.ip_forward=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Follow the instructions in the file to enable packet forwarding in the kernel. &lt;br /&gt;
: [[File:Lab10_sysctl_after.png | link=https://wiki.ihitc.net/mediawiki/images/1/1e/Lab10_sysctl_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_sysctl_after.png | Click for larger image]]&lt;br /&gt;
* When you are done, save the file.&lt;br /&gt;
: Changes to the &#039;&#039;sysctl.conf&#039;&#039; file require a reboot, but most can be set without a reboot by echoing response codes to &amp;quot;files&amp;quot; in &#039;&#039;/proc&#039;&#039;. &lt;br /&gt;
&amp;lt;li&amp;gt; We will get into that more in a later chapter, but for now run the following command to enable ip_forwarding without rebooting the machine: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: If you are receiving an error when trying to run that command it&#039;s likely that the user you are running it as does not have permission to modify the &#039;&#039;&#039;/proc/sys/net/ipv4/ip_forward&#039;&#039;&#039; file (check the permissions by using &#039;&#039;&#039;ls&#039;&#039;&#039;). Read [http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission-to-wr this similar question] for more details and possible solutions.&#039;&#039;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a DHCP Server ==&lt;br /&gt;
To setup a DHCP server, we will first need to install the required software. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your SSH console use your favorite package manager to install the &#039;&#039;isc-dhcp-server&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
: After you install the package you may get a warning about &#039;&#039;isc-dhcp-server&#039;&#039; being unable to start. This is normal as we have yet to define the interface and settings we want used.&lt;br /&gt;
&amp;lt;li&amp;gt;Now back in Webmin, select the Refresh Modules option. .&amp;lt;/li&amp;gt;&lt;br /&gt;
* After it is done, go to Servers, then DHCP Server&lt;br /&gt;
: Before we define our DHCP range, we need to set our listening interface. &lt;br /&gt;
* Click on the &#039;&#039;Edit Network Interface&#039;&#039; option. &lt;br /&gt;
*Select &#039;&#039;ens224&#039;&#039;. &lt;br /&gt;
* Press save.&lt;br /&gt;
&amp;lt;li&amp;gt;Now under Subnets and Shared Networks, select Add a new subnet. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Subnet description: LAN DHCP Range&lt;br /&gt;
Network Address: 192.168.1.0&lt;br /&gt;
Netmask: 255.255.255.0&lt;br /&gt;
Address Ranges: 192.168.1.100-192.168.1.254&amp;lt;/pre&amp;gt;&lt;br /&gt;
: [[File:Lab10_webmin_dhcp_create_subnet.png | link=https://wiki.ihitc.net/mediawiki/images/4/4e/Lab10_webmin_dhcp_create_subnet.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_create_subnet.png | Click for larger image]]&lt;br /&gt;
* When you are done, press Create. &lt;br /&gt;
* Now, click on the network you just created to review the settings, then press Edit Client Options at the bottom.&lt;br /&gt;
: From here we will setup the default gateway and DNS servers for the clients to use. &lt;br /&gt;
&amp;lt;li&amp;gt; Under Default Routers, set the option to 192.168.1.1 &lt;br /&gt;
* Under DNS servers, set it to 192.168.1.1. &lt;br /&gt;
: [[File:Lab10_webmin_dhcp_client_options.png | link=https://wiki.ihitc.net/mediawiki/images/d/d7/Lab10_webmin_dhcp_client_options.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_client_options.png | Click for larger image]]&lt;br /&gt;
: Notice how we are setting these options to the IP of ens224 that we setup. This is because our Linux VM will act as the router and DNS for our clients as well.&lt;br /&gt;
* When you are done, press save&lt;br /&gt;
* Then on the Edit Subnet page, press save again.&lt;br /&gt;
&amp;lt;li&amp;gt;Now that you are back on the DHCP server page, press the Start Server button. &lt;br /&gt;
: If all goes well, the button should change to &amp;quot;Stop Server&amp;quot;. If this does not happen, then the server was unable start. If that happens, re-check your DHCP server configurations to make sure everything is correct.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling NAT and Firewall Rules for the LAN ==&lt;br /&gt;
Now we will use firewalld to setup NAT so that we can use private addresses on our internal LAN but still have access to the public Internet. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s set our ens224 interface (LAN) to be in the internal zone with the following command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=internal --add-interface=ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;You should now take a minute to allow all of the same services and ports on the internal network that you have allowed on the external network. &amp;lt;/li&amp;gt;&lt;br /&gt;
:In other words, make sure that Webmin, Samba, DNS, etc. are also allowed on the internal zone.&lt;br /&gt;
:In order to activate NAT you need to turn on the &amp;quot;masquerade&amp;quot; feature on your outside interface. This is probably already done if you correctly assigned your outside interface to the pre-defined external zone (it&#039;s one of the features of that zone). &lt;br /&gt;
: &#039;&#039;HINT: you can do this manually as well in case you setup a custom zone by running the &#039;&#039;&#039;firewall-cmd --add-masquerade --zone=external&#039;&#039;&#039; command.&#039;&#039;&lt;br /&gt;
: While routing and NAT should be working for hosts on your LAN interface now they probably still can&#039;t get an IP address! Just like all the other services being blocked by the firewall DHCP is also blocked unless you specifically allow it. &lt;br /&gt;
&amp;lt;li&amp;gt;To do this run the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-service=dhcp --zone=internal&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once you are satisfied your firewall is running correctly you can use this command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd VM as a LAN Host ==&lt;br /&gt;
Now we are going to setup a 2nd VM on the VMware server so we can have a client to connect to the LAN network segment we just created. For this though, we will be using Linux Mint instead of Debian so we have a graphical user interface to help us with testing.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; You&#039;ll need to make a Netlab reservation to work with your Mint system&#039;s GUI so go ahead and do that. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Enter the lab on Netlab&lt;br /&gt;
* Click the &amp;quot;Linux Desktop&amp;quot; tab to access your Mint machine.&lt;br /&gt;
: The VM should be booting from a Linux Mint virtual CD image. &lt;br /&gt;
&amp;lt;li&amp;gt; Get Linux Mint installed using the link on the desktop.&amp;lt;/li&amp;gt;&lt;br /&gt;
: Installation settings are not critical as we&#039;ll be using the system primarily to explore a Linux GUI and to test web browsing capability from our private network.&lt;br /&gt;
: [[File:Lab10_linux_mint_desktop.png | link=https://wiki.ihitc.net/mediawiki/images/f/f1/Lab10_linux_mint_desktop.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_desktop.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: By default Linux Mint will boot into a &amp;quot;Live CD&amp;quot; environment where you can use the system without installing. However, the Live CD environment is much slower and memory limited compared with a full installation to the hard drive so be sure to start an installation and reboot into the installed copy instead of from the Live CD. You will know you&#039;re working from an installed copy if you are prompted for your username and password when logging in and don&#039;t see a link on the desktop to Install Linux Mint anymore.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Once you have Linux Mint installed, reboot the machine and login. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Hopefully the machine is able to connect to the Internet through your Debian server which is acting as a DHCP server and router (see the topology diagram tab in Netlab to see a diagram of how they are connected).&lt;br /&gt;
&amp;lt;li&amp;gt; Press the Menu icon in the lower left corner, and enter &amp;quot;Terminal&amp;quot;. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Then, open the terminal application.&lt;br /&gt;
&amp;lt;li&amp;gt; You now have a shell on the system. From here, use the following command to check your network settings. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
: Notice how you have a IP from the DHCP pool we created earlier. &lt;br /&gt;
&amp;lt;li&amp;gt; Now try pinging &#039;&#039;172.17.50.1&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Are you able to ping? If so, NAT is working properly on your network because the 172.17.50.0/24 network is outside of the LAN segment this machine is attached to (192.168.1.0/24).&lt;br /&gt;
: &#039;&#039;NOTE: Notice how some Linux distributions like Mint haven&#039;t switched from the old naming of network interfaces with &#039;&#039;eth&#039;&#039; to the new &#039;&#039;ens&#039;&#039; style. You can also try using the older &#039;&#039;&#039;ifconfig&#039;&#039;&#039; way of checking the IP address and compare the output to the new &#039;&#039;&#039;ip address show&#039;&#039;&#039; method which we have been using so far in Debian.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Now run &#039;&#039;&#039;ping google.com&#039;&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: If you are able to ping, this shows that not only is NAT working, but DNS resolving as well.&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on the system (you can use a graphical browser this time since you have a GUI) and test browsing to a few websites.&amp;lt;/li&amp;gt;&lt;br /&gt;
: At this point we have a fully functional LAN environment.&lt;br /&gt;
&amp;lt;li&amp;gt; In order to allow automatic safe shutdown of your Linux Mint system and improve speed/efficiency use the package manager to install the &#039;&#039;open-vm-tools-desktop&#039;&#039; package. &amp;lt;/li&amp;gt;&lt;br /&gt;
:This provides better drivers and integration between the vmWare host which is running your Linux Mint virtual machine and the virtual machine itself.&lt;br /&gt;
&amp;lt;li&amp;gt; Finally, in the next section we&#039;ll be setting up SSH access to Mint through the Firewall so you&#039;ll want to install the &#039;&#039;openssh-server package&#039;&#039; through the package manager. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you&#039;ve done this you should be able to use the ssh program on the command line in Debian to access your Mint system like &#039;&#039;&#039;ssh mintusername@192.168.1.x&#039;&#039;&#039; where you are using a valid username on the Mint system and the IP address of the Mint system.&lt;br /&gt;
&amp;lt;li&amp;gt; Spend a few more minutes exploring the functionality of the Linux GUI and desktop.&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Port Forwarding and Firewalling ==&lt;br /&gt;
Now we are going to enable port forwarding to our VM. This will allow you to access the 2nd VM from the ITC network and VPN.&lt;br /&gt;
Because we are already using port 22 on our outside interface to provide SSH access to our main Debian system we need to use a different port to access the Mint system. Instead of changing the port number in the SSH server software on Mint we can have our firewall do it at the same time the NAT masquerading is occurring. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set up a rule by running the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-forward-port=port=2222:proto=tcp:toport=22:toaddr=192.168.1.100 --zone=external&amp;lt;/code&amp;gt;&lt;br /&gt;
:NOTE: this rule is a little unstable because it forwards the port to 192.168.1.100 which is currently the IP of our Mint system (if yours has a different IP you should change it in the command) but because that system gets an IP from DHCP it is subject to change which would break the rule. Therefore, if we wanted this to be stable in the long term, we would want to set up a static IP on any machines we were forwarding ports to.&lt;br /&gt;
:&#039;&#039;HINT: If your connection is refused, it may be because SSH is not installed in Mint.  Try installing SSH using the package manager or apt.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; From a computer on the ITC network, such as one connected to the VPN, try to SSH to port 2222 on the outside (172.17.50.xx) IP address of your Debian system. &amp;lt;/li&amp;gt;&lt;br /&gt;
:If everything was set up successfully, you should be able to sign into the Mint VM based on the port forwarding rule we have put in place.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
When you are done testing this section of the lab please power off your new Linux Mint VM as these require far more resources to run than the Debian VMs on our servers.&amp;lt;br&amp;gt;&lt;br /&gt;
: [[File:Lab10_linux_mint_shutdown.png | link=https://wiki.ihitc.net/mediawiki/images/1/1c/Lab10_linux_mint_shutdown.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_shutdown.png | Click for larger image]]&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
For this lab there are many things you need to check.&lt;br /&gt;
&lt;br /&gt;
#Firewall - attempt to connect using FTP on port 21, this should fail&lt;br /&gt;
#SSH - connect using FTP on port 22&lt;br /&gt;
#DNS - navigate to url of server&lt;br /&gt;
#SMTP - send a mail to auto-respond server&lt;br /&gt;
#IMAP - receive a mail from auto-respond server&lt;br /&gt;
#Samba - Create a file on server using file sharing&lt;br /&gt;
#HTTP - Navigate to ip address of server&lt;br /&gt;
#Webmin - Navigate to &amp;lt;your-ip&amp;gt;:10000&lt;br /&gt;
#PuTTY into linux mint using your ip address and port 2222&lt;br /&gt;
#Linux Mint DNS/NAT - ping google.com from within Linux Mint&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Run this script to automatically check your lab&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_10_test.py | sudo python3 &amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9544</id>
		<title>Lab 10 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9544"/>
		<updated>2021-03-02T01:36:21Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=dQw4w9WgXcQ Watch the video introduction]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This lab assumes you have successfully set up [[Lab_8_mnjk#Install_BIND_.26_Enable_Caching | DNS]] and [[Lab_9_mnjk#Install_the_Postfix_MTA |email]].  If you had any issues with those labs, you should resolve them before attempting this lab, since you will be unable to properly test the tasks in this lab if those are not fully functional.&lt;br /&gt;
&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Configuring a [https://firewalld.org/ Firewall]&lt;br /&gt;
*Enabling a 2nd interface&lt;br /&gt;
*Configuring [https://en.wikipedia.org/wiki/Network_address_translation NAT]&lt;br /&gt;
*Setting up [https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol DHCP]&lt;br /&gt;
*Installing [https://linuxmint.com/ Linux Mint] on a second VM&lt;br /&gt;
*Enabling [https://en.wikipedia.org/wiki/Port_forwarding Port Forwarding]&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
*&#039;&#039;&#039;[https://firewalld.org/documentation/man-pages/firewall-cmd.html firewall-cmd]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/echo echo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifconfig ifconfig]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software.&lt;br /&gt;
# Login with your standard user account.&lt;br /&gt;
# Have a browser window set to the webmin interface for your linux VM.&lt;br /&gt;
&lt;br /&gt;
== Configure a Firewall ==&lt;br /&gt;
&#039;&#039;NOTE: It is suggested that instead of managing a firewall directly  using nftables tools (which would also require us to create a script to reload our rules each time the system is restarted) we use a firewall daemon program to manage it based on a set of rules we create and automatically setup the firewall based on those rules each time the system boots. There are many command line firewall management programs out there but for this lab we will use the [https://firewalld.org/ firewalld] package suggested by Debian. &#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Begin by installing the &#039;&#039;firewalld&#039;&#039; package on your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s check to see if the firewall is now up and running using the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --state&amp;lt;/code&amp;gt;&lt;br /&gt;
: The firewall has been pre-configured with a couple of rules in it to prevent us from getting locked out. &lt;br /&gt;
: [[File:Lab10_firewalld_state.png | link=https://wiki.ihitc.net/mediawiki/images/1/11/Lab10_firewalld_state.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_state.png | Click for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Let&#039;s see what those rules are by using this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: [[File:Lab10_firewalld_initial_rules.png | link=https://wiki.ihitc.net/mediawiki/images/1/14/Lab10_firewalld_initial_rules.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_initial_rules.png | Click for larger image]]&lt;br /&gt;
: By default all interfaces are in the public zone (this is set in the &#039;&#039;/etc/firewalld/firewalld.conf&#039;&#039; file). &lt;br /&gt;
: Before we start working on rules for our firewall we should assign our outside interface to the external zone which is designed for NAT routing which we&#039;ll be setting up shortly. &lt;br /&gt;
&amp;lt;li&amp;gt; We can do this with the command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-interface=ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
: We can create custom zones or use pre-defined security zones which will speed up configuring the firewall. Learn more about the [https://firewalld.org/documentation/zone/predefined-zones.html pre-defined zones in firewalld documentation].&lt;br /&gt;
&amp;lt;li&amp;gt;Since we have changed zones on our interface let&#039;s check and see what rules we have started with. Let&#039;s see what those rules are:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: You can also use the &#039;&#039;&#039;firewall-cmd --list-all-zones&#039;&#039;&#039; command to see a list of all available zones and their rules.&amp;lt;/li&amp;gt;&#039;&#039;&lt;br /&gt;
: If you were watching carefully you may have noted that the dhcpv6-client service which was allowed in the public zone but is not allowed by default on the external zone. &lt;br /&gt;
&amp;lt;li&amp;gt;In our case we want to allow DHCPv6 to operate on our outside interface so we can re-enable it with the following command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --zone=external --add-service=&amp;quot;dhcpv6-client&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check to see what other services can be allowed on an interface with:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --get-services&amp;lt;/code&amp;gt;&lt;br /&gt;
: If you check you will see that although you can connect with ssh (by default it&#039;s on the allowed service list you saw above) you can&#039;t connect to your webserver or Webmin anymore. Webmin is not a pre-defined service in the list we saw above so we could either set it up as a new service and then allow it or we could create a manual rule to allow the TCP traffic on port 10000 needed to access Webmin. In this case because the service only uses a single port and to see how manual rules can be created let&#039;s manually create a rule to allow access to TCP port 10000. &lt;br /&gt;
&amp;lt;li&amp;gt;Do this by running this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-port=10000/tcp &amp;lt;/code&amp;gt;&lt;br /&gt;
:You should now be able to access Webmin again.&lt;br /&gt;
&amp;lt;li&amp;gt; Using either service rules or manual port rules create additional rules so that the other services on your VM are again accessible from the outside (such as from your home PC over the VPN). &amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;HINT: Services we have setup so far include SSH, DNS, SMTP, IMAP, Samba, and HTTP.&#039;&#039;&lt;br /&gt;
: Make sure to test and ensure they are all working again!&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --runtime-to-permanent &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd NIC Interface ==&lt;br /&gt;
To start this lab we will need to configure a second network interface, named ens224 on our virtual machines. In our simulated setup our existing ens192 interface will be our WAN interface and ens224 will be our LAN interface which could be connected to a switch and then to multiple allow other computers which will connect to the Internet through our server.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open &#039;&#039;/etc/network/interfaces&#039;&#039; with your favorite text editor. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Go to the bottom of the file.&lt;br /&gt;
: [[File:Lab10_network_interfaces_before.png | link=https://wiki.ihitc.net/mediawiki/images/f/f8/Lab10_network_interfaces_before.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_before.png | Click for larger image]]&lt;br /&gt;
* Add the following to configure the second interface with a static IP of 192.168.1.1/24:&lt;br /&gt;
&amp;lt;pre&amp;gt;auto ens224&lt;br /&gt;
iface ens224 inet static&lt;br /&gt;
	address 192.168.1.1&lt;br /&gt;
	netmask 255.255.255.0&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: [[File:Lab10_network_interfaces_after.png | link=https://wiki.ihitc.net/mediawiki/images/8/80/Lab10_network_interfaces_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_after.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: As this is a LAN only interface, we do not need to define a gateway for the server VM, as the server VM itself will be the gateway for this network.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Once this is done, save the file &lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to enable the new interface.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ifup ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the second interface is up and running with the correct IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enable Routing ==&lt;br /&gt;
Now we will need to enable NAT so we can route LAN traffic to the Internet and responding Internet traffic back to our LAN interface.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your console, you will need to edit &#039;&#039;/etc/sysctl.conf&#039;&#039;. This file is used to change and tweak multiple system variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Scroll down until you find the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;# Uncomment the next line to enable packet forwarding for IPv4&lt;br /&gt;
#net.ipv4.ip_forward=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Follow the instructions in the file to enable packet forwarding in the kernel. &lt;br /&gt;
: [[File:Lab10_sysctl_after.png | link=https://wiki.ihitc.net/mediawiki/images/1/1e/Lab10_sysctl_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_sysctl_after.png | Click for larger image]]&lt;br /&gt;
* When you are done, save the file.&lt;br /&gt;
: Changes to the &#039;&#039;sysctl.conf&#039;&#039; file require a reboot, but most can be set without a reboot by echoing response codes to &amp;quot;files&amp;quot; in &#039;&#039;/proc&#039;&#039;. &lt;br /&gt;
&amp;lt;li&amp;gt; We will get into that more in a later chapter, but for now run the following command to enable ip_forwarding without rebooting the machine: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: If you are receiving an error when trying to run that command it&#039;s likely that the user you are running it as does not have permission to modify the &#039;&#039;&#039;/proc/sys/net/ipv4/ip_forward&#039;&#039;&#039; file (check the permissions by using &#039;&#039;&#039;ls&#039;&#039;&#039;). Read [http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission-to-wr this similar question] for more details and possible solutions.&#039;&#039;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a DHCP Server ==&lt;br /&gt;
To setup a DHCP server, we will first need to install the required software. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your SSH console use your favorite package manager to install the &#039;&#039;isc-dhcp-server&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
: After you install the package you may get a warning about &#039;&#039;isc-dhcp-server&#039;&#039; being unable to start. This is normal as we have yet to define the interface and settings we want used.&lt;br /&gt;
&amp;lt;li&amp;gt;Now back in Webmin, select the Refresh Modules option. .&amp;lt;/li&amp;gt;&lt;br /&gt;
* After it is done, go to Servers, then DHCP Server&lt;br /&gt;
: Before we define our DHCP range, we need to set our listening interface. &lt;br /&gt;
* Click on the &#039;&#039;Edit Network Interface&#039;&#039; option. &lt;br /&gt;
*Select &#039;&#039;ens224&#039;&#039;. &lt;br /&gt;
* Press save.&lt;br /&gt;
&amp;lt;li&amp;gt;Now under Subnets and Shared Networks, select Add a new subnet. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Subnet description: LAN DHCP Range&lt;br /&gt;
Network Address: 192.168.1.0&lt;br /&gt;
Netmask: 255.255.255.0&lt;br /&gt;
Address Ranges: 192.168.1.100-192.168.1.254&amp;lt;/pre&amp;gt;&lt;br /&gt;
: [[File:Lab10_webmin_dhcp_create_subnet.png | link=https://wiki.ihitc.net/mediawiki/images/4/4e/Lab10_webmin_dhcp_create_subnet.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_create_subnet.png | Click for larger image]]&lt;br /&gt;
* When you are done, press Create. &lt;br /&gt;
* Now, click on the network you just created to review the settings, then press Edit Client Options at the bottom.&lt;br /&gt;
: From here we will setup the default gateway and DNS servers for the clients to use. &lt;br /&gt;
&amp;lt;li&amp;gt; Under Default Routers, set the option to 192.168.1.1 &lt;br /&gt;
* Under DNS servers, set it to 192.168.1.1. &lt;br /&gt;
: [[File:Lab10_webmin_dhcp_client_options.png | link=https://wiki.ihitc.net/mediawiki/images/d/d7/Lab10_webmin_dhcp_client_options.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_client_options.png | Click for larger image]]&lt;br /&gt;
: Notice how we are setting these options to the IP of ens224 that we setup. This is because our Linux VM will act as the router and DNS for our clients as well.&lt;br /&gt;
* When you are done, press save&lt;br /&gt;
* Then on the Edit Subnet page, press save again.&lt;br /&gt;
&amp;lt;li&amp;gt;Now that you are back on the DHCP server page, press the Start Server button. &lt;br /&gt;
: If all goes well, the button should change to &amp;quot;Stop Server&amp;quot;. If this does not happen, then the server was unable start. If that happens, re-check your DHCP server configurations to make sure everything is correct.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling NAT and Firewall Rules for the LAN ==&lt;br /&gt;
Now we will use firewalld to setup NAT so that we can use private addresses on our internal LAN but still have access to the public Internet. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s set our ens224 interface (LAN) to be in the internal zone with the following command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=internal --add-interface=ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;You should now take a minute to allow all of the same services and ports on the internal network that you have allowed on the external network. &amp;lt;/li&amp;gt;&lt;br /&gt;
:In other words, make sure that Webmin, Samba, DNS, etc. are also allowed on the internal zone.&lt;br /&gt;
:In order to activate NAT you need to turn on the &amp;quot;masquerade&amp;quot; feature on your outside interface. This is probably already done if you correctly assigned your outside interface to the pre-defined external zone (it&#039;s one of the features of that zone). &lt;br /&gt;
: &#039;&#039;HINT: you can do this manually as well in case you setup a custom zone by running the &#039;&#039;&#039;firewall-cmd --add-masquerade --zone=external&#039;&#039;&#039; command.&#039;&#039;&lt;br /&gt;
: While routing and NAT should be working for hosts on your LAN interface now they probably still can&#039;t get an IP address! Just like all the other services being blocked by the firewall DHCP is also blocked unless you specifically allow it. &lt;br /&gt;
&amp;lt;li&amp;gt;To do this run the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-service=dhcp --zone=internal&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once you are satisfied your firewall is running correctly you can use this command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd VM as a LAN Host ==&lt;br /&gt;
Now we are going to setup a 2nd VM on the VMware server so we can have a client to connect to the LAN network segment we just created. For this though, we will be using Linux Mint instead of Debian so we have a graphical user interface to help us with testing.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; You&#039;ll need to make a Netlab reservation to work with your Mint system&#039;s GUI so go ahead and do that. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Enter the lab on Netlab&lt;br /&gt;
* Click the &amp;quot;Linux Desktop&amp;quot; tab to access your Mint machine.&lt;br /&gt;
: The VM should be booting from a Linux Mint virtual CD image. &lt;br /&gt;
&amp;lt;li&amp;gt; Get Linux Mint installed using the link on the desktop.&amp;lt;/li&amp;gt;&lt;br /&gt;
: Installation settings are not critical as we&#039;ll be using the system primarily to explore a Linux GUI and to test web browsing capability from our private network.&lt;br /&gt;
: [[File:Lab10_linux_mint_desktop.png | link=https://wiki.ihitc.net/mediawiki/images/f/f1/Lab10_linux_mint_desktop.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_desktop.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: By default Linux Mint will boot into a &amp;quot;Live CD&amp;quot; environment where you can use the system without installing. However, the Live CD environment is much slower and memory limited compared with a full installation to the hard drive so be sure to start an installation and reboot into the installed copy instead of from the Live CD. You will know you&#039;re working from an installed copy if you are prompted for your username and password when logging in and don&#039;t see a link on the desktop to Install Linux Mint anymore.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Once you have Linux Mint installed, reboot the machine and login. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Hopefully the machine is able to connect to the Internet through your Debian server which is acting as a DHCP server and router (see the topology diagram tab in Netlab to see a diagram of how they are connected).&lt;br /&gt;
&amp;lt;li&amp;gt; Press the Menu icon in the lower left corner, and enter &amp;quot;Terminal&amp;quot;. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Then, open the terminal application.&lt;br /&gt;
&amp;lt;li&amp;gt; You now have a shell on the system. From here, use the following command to check your network settings. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
: Notice how you have a IP from the DHCP pool we created earlier. &lt;br /&gt;
&amp;lt;li&amp;gt; Now try pinging &#039;&#039;172.17.50.1&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Are you able to ping? If so, NAT is working properly on your network because the 172.17.50.0/24 network is outside of the LAN segment this machine is attached to (192.168.1.0/24).&lt;br /&gt;
: &#039;&#039;NOTE: Notice how some Linux distributions like Mint haven&#039;t switched from the old naming of network interfaces with &#039;&#039;eth&#039;&#039; to the new &#039;&#039;ens&#039;&#039; style. You can also try using the older &#039;&#039;&#039;ifconfig&#039;&#039;&#039; way of checking the IP address and compare the output to the new &#039;&#039;&#039;ip address show&#039;&#039;&#039; method which we have been using so far in Debian.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Now run &#039;&#039;&#039;ping google.com&#039;&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: If you are able to ping, this shows that not only is NAT working, but DNS resolving as well.&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on the system (you can use a graphical browser this time since you have a GUI) and test browsing to a few websites.&amp;lt;/li&amp;gt;&lt;br /&gt;
: At this point we have a fully functional LAN environment.&lt;br /&gt;
&amp;lt;li&amp;gt; In order to allow automatic safe shutdown of your Linux Mint system and improve speed/efficiency use the package manager to install the &#039;&#039;open-vm-tools-desktop&#039;&#039; package. &amp;lt;/li&amp;gt;&lt;br /&gt;
:This provides better drivers and integration between the vmWare host which is running your Linux Mint virtual machine and the virtual machine itself.&lt;br /&gt;
&amp;lt;li&amp;gt; Finally, in the next section we&#039;ll be setting up SSH access to Mint through the Firewall so you&#039;ll want to install the &#039;&#039;openssh-server package&#039;&#039; through the package manager. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you&#039;ve done this you should be able to use the ssh program on the command line in Debian to access your Mint system like &#039;&#039;&#039;ssh mintusername@192.168.1.x&#039;&#039;&#039; where you are using a valid username on the Mint system and the IP address of the Mint system.&lt;br /&gt;
&amp;lt;li&amp;gt; Spend a few more minutes exploring the functionality of the Linux GUI and desktop.&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Port Forwarding and Firewalling ==&lt;br /&gt;
Now we are going to enable port forwarding to our VM. This will allow you to access the 2nd VM from the ITC network and VPN.&lt;br /&gt;
Because we are already using port 22 on our outside interface to provide SSH access to our main Debian system we need to use a different port to access the Mint system. Instead of changing the port number in the SSH server software on Mint we can have our firewall do it at the same time the NAT masquerading is occurring. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set up a rule by running the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-forward-port=port=2222:proto=tcp:toport=22:toaddr=192.168.1.100 --zone=external&amp;lt;/code&amp;gt;&lt;br /&gt;
:NOTE: this rule is a little unstable because it forwards the port to 192.168.1.100 which is currently the IP of our Mint system (if yours has a different IP you should change it in the command) but because that system gets an IP from DHCP it is subject to change which would break the rule. Therefore, if we wanted this to be stable in the long term, we would want to set up a static IP on any machines we were forwarding ports to.&lt;br /&gt;
:&#039;&#039;HINT: If your connection is refused, it may be because SSH is not installed in Mint.  Try installing SSH using the package manager or apt.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; From a computer on the ITC network, such as one connected to the VPN, try to SSH to port 2222 on the outside (172.17.50.xx) IP address of your Debian system. &amp;lt;/li&amp;gt;&lt;br /&gt;
:If everything was set up successfully, you should be able to sign into the Mint VM based on the port forwarding rule we have put in place.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
When you are done testing this section of the lab please power off your new Linux Mint VM as these require far more resources to run than the Debian VMs on our servers.&amp;lt;br&amp;gt;&lt;br /&gt;
: [[File:Lab10_linux_mint_shutdown.png | link=https://wiki.ihitc.net/mediawiki/images/1/1c/Lab10_linux_mint_shutdown.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_shutdown.png | Click for larger image]]&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
For this lab there are many things you need to check.&lt;br /&gt;
&lt;br /&gt;
#Firewall - attempt to connect using FTP on port 21, this should fail&lt;br /&gt;
#SSH - connect using FTP on port 22&lt;br /&gt;
#DNS - navigate to url of server&lt;br /&gt;
#SMTP - send a mail to auto-respond server&lt;br /&gt;
#IMAP - receive a mail from auto-respond server&lt;br /&gt;
#Samba - Create a file on server using file sharing&lt;br /&gt;
#HTTP - Navigate to ip address of server&lt;br /&gt;
#Webmin - Navigate to &amp;lt;your-ip&amp;gt;:10000&lt;br /&gt;
#PuTTY into linux mint using your ip address and port 2222&lt;br /&gt;
#Linux Mint DNS/NAT - ping google.com from within Linux Mint&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Run this script to automatically check your lab&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; curl https&amp;lt;nolink&amp;gt;://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_10_test.py | sudo python3 &amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9543</id>
		<title>Lab 10 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9543"/>
		<updated>2021-03-02T01:35:29Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=dQw4w9WgXcQ Watch the video introduction]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This lab assumes you have successfully set up [[Lab_8_mnjk#Install_BIND_.26_Enable_Caching | DNS]] and [[Lab_9_mnjk#Install_the_Postfix_MTA |email]].  If you had any issues with those labs, you should resolve them before attempting this lab, since you will be unable to properly test the tasks in this lab if those are not fully functional.&lt;br /&gt;
&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Configuring a [https://firewalld.org/ Firewall]&lt;br /&gt;
*Enabling a 2nd interface&lt;br /&gt;
*Configuring [https://en.wikipedia.org/wiki/Network_address_translation NAT]&lt;br /&gt;
*Setting up [https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol DHCP]&lt;br /&gt;
*Installing [https://linuxmint.com/ Linux Mint] on a second VM&lt;br /&gt;
*Enabling [https://en.wikipedia.org/wiki/Port_forwarding Port Forwarding]&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
*&#039;&#039;&#039;[https://firewalld.org/documentation/man-pages/firewall-cmd.html firewall-cmd]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/echo echo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifconfig ifconfig]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software.&lt;br /&gt;
# Login with your standard user account.&lt;br /&gt;
# Have a browser window set to the webmin interface for your linux VM.&lt;br /&gt;
&lt;br /&gt;
== Configure a Firewall ==&lt;br /&gt;
&#039;&#039;NOTE: It is suggested that instead of managing a firewall directly  using nftables tools (which would also require us to create a script to reload our rules each time the system is restarted) we use a firewall daemon program to manage it based on a set of rules we create and automatically setup the firewall based on those rules each time the system boots. There are many command line firewall management programs out there but for this lab we will use the [https://firewalld.org/ firewalld] package suggested by Debian. &#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Begin by installing the &#039;&#039;firewalld&#039;&#039; package on your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s check to see if the firewall is now up and running using the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --state&amp;lt;/code&amp;gt;&lt;br /&gt;
: The firewall has been pre-configured with a couple of rules in it to prevent us from getting locked out. &lt;br /&gt;
: [[File:Lab10_firewalld_state.png | link=https://wiki.ihitc.net/mediawiki/images/1/11/Lab10_firewalld_state.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_state.png | Click for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Let&#039;s see what those rules are by using this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: [[File:Lab10_firewalld_initial_rules.png | link=https://wiki.ihitc.net/mediawiki/images/1/14/Lab10_firewalld_initial_rules.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_initial_rules.png | Click for larger image]]&lt;br /&gt;
: By default all interfaces are in the public zone (this is set in the &#039;&#039;/etc/firewalld/firewalld.conf&#039;&#039; file). &lt;br /&gt;
: Before we start working on rules for our firewall we should assign our outside interface to the external zone which is designed for NAT routing which we&#039;ll be setting up shortly. &lt;br /&gt;
&amp;lt;li&amp;gt; We can do this with the command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-interface=ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
: We can create custom zones or use pre-defined security zones which will speed up configuring the firewall. Learn more about the [https://firewalld.org/documentation/zone/predefined-zones.html pre-defined zones in firewalld documentation].&lt;br /&gt;
&amp;lt;li&amp;gt;Since we have changed zones on our interface let&#039;s check and see what rules we have started with. Let&#039;s see what those rules are:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: You can also use the &#039;&#039;&#039;firewall-cmd --list-all-zones&#039;&#039;&#039; command to see a list of all available zones and their rules.&amp;lt;/li&amp;gt;&#039;&#039;&lt;br /&gt;
: If you were watching carefully you may have noted that the dhcpv6-client service which was allowed in the public zone but is not allowed by default on the external zone. &lt;br /&gt;
&amp;lt;li&amp;gt;In our case we want to allow DHCPv6 to operate on our outside interface so we can re-enable it with the following command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --zone=external --add-service=&amp;quot;dhcpv6-client&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check to see what other services can be allowed on an interface with:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --get-services&amp;lt;/code&amp;gt;&lt;br /&gt;
: If you check you will see that although you can connect with ssh (by default it&#039;s on the allowed service list you saw above) you can&#039;t connect to your webserver or Webmin anymore. Webmin is not a pre-defined service in the list we saw above so we could either set it up as a new service and then allow it or we could create a manual rule to allow the TCP traffic on port 10000 needed to access Webmin. In this case because the service only uses a single port and to see how manual rules can be created let&#039;s manually create a rule to allow access to TCP port 10000. &lt;br /&gt;
&amp;lt;li&amp;gt;Do this by running this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-port=10000/tcp &amp;lt;/code&amp;gt;&lt;br /&gt;
:You should now be able to access Webmin again.&lt;br /&gt;
&amp;lt;li&amp;gt; Using either service rules or manual port rules create additional rules so that the other services on your VM are again accessible from the outside (such as from your home PC over the VPN). &amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;HINT: Services we have setup so far include SSH, DNS, SMTP, IMAP, Samba, and HTTP.&#039;&#039;&lt;br /&gt;
: Make sure to test and ensure they are all working again!&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --runtime-to-permanent &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd NIC Interface ==&lt;br /&gt;
To start this lab we will need to configure a second network interface, named ens224 on our virtual machines. In our simulated setup our existing ens192 interface will be our WAN interface and ens224 will be our LAN interface which could be connected to a switch and then to multiple allow other computers which will connect to the Internet through our server.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open &#039;&#039;/etc/network/interfaces&#039;&#039; with your favorite text editor. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Go to the bottom of the file.&lt;br /&gt;
: [[File:Lab10_network_interfaces_before.png | link=https://wiki.ihitc.net/mediawiki/images/f/f8/Lab10_network_interfaces_before.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_before.png | Click for larger image]]&lt;br /&gt;
* Add the following to configure the second interface with a static IP of 192.168.1.1/24:&lt;br /&gt;
&amp;lt;pre&amp;gt;auto ens224&lt;br /&gt;
iface ens224 inet static&lt;br /&gt;
	address 192.168.1.1&lt;br /&gt;
	netmask 255.255.255.0&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: [[File:Lab10_network_interfaces_after.png | link=https://wiki.ihitc.net/mediawiki/images/8/80/Lab10_network_interfaces_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_after.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: As this is a LAN only interface, we do not need to define a gateway for the server VM, as the server VM itself will be the gateway for this network.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Once this is done, save the file &lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to enable the new interface.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ifup ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the second interface is up and running with the correct IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enable Routing ==&lt;br /&gt;
Now we will need to enable NAT so we can route LAN traffic to the Internet and responding Internet traffic back to our LAN interface.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your console, you will need to edit &#039;&#039;/etc/sysctl.conf&#039;&#039;. This file is used to change and tweak multiple system variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Scroll down until you find the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;# Uncomment the next line to enable packet forwarding for IPv4&lt;br /&gt;
#net.ipv4.ip_forward=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Follow the instructions in the file to enable packet forwarding in the kernel. &lt;br /&gt;
: [[File:Lab10_sysctl_after.png | link=https://wiki.ihitc.net/mediawiki/images/1/1e/Lab10_sysctl_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_sysctl_after.png | Click for larger image]]&lt;br /&gt;
* When you are done, save the file.&lt;br /&gt;
: Changes to the &#039;&#039;sysctl.conf&#039;&#039; file require a reboot, but most can be set without a reboot by echoing response codes to &amp;quot;files&amp;quot; in &#039;&#039;/proc&#039;&#039;. &lt;br /&gt;
&amp;lt;li&amp;gt; We will get into that more in a later chapter, but for now run the following command to enable ip_forwarding without rebooting the machine: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: If you are receiving an error when trying to run that command it&#039;s likely that the user you are running it as does not have permission to modify the &#039;&#039;&#039;/proc/sys/net/ipv4/ip_forward&#039;&#039;&#039; file (check the permissions by using &#039;&#039;&#039;ls&#039;&#039;&#039;). Read [http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission-to-wr this similar question] for more details and possible solutions.&#039;&#039;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a DHCP Server ==&lt;br /&gt;
To setup a DHCP server, we will first need to install the required software. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your SSH console use your favorite package manager to install the &#039;&#039;isc-dhcp-server&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
: After you install the package you may get a warning about &#039;&#039;isc-dhcp-server&#039;&#039; being unable to start. This is normal as we have yet to define the interface and settings we want used.&lt;br /&gt;
&amp;lt;li&amp;gt;Now back in Webmin, select the Refresh Modules option. .&amp;lt;/li&amp;gt;&lt;br /&gt;
* After it is done, go to Servers, then DHCP Server&lt;br /&gt;
: Before we define our DHCP range, we need to set our listening interface. &lt;br /&gt;
* Click on the &#039;&#039;Edit Network Interface&#039;&#039; option. &lt;br /&gt;
*Select &#039;&#039;ens224&#039;&#039;. &lt;br /&gt;
* Press save.&lt;br /&gt;
&amp;lt;li&amp;gt;Now under Subnets and Shared Networks, select Add a new subnet. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Subnet description: LAN DHCP Range&lt;br /&gt;
Network Address: 192.168.1.0&lt;br /&gt;
Netmask: 255.255.255.0&lt;br /&gt;
Address Ranges: 192.168.1.100-192.168.1.254&amp;lt;/pre&amp;gt;&lt;br /&gt;
: [[File:Lab10_webmin_dhcp_create_subnet.png | link=https://wiki.ihitc.net/mediawiki/images/4/4e/Lab10_webmin_dhcp_create_subnet.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_create_subnet.png | Click for larger image]]&lt;br /&gt;
* When you are done, press Create. &lt;br /&gt;
* Now, click on the network you just created to review the settings, then press Edit Client Options at the bottom.&lt;br /&gt;
: From here we will setup the default gateway and DNS servers for the clients to use. &lt;br /&gt;
&amp;lt;li&amp;gt; Under Default Routers, set the option to 192.168.1.1 &lt;br /&gt;
* Under DNS servers, set it to 192.168.1.1. &lt;br /&gt;
: [[File:Lab10_webmin_dhcp_client_options.png | link=https://wiki.ihitc.net/mediawiki/images/d/d7/Lab10_webmin_dhcp_client_options.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_client_options.png | Click for larger image]]&lt;br /&gt;
: Notice how we are setting these options to the IP of ens224 that we setup. This is because our Linux VM will act as the router and DNS for our clients as well.&lt;br /&gt;
* When you are done, press save&lt;br /&gt;
* Then on the Edit Subnet page, press save again.&lt;br /&gt;
&amp;lt;li&amp;gt;Now that you are back on the DHCP server page, press the Start Server button. &lt;br /&gt;
: If all goes well, the button should change to &amp;quot;Stop Server&amp;quot;. If this does not happen, then the server was unable start. If that happens, re-check your DHCP server configurations to make sure everything is correct.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling NAT and Firewall Rules for the LAN ==&lt;br /&gt;
Now we will use firewalld to setup NAT so that we can use private addresses on our internal LAN but still have access to the public Internet. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s set our ens224 interface (LAN) to be in the internal zone with the following command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=internal --add-interface=ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;You should now take a minute to allow all of the same services and ports on the internal network that you have allowed on the external network. &amp;lt;/li&amp;gt;&lt;br /&gt;
:In other words, make sure that Webmin, Samba, DNS, etc. are also allowed on the internal zone.&lt;br /&gt;
:In order to activate NAT you need to turn on the &amp;quot;masquerade&amp;quot; feature on your outside interface. This is probably already done if you correctly assigned your outside interface to the pre-defined external zone (it&#039;s one of the features of that zone). &lt;br /&gt;
: &#039;&#039;HINT: you can do this manually as well in case you setup a custom zone by running the &#039;&#039;&#039;firewall-cmd --add-masquerade --zone=external&#039;&#039;&#039; command.&#039;&#039;&lt;br /&gt;
: While routing and NAT should be working for hosts on your LAN interface now they probably still can&#039;t get an IP address! Just like all the other services being blocked by the firewall DHCP is also blocked unless you specifically allow it. &lt;br /&gt;
&amp;lt;li&amp;gt;To do this run the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-service=dhcp --zone=internal&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once you are satisfied your firewall is running correctly you can use this command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd VM as a LAN Host ==&lt;br /&gt;
Now we are going to setup a 2nd VM on the VMware server so we can have a client to connect to the LAN network segment we just created. For this though, we will be using Linux Mint instead of Debian so we have a graphical user interface to help us with testing.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; You&#039;ll need to make a Netlab reservation to work with your Mint system&#039;s GUI so go ahead and do that. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Enter the lab on Netlab&lt;br /&gt;
* Click the &amp;quot;Linux Desktop&amp;quot; tab to access your Mint machine.&lt;br /&gt;
: The VM should be booting from a Linux Mint virtual CD image. &lt;br /&gt;
&amp;lt;li&amp;gt; Get Linux Mint installed using the link on the desktop.&amp;lt;/li&amp;gt;&lt;br /&gt;
: Installation settings are not critical as we&#039;ll be using the system primarily to explore a Linux GUI and to test web browsing capability from our private network.&lt;br /&gt;
: [[File:Lab10_linux_mint_desktop.png | link=https://wiki.ihitc.net/mediawiki/images/f/f1/Lab10_linux_mint_desktop.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_desktop.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: By default Linux Mint will boot into a &amp;quot;Live CD&amp;quot; environment where you can use the system without installing. However, the Live CD environment is much slower and memory limited compared with a full installation to the hard drive so be sure to start an installation and reboot into the installed copy instead of from the Live CD. You will know you&#039;re working from an installed copy if you are prompted for your username and password when logging in and don&#039;t see a link on the desktop to Install Linux Mint anymore.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Once you have Linux Mint installed, reboot the machine and login. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Hopefully the machine is able to connect to the Internet through your Debian server which is acting as a DHCP server and router (see the topology diagram tab in Netlab to see a diagram of how they are connected).&lt;br /&gt;
&amp;lt;li&amp;gt; Press the Menu icon in the lower left corner, and enter &amp;quot;Terminal&amp;quot;. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Then, open the terminal application.&lt;br /&gt;
&amp;lt;li&amp;gt; You now have a shell on the system. From here, use the following command to check your network settings. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
: Notice how you have a IP from the DHCP pool we created earlier. &lt;br /&gt;
&amp;lt;li&amp;gt; Now try pinging &#039;&#039;172.17.50.1&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Are you able to ping? If so, NAT is working properly on your network because the 172.17.50.0/24 network is outside of the LAN segment this machine is attached to (192.168.1.0/24).&lt;br /&gt;
: &#039;&#039;NOTE: Notice how some Linux distributions like Mint haven&#039;t switched from the old naming of network interfaces with &#039;&#039;eth&#039;&#039; to the new &#039;&#039;ens&#039;&#039; style. You can also try using the older &#039;&#039;&#039;ifconfig&#039;&#039;&#039; way of checking the IP address and compare the output to the new &#039;&#039;&#039;ip address show&#039;&#039;&#039; method which we have been using so far in Debian.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Now run &#039;&#039;&#039;ping google.com&#039;&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: If you are able to ping, this shows that not only is NAT working, but DNS resolving as well.&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on the system (you can use a graphical browser this time since you have a GUI) and test browsing to a few websites.&amp;lt;/li&amp;gt;&lt;br /&gt;
: At this point we have a fully functional LAN environment.&lt;br /&gt;
&amp;lt;li&amp;gt; In order to allow automatic safe shutdown of your Linux Mint system and improve speed/efficiency use the package manager to install the &#039;&#039;open-vm-tools-desktop&#039;&#039; package. &amp;lt;/li&amp;gt;&lt;br /&gt;
:This provides better drivers and integration between the vmWare host which is running your Linux Mint virtual machine and the virtual machine itself.&lt;br /&gt;
&amp;lt;li&amp;gt; Finally, in the next section we&#039;ll be setting up SSH access to Mint through the Firewall so you&#039;ll want to install the &#039;&#039;openssh-server package&#039;&#039; through the package manager. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you&#039;ve done this you should be able to use the ssh program on the command line in Debian to access your Mint system like &#039;&#039;&#039;ssh mintusername@192.168.1.x&#039;&#039;&#039; where you are using a valid username on the Mint system and the IP address of the Mint system.&lt;br /&gt;
&amp;lt;li&amp;gt; Spend a few more minutes exploring the functionality of the Linux GUI and desktop.&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Port Forwarding and Firewalling ==&lt;br /&gt;
Now we are going to enable port forwarding to our VM. This will allow you to access the 2nd VM from the ITC network and VPN.&lt;br /&gt;
Because we are already using port 22 on our outside interface to provide SSH access to our main Debian system we need to use a different port to access the Mint system. Instead of changing the port number in the SSH server software on Mint we can have our firewall do it at the same time the NAT masquerading is occurring. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set up a rule by running the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-forward-port=port=2222:proto=tcp:toport=22:toaddr=192.168.1.100 --zone=external&amp;lt;/code&amp;gt;&lt;br /&gt;
:NOTE: this rule is a little unstable because it forwards the port to 192.168.1.100 which is currently the IP of our Mint system (if yours has a different IP you should change it in the command) but because that system gets an IP from DHCP it is subject to change which would break the rule. Therefore, if we wanted this to be stable in the long term, we would want to set up a static IP on any machines we were forwarding ports to.&lt;br /&gt;
:&#039;&#039;HINT: If your connection is refused, it may be because SSH is not installed in Mint.  Try installing SSH using the package manager or apt.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; From a computer on the ITC network, such as one connected to the VPN, try to SSH to port 2222 on the outside (172.17.50.xx) IP address of your Debian system. &amp;lt;/li&amp;gt;&lt;br /&gt;
:If everything was set up successfully, you should be able to sign into the Mint VM based on the port forwarding rule we have put in place.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
When you are done testing this section of the lab please power off your new Linux Mint VM as these require far more resources to run than the Debian VMs on our servers.&amp;lt;br&amp;gt;&lt;br /&gt;
: [[File:Lab10_linux_mint_shutdown.png | link=https://wiki.ihitc.net/mediawiki/images/1/1c/Lab10_linux_mint_shutdown.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_shutdown.png | Click for larger image]]&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
For this lab there are many things you need to check.&lt;br /&gt;
&lt;br /&gt;
#Firewall - attempt to connect using FTP on port 21, this should fail&lt;br /&gt;
#SSH - connect using FTP on port 22&lt;br /&gt;
#DNS - navigate to url of server&lt;br /&gt;
#SMTP - send a mail to auto-respond server&lt;br /&gt;
#IMAP - receive a mail from auto-respond server&lt;br /&gt;
#Samba - Create a file on server using file sharing&lt;br /&gt;
#HTTP - Navigate to ip address of server&lt;br /&gt;
#Webmin - Navigate to &amp;lt;your-ip&amp;gt;:10000&lt;br /&gt;
#PuTTY into linux mint using your ip address and port 2222&lt;br /&gt;
#Linux Mint DNS/NAT - ping google.com from within Linux Mint&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Run this script to automatically check your lab&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_10_test.py | sudo python3 &amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9542</id>
		<title>Lab 10 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9542"/>
		<updated>2021-03-02T01:35:04Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=dQw4w9WgXcQ Watch the video introduction]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This lab assumes you have successfully set up [[Lab_8_mnjk#Install_BIND_.26_Enable_Caching | DNS]] and [[Lab_9_mnjk#Install_the_Postfix_MTA |email]].  If you had any issues with those labs, you should resolve them before attempting this lab, since you will be unable to properly test the tasks in this lab if those are not fully functional.&lt;br /&gt;
&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Configuring a [https://firewalld.org/ Firewall]&lt;br /&gt;
*Enabling a 2nd interface&lt;br /&gt;
*Configuring [https://en.wikipedia.org/wiki/Network_address_translation NAT]&lt;br /&gt;
*Setting up [https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol DHCP]&lt;br /&gt;
*Installing [https://linuxmint.com/ Linux Mint] on a second VM&lt;br /&gt;
*Enabling [https://en.wikipedia.org/wiki/Port_forwarding Port Forwarding]&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
*&#039;&#039;&#039;[https://firewalld.org/documentation/man-pages/firewall-cmd.html firewall-cmd]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/echo echo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifconfig ifconfig]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software.&lt;br /&gt;
# Login with your standard user account.&lt;br /&gt;
# Have a browser window set to the webmin interface for your linux VM.&lt;br /&gt;
&lt;br /&gt;
== Configure a Firewall ==&lt;br /&gt;
&#039;&#039;NOTE: It is suggested that instead of managing a firewall directly  using nftables tools (which would also require us to create a script to reload our rules each time the system is restarted) we use a firewall daemon program to manage it based on a set of rules we create and automatically setup the firewall based on those rules each time the system boots. There are many command line firewall management programs out there but for this lab we will use the [https://firewalld.org/ firewalld] package suggested by Debian. &#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Begin by installing the &#039;&#039;firewalld&#039;&#039; package on your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s check to see if the firewall is now up and running using the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --state&amp;lt;/code&amp;gt;&lt;br /&gt;
: The firewall has been pre-configured with a couple of rules in it to prevent us from getting locked out. &lt;br /&gt;
: [[File:Lab10_firewalld_state.png | link=https://wiki.ihitc.net/mediawiki/images/1/11/Lab10_firewalld_state.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_state.png | Click for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Let&#039;s see what those rules are by using this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: [[File:Lab10_firewalld_initial_rules.png | link=https://wiki.ihitc.net/mediawiki/images/1/14/Lab10_firewalld_initial_rules.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_initial_rules.png | Click for larger image]]&lt;br /&gt;
: By default all interfaces are in the public zone (this is set in the &#039;&#039;/etc/firewalld/firewalld.conf&#039;&#039; file). &lt;br /&gt;
: Before we start working on rules for our firewall we should assign our outside interface to the external zone which is designed for NAT routing which we&#039;ll be setting up shortly. &lt;br /&gt;
&amp;lt;li&amp;gt; We can do this with the command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-interface=ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
: We can create custom zones or use pre-defined security zones which will speed up configuring the firewall. Learn more about the [https://firewalld.org/documentation/zone/predefined-zones.html pre-defined zones in firewalld documentation].&lt;br /&gt;
&amp;lt;li&amp;gt;Since we have changed zones on our interface let&#039;s check and see what rules we have started with. Let&#039;s see what those rules are:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: You can also use the &#039;&#039;&#039;firewall-cmd --list-all-zones&#039;&#039;&#039; command to see a list of all available zones and their rules.&amp;lt;/li&amp;gt;&#039;&#039;&lt;br /&gt;
: If you were watching carefully you may have noted that the dhcpv6-client service which was allowed in the public zone but is not allowed by default on the external zone. &lt;br /&gt;
&amp;lt;li&amp;gt;In our case we want to allow DHCPv6 to operate on our outside interface so we can re-enable it with the following command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --zone=external --add-service=&amp;quot;dhcpv6-client&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check to see what other services can be allowed on an interface with:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --get-services&amp;lt;/code&amp;gt;&lt;br /&gt;
: If you check you will see that although you can connect with ssh (by default it&#039;s on the allowed service list you saw above) you can&#039;t connect to your webserver or Webmin anymore. Webmin is not a pre-defined service in the list we saw above so we could either set it up as a new service and then allow it or we could create a manual rule to allow the TCP traffic on port 10000 needed to access Webmin. In this case because the service only uses a single port and to see how manual rules can be created let&#039;s manually create a rule to allow access to TCP port 10000. &lt;br /&gt;
&amp;lt;li&amp;gt;Do this by running this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-port=10000/tcp &amp;lt;/code&amp;gt;&lt;br /&gt;
:You should now be able to access Webmin again.&lt;br /&gt;
&amp;lt;li&amp;gt; Using either service rules or manual port rules create additional rules so that the other services on your VM are again accessible from the outside (such as from your home PC over the VPN). &amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;HINT: Services we have setup so far include SSH, DNS, SMTP, IMAP, Samba, and HTTP.&#039;&#039;&lt;br /&gt;
: Make sure to test and ensure they are all working again!&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --runtime-to-permanent &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd NIC Interface ==&lt;br /&gt;
To start this lab we will need to configure a second network interface, named ens224 on our virtual machines. In our simulated setup our existing ens192 interface will be our WAN interface and ens224 will be our LAN interface which could be connected to a switch and then to multiple allow other computers which will connect to the Internet through our server.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open &#039;&#039;/etc/network/interfaces&#039;&#039; with your favorite text editor. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Go to the bottom of the file.&lt;br /&gt;
: [[File:Lab10_network_interfaces_before.png | link=https://wiki.ihitc.net/mediawiki/images/f/f8/Lab10_network_interfaces_before.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_before.png | Click for larger image]]&lt;br /&gt;
* Add the following to configure the second interface with a static IP of 192.168.1.1/24:&lt;br /&gt;
&amp;lt;pre&amp;gt;auto ens224&lt;br /&gt;
iface ens224 inet static&lt;br /&gt;
	address 192.168.1.1&lt;br /&gt;
	netmask 255.255.255.0&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: [[File:Lab10_network_interfaces_after.png | link=https://wiki.ihitc.net/mediawiki/images/8/80/Lab10_network_interfaces_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_after.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: As this is a LAN only interface, we do not need to define a gateway for the server VM, as the server VM itself will be the gateway for this network.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Once this is done, save the file &lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to enable the new interface.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ifup ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the second interface is up and running with the correct IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enable Routing ==&lt;br /&gt;
Now we will need to enable NAT so we can route LAN traffic to the Internet and responding Internet traffic back to our LAN interface.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your console, you will need to edit &#039;&#039;/etc/sysctl.conf&#039;&#039;. This file is used to change and tweak multiple system variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Scroll down until you find the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;# Uncomment the next line to enable packet forwarding for IPv4&lt;br /&gt;
#net.ipv4.ip_forward=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Follow the instructions in the file to enable packet forwarding in the kernel. &lt;br /&gt;
: [[File:Lab10_sysctl_after.png | link=https://wiki.ihitc.net/mediawiki/images/1/1e/Lab10_sysctl_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_sysctl_after.png | Click for larger image]]&lt;br /&gt;
* When you are done, save the file.&lt;br /&gt;
: Changes to the &#039;&#039;sysctl.conf&#039;&#039; file require a reboot, but most can be set without a reboot by echoing response codes to &amp;quot;files&amp;quot; in &#039;&#039;/proc&#039;&#039;. &lt;br /&gt;
&amp;lt;li&amp;gt; We will get into that more in a later chapter, but for now run the following command to enable ip_forwarding without rebooting the machine: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: If you are receiving an error when trying to run that command it&#039;s likely that the user you are running it as does not have permission to modify the &#039;&#039;&#039;/proc/sys/net/ipv4/ip_forward&#039;&#039;&#039; file (check the permissions by using &#039;&#039;&#039;ls&#039;&#039;&#039;). Read [http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission-to-wr this similar question] for more details and possible solutions.&#039;&#039;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a DHCP Server ==&lt;br /&gt;
To setup a DHCP server, we will first need to install the required software. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your SSH console use your favorite package manager to install the &#039;&#039;isc-dhcp-server&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
: After you install the package you may get a warning about &#039;&#039;isc-dhcp-server&#039;&#039; being unable to start. This is normal as we have yet to define the interface and settings we want used.&lt;br /&gt;
&amp;lt;li&amp;gt;Now back in Webmin, select the Refresh Modules option. .&amp;lt;/li&amp;gt;&lt;br /&gt;
* After it is done, go to Servers, then DHCP Server&lt;br /&gt;
: Before we define our DHCP range, we need to set our listening interface. &lt;br /&gt;
* Click on the &#039;&#039;Edit Network Interface&#039;&#039; option. &lt;br /&gt;
*Select &#039;&#039;ens224&#039;&#039;. &lt;br /&gt;
* Press save.&lt;br /&gt;
&amp;lt;li&amp;gt;Now under Subnets and Shared Networks, select Add a new subnet. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Subnet description: LAN DHCP Range&lt;br /&gt;
Network Address: 192.168.1.0&lt;br /&gt;
Netmask: 255.255.255.0&lt;br /&gt;
Address Ranges: 192.168.1.100-192.168.1.254&amp;lt;/pre&amp;gt;&lt;br /&gt;
: [[File:Lab10_webmin_dhcp_create_subnet.png | link=https://wiki.ihitc.net/mediawiki/images/4/4e/Lab10_webmin_dhcp_create_subnet.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_create_subnet.png | Click for larger image]]&lt;br /&gt;
* When you are done, press Create. &lt;br /&gt;
* Now, click on the network you just created to review the settings, then press Edit Client Options at the bottom.&lt;br /&gt;
: From here we will setup the default gateway and DNS servers for the clients to use. &lt;br /&gt;
&amp;lt;li&amp;gt; Under Default Routers, set the option to 192.168.1.1 &lt;br /&gt;
* Under DNS servers, set it to 192.168.1.1. &lt;br /&gt;
: [[File:Lab10_webmin_dhcp_client_options.png | link=https://wiki.ihitc.net/mediawiki/images/d/d7/Lab10_webmin_dhcp_client_options.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_client_options.png | Click for larger image]]&lt;br /&gt;
: Notice how we are setting these options to the IP of ens224 that we setup. This is because our Linux VM will act as the router and DNS for our clients as well.&lt;br /&gt;
* When you are done, press save&lt;br /&gt;
* Then on the Edit Subnet page, press save again.&lt;br /&gt;
&amp;lt;li&amp;gt;Now that you are back on the DHCP server page, press the Start Server button. &lt;br /&gt;
: If all goes well, the button should change to &amp;quot;Stop Server&amp;quot;. If this does not happen, then the server was unable start. If that happens, re-check your DHCP server configurations to make sure everything is correct.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling NAT and Firewall Rules for the LAN ==&lt;br /&gt;
Now we will use firewalld to setup NAT so that we can use private addresses on our internal LAN but still have access to the public Internet. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s set our ens224 interface (LAN) to be in the internal zone with the following command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=internal --add-interface=ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;You should now take a minute to allow all of the same services and ports on the internal network that you have allowed on the external network. &amp;lt;/li&amp;gt;&lt;br /&gt;
:In other words, make sure that Webmin, Samba, DNS, etc. are also allowed on the internal zone.&lt;br /&gt;
:In order to activate NAT you need to turn on the &amp;quot;masquerade&amp;quot; feature on your outside interface. This is probably already done if you correctly assigned your outside interface to the pre-defined external zone (it&#039;s one of the features of that zone). &lt;br /&gt;
: &#039;&#039;HINT: you can do this manually as well in case you setup a custom zone by running the &#039;&#039;&#039;firewall-cmd --add-masquerade --zone=external&#039;&#039;&#039; command.&#039;&#039;&lt;br /&gt;
: While routing and NAT should be working for hosts on your LAN interface now they probably still can&#039;t get an IP address! Just like all the other services being blocked by the firewall DHCP is also blocked unless you specifically allow it. &lt;br /&gt;
&amp;lt;li&amp;gt;To do this run the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-service=dhcp --zone=internal&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once you are satisfied your firewall is running correctly you can use this command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd VM as a LAN Host ==&lt;br /&gt;
Now we are going to setup a 2nd VM on the VMware server so we can have a client to connect to the LAN network segment we just created. For this though, we will be using Linux Mint instead of Debian so we have a graphical user interface to help us with testing.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; You&#039;ll need to make a Netlab reservation to work with your Mint system&#039;s GUI so go ahead and do that. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Enter the lab on Netlab&lt;br /&gt;
* Click the &amp;quot;Linux Desktop&amp;quot; tab to access your Mint machine.&lt;br /&gt;
: The VM should be booting from a Linux Mint virtual CD image. &lt;br /&gt;
&amp;lt;li&amp;gt; Get Linux Mint installed using the link on the desktop.&amp;lt;/li&amp;gt;&lt;br /&gt;
: Installation settings are not critical as we&#039;ll be using the system primarily to explore a Linux GUI and to test web browsing capability from our private network.&lt;br /&gt;
: [[File:Lab10_linux_mint_desktop.png | link=https://wiki.ihitc.net/mediawiki/images/f/f1/Lab10_linux_mint_desktop.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_desktop.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: By default Linux Mint will boot into a &amp;quot;Live CD&amp;quot; environment where you can use the system without installing. However, the Live CD environment is much slower and memory limited compared with a full installation to the hard drive so be sure to start an installation and reboot into the installed copy instead of from the Live CD. You will know you&#039;re working from an installed copy if you are prompted for your username and password when logging in and don&#039;t see a link on the desktop to Install Linux Mint anymore.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Once you have Linux Mint installed, reboot the machine and login. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Hopefully the machine is able to connect to the Internet through your Debian server which is acting as a DHCP server and router (see the topology diagram tab in Netlab to see a diagram of how they are connected).&lt;br /&gt;
&amp;lt;li&amp;gt; Press the Menu icon in the lower left corner, and enter &amp;quot;Terminal&amp;quot;. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Then, open the terminal application.&lt;br /&gt;
&amp;lt;li&amp;gt; You now have a shell on the system. From here, use the following command to check your network settings. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
: Notice how you have a IP from the DHCP pool we created earlier. &lt;br /&gt;
&amp;lt;li&amp;gt; Now try pinging &#039;&#039;172.17.50.1&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Are you able to ping? If so, NAT is working properly on your network because the 172.17.50.0/24 network is outside of the LAN segment this machine is attached to (192.168.1.0/24).&lt;br /&gt;
: &#039;&#039;NOTE: Notice how some Linux distributions like Mint haven&#039;t switched from the old naming of network interfaces with &#039;&#039;eth&#039;&#039; to the new &#039;&#039;ens&#039;&#039; style. You can also try using the older &#039;&#039;&#039;ifconfig&#039;&#039;&#039; way of checking the IP address and compare the output to the new &#039;&#039;&#039;ip address show&#039;&#039;&#039; method which we have been using so far in Debian.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Now run &#039;&#039;&#039;ping google.com&#039;&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: If you are able to ping, this shows that not only is NAT working, but DNS resolving as well.&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on the system (you can use a graphical browser this time since you have a GUI) and test browsing to a few websites.&amp;lt;/li&amp;gt;&lt;br /&gt;
: At this point we have a fully functional LAN environment.&lt;br /&gt;
&amp;lt;li&amp;gt; In order to allow automatic safe shutdown of your Linux Mint system and improve speed/efficiency use the package manager to install the &#039;&#039;open-vm-tools-desktop&#039;&#039; package. &amp;lt;/li&amp;gt;&lt;br /&gt;
:This provides better drivers and integration between the vmWare host which is running your Linux Mint virtual machine and the virtual machine itself.&lt;br /&gt;
&amp;lt;li&amp;gt; Finally, in the next section we&#039;ll be setting up SSH access to Mint through the Firewall so you&#039;ll want to install the &#039;&#039;openssh-server package&#039;&#039; through the package manager. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you&#039;ve done this you should be able to use the ssh program on the command line in Debian to access your Mint system like &#039;&#039;&#039;ssh mintusername@192.168.1.x&#039;&#039;&#039; where you are using a valid username on the Mint system and the IP address of the Mint system.&lt;br /&gt;
&amp;lt;li&amp;gt; Spend a few more minutes exploring the functionality of the Linux GUI and desktop.&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Port Forwarding and Firewalling ==&lt;br /&gt;
Now we are going to enable port forwarding to our VM. This will allow you to access the 2nd VM from the ITC network and VPN.&lt;br /&gt;
Because we are already using port 22 on our outside interface to provide SSH access to our main Debian system we need to use a different port to access the Mint system. Instead of changing the port number in the SSH server software on Mint we can have our firewall do it at the same time the NAT masquerading is occurring. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set up a rule by running the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-forward-port=port=2222:proto=tcp:toport=22:toaddr=192.168.1.100 --zone=external&amp;lt;/code&amp;gt;&lt;br /&gt;
:NOTE: this rule is a little unstable because it forwards the port to 192.168.1.100 which is currently the IP of our Mint system (if yours has a different IP you should change it in the command) but because that system gets an IP from DHCP it is subject to change which would break the rule. Therefore, if we wanted this to be stable in the long term, we would want to set up a static IP on any machines we were forwarding ports to.&lt;br /&gt;
:&#039;&#039;HINT: If your connection is refused, it may be because SSH is not installed in Mint.  Try installing SSH using the package manager or apt.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; From a computer on the ITC network, such as one connected to the VPN, try to SSH to port 2222 on the outside (172.17.50.xx) IP address of your Debian system. &amp;lt;/li&amp;gt;&lt;br /&gt;
:If everything was set up successfully, you should be able to sign into the Mint VM based on the port forwarding rule we have put in place.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
When you are done testing this section of the lab please power off your new Linux Mint VM as these require far more resources to run than the Debian VMs on our servers.&amp;lt;br&amp;gt;&lt;br /&gt;
: [[File:Lab10_linux_mint_shutdown.png | link=https://wiki.ihitc.net/mediawiki/images/1/1c/Lab10_linux_mint_shutdown.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_shutdown.png | Click for larger image]]&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
For this lab there are many things you need to check.&lt;br /&gt;
&lt;br /&gt;
#Firewall - attempt to connect using FTP on port 21, this should fail&lt;br /&gt;
#SSH - connect using FTP on port 22&lt;br /&gt;
#DNS - navigate to url of server&lt;br /&gt;
#SMTP - send a mail to auto-respond server&lt;br /&gt;
#IMAP - receive a mail from auto-respond server&lt;br /&gt;
#Samba - Create a file on server using file sharing&lt;br /&gt;
#HTTP - Navigate to ip address of server&lt;br /&gt;
#Webmin - Navigate to &amp;lt;your-ip&amp;gt;:10000&lt;br /&gt;
#PuTTY into linux mint using your ip address and port 2222&lt;br /&gt;
#Linux Mint DNS/NAT - ping google.com from within Linux Mint&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Run this script to automatically check your lab&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; curl &amp;lt;span&amp;gt;https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_10_test.py&amp;lt;/span&amp;gt; | sudo python3 &amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9541</id>
		<title>Lab 10 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9541"/>
		<updated>2021-03-02T01:34:10Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=dQw4w9WgXcQ Watch the video introduction]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This lab assumes you have successfully set up [[Lab_8_mnjk#Install_BIND_.26_Enable_Caching | DNS]] and [[Lab_9_mnjk#Install_the_Postfix_MTA |email]].  If you had any issues with those labs, you should resolve them before attempting this lab, since you will be unable to properly test the tasks in this lab if those are not fully functional.&lt;br /&gt;
&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Configuring a [https://firewalld.org/ Firewall]&lt;br /&gt;
*Enabling a 2nd interface&lt;br /&gt;
*Configuring [https://en.wikipedia.org/wiki/Network_address_translation NAT]&lt;br /&gt;
*Setting up [https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol DHCP]&lt;br /&gt;
*Installing [https://linuxmint.com/ Linux Mint] on a second VM&lt;br /&gt;
*Enabling [https://en.wikipedia.org/wiki/Port_forwarding Port Forwarding]&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
*&#039;&#039;&#039;[https://firewalld.org/documentation/man-pages/firewall-cmd.html firewall-cmd]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/echo echo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifconfig ifconfig]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software.&lt;br /&gt;
# Login with your standard user account.&lt;br /&gt;
# Have a browser window set to the webmin interface for your linux VM.&lt;br /&gt;
&lt;br /&gt;
== Configure a Firewall ==&lt;br /&gt;
&#039;&#039;NOTE: It is suggested that instead of managing a firewall directly  using nftables tools (which would also require us to create a script to reload our rules each time the system is restarted) we use a firewall daemon program to manage it based on a set of rules we create and automatically setup the firewall based on those rules each time the system boots. There are many command line firewall management programs out there but for this lab we will use the [https://firewalld.org/ firewalld] package suggested by Debian. &#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Begin by installing the &#039;&#039;firewalld&#039;&#039; package on your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s check to see if the firewall is now up and running using the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --state&amp;lt;/code&amp;gt;&lt;br /&gt;
: The firewall has been pre-configured with a couple of rules in it to prevent us from getting locked out. &lt;br /&gt;
: [[File:Lab10_firewalld_state.png | link=https://wiki.ihitc.net/mediawiki/images/1/11/Lab10_firewalld_state.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_state.png | Click for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Let&#039;s see what those rules are by using this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: [[File:Lab10_firewalld_initial_rules.png | link=https://wiki.ihitc.net/mediawiki/images/1/14/Lab10_firewalld_initial_rules.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_initial_rules.png | Click for larger image]]&lt;br /&gt;
: By default all interfaces are in the public zone (this is set in the &#039;&#039;/etc/firewalld/firewalld.conf&#039;&#039; file). &lt;br /&gt;
: Before we start working on rules for our firewall we should assign our outside interface to the external zone which is designed for NAT routing which we&#039;ll be setting up shortly. &lt;br /&gt;
&amp;lt;li&amp;gt; We can do this with the command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-interface=ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
: We can create custom zones or use pre-defined security zones which will speed up configuring the firewall. Learn more about the [https://firewalld.org/documentation/zone/predefined-zones.html pre-defined zones in firewalld documentation].&lt;br /&gt;
&amp;lt;li&amp;gt;Since we have changed zones on our interface let&#039;s check and see what rules we have started with. Let&#039;s see what those rules are:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: You can also use the &#039;&#039;&#039;firewall-cmd --list-all-zones&#039;&#039;&#039; command to see a list of all available zones and their rules.&amp;lt;/li&amp;gt;&#039;&#039;&lt;br /&gt;
: If you were watching carefully you may have noted that the dhcpv6-client service which was allowed in the public zone but is not allowed by default on the external zone. &lt;br /&gt;
&amp;lt;li&amp;gt;In our case we want to allow DHCPv6 to operate on our outside interface so we can re-enable it with the following command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --zone=external --add-service=&amp;quot;dhcpv6-client&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check to see what other services can be allowed on an interface with:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --get-services&amp;lt;/code&amp;gt;&lt;br /&gt;
: If you check you will see that although you can connect with ssh (by default it&#039;s on the allowed service list you saw above) you can&#039;t connect to your webserver or Webmin anymore. Webmin is not a pre-defined service in the list we saw above so we could either set it up as a new service and then allow it or we could create a manual rule to allow the TCP traffic on port 10000 needed to access Webmin. In this case because the service only uses a single port and to see how manual rules can be created let&#039;s manually create a rule to allow access to TCP port 10000. &lt;br /&gt;
&amp;lt;li&amp;gt;Do this by running this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-port=10000/tcp &amp;lt;/code&amp;gt;&lt;br /&gt;
:You should now be able to access Webmin again.&lt;br /&gt;
&amp;lt;li&amp;gt; Using either service rules or manual port rules create additional rules so that the other services on your VM are again accessible from the outside (such as from your home PC over the VPN). &amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;HINT: Services we have setup so far include SSH, DNS, SMTP, IMAP, Samba, and HTTP.&#039;&#039;&lt;br /&gt;
: Make sure to test and ensure they are all working again!&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --runtime-to-permanent &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd NIC Interface ==&lt;br /&gt;
To start this lab we will need to configure a second network interface, named ens224 on our virtual machines. In our simulated setup our existing ens192 interface will be our WAN interface and ens224 will be our LAN interface which could be connected to a switch and then to multiple allow other computers which will connect to the Internet through our server.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open &#039;&#039;/etc/network/interfaces&#039;&#039; with your favorite text editor. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Go to the bottom of the file.&lt;br /&gt;
: [[File:Lab10_network_interfaces_before.png | link=https://wiki.ihitc.net/mediawiki/images/f/f8/Lab10_network_interfaces_before.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_before.png | Click for larger image]]&lt;br /&gt;
* Add the following to configure the second interface with a static IP of 192.168.1.1/24:&lt;br /&gt;
&amp;lt;pre&amp;gt;auto ens224&lt;br /&gt;
iface ens224 inet static&lt;br /&gt;
	address 192.168.1.1&lt;br /&gt;
	netmask 255.255.255.0&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: [[File:Lab10_network_interfaces_after.png | link=https://wiki.ihitc.net/mediawiki/images/8/80/Lab10_network_interfaces_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_after.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: As this is a LAN only interface, we do not need to define a gateway for the server VM, as the server VM itself will be the gateway for this network.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Once this is done, save the file &lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to enable the new interface.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ifup ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the second interface is up and running with the correct IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enable Routing ==&lt;br /&gt;
Now we will need to enable NAT so we can route LAN traffic to the Internet and responding Internet traffic back to our LAN interface.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your console, you will need to edit &#039;&#039;/etc/sysctl.conf&#039;&#039;. This file is used to change and tweak multiple system variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Scroll down until you find the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;# Uncomment the next line to enable packet forwarding for IPv4&lt;br /&gt;
#net.ipv4.ip_forward=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Follow the instructions in the file to enable packet forwarding in the kernel. &lt;br /&gt;
: [[File:Lab10_sysctl_after.png | link=https://wiki.ihitc.net/mediawiki/images/1/1e/Lab10_sysctl_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_sysctl_after.png | Click for larger image]]&lt;br /&gt;
* When you are done, save the file.&lt;br /&gt;
: Changes to the &#039;&#039;sysctl.conf&#039;&#039; file require a reboot, but most can be set without a reboot by echoing response codes to &amp;quot;files&amp;quot; in &#039;&#039;/proc&#039;&#039;. &lt;br /&gt;
&amp;lt;li&amp;gt; We will get into that more in a later chapter, but for now run the following command to enable ip_forwarding without rebooting the machine: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: If you are receiving an error when trying to run that command it&#039;s likely that the user you are running it as does not have permission to modify the &#039;&#039;&#039;/proc/sys/net/ipv4/ip_forward&#039;&#039;&#039; file (check the permissions by using &#039;&#039;&#039;ls&#039;&#039;&#039;). Read [http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission-to-wr this similar question] for more details and possible solutions.&#039;&#039;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a DHCP Server ==&lt;br /&gt;
To setup a DHCP server, we will first need to install the required software. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your SSH console use your favorite package manager to install the &#039;&#039;isc-dhcp-server&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
: After you install the package you may get a warning about &#039;&#039;isc-dhcp-server&#039;&#039; being unable to start. This is normal as we have yet to define the interface and settings we want used.&lt;br /&gt;
&amp;lt;li&amp;gt;Now back in Webmin, select the Refresh Modules option. .&amp;lt;/li&amp;gt;&lt;br /&gt;
* After it is done, go to Servers, then DHCP Server&lt;br /&gt;
: Before we define our DHCP range, we need to set our listening interface. &lt;br /&gt;
* Click on the &#039;&#039;Edit Network Interface&#039;&#039; option. &lt;br /&gt;
*Select &#039;&#039;ens224&#039;&#039;. &lt;br /&gt;
* Press save.&lt;br /&gt;
&amp;lt;li&amp;gt;Now under Subnets and Shared Networks, select Add a new subnet. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Subnet description: LAN DHCP Range&lt;br /&gt;
Network Address: 192.168.1.0&lt;br /&gt;
Netmask: 255.255.255.0&lt;br /&gt;
Address Ranges: 192.168.1.100-192.168.1.254&amp;lt;/pre&amp;gt;&lt;br /&gt;
: [[File:Lab10_webmin_dhcp_create_subnet.png | link=https://wiki.ihitc.net/mediawiki/images/4/4e/Lab10_webmin_dhcp_create_subnet.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_create_subnet.png | Click for larger image]]&lt;br /&gt;
* When you are done, press Create. &lt;br /&gt;
* Now, click on the network you just created to review the settings, then press Edit Client Options at the bottom.&lt;br /&gt;
: From here we will setup the default gateway and DNS servers for the clients to use. &lt;br /&gt;
&amp;lt;li&amp;gt; Under Default Routers, set the option to 192.168.1.1 &lt;br /&gt;
* Under DNS servers, set it to 192.168.1.1. &lt;br /&gt;
: [[File:Lab10_webmin_dhcp_client_options.png | link=https://wiki.ihitc.net/mediawiki/images/d/d7/Lab10_webmin_dhcp_client_options.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_client_options.png | Click for larger image]]&lt;br /&gt;
: Notice how we are setting these options to the IP of ens224 that we setup. This is because our Linux VM will act as the router and DNS for our clients as well.&lt;br /&gt;
* When you are done, press save&lt;br /&gt;
* Then on the Edit Subnet page, press save again.&lt;br /&gt;
&amp;lt;li&amp;gt;Now that you are back on the DHCP server page, press the Start Server button. &lt;br /&gt;
: If all goes well, the button should change to &amp;quot;Stop Server&amp;quot;. If this does not happen, then the server was unable start. If that happens, re-check your DHCP server configurations to make sure everything is correct.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling NAT and Firewall Rules for the LAN ==&lt;br /&gt;
Now we will use firewalld to setup NAT so that we can use private addresses on our internal LAN but still have access to the public Internet. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s set our ens224 interface (LAN) to be in the internal zone with the following command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=internal --add-interface=ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;You should now take a minute to allow all of the same services and ports on the internal network that you have allowed on the external network. &amp;lt;/li&amp;gt;&lt;br /&gt;
:In other words, make sure that Webmin, Samba, DNS, etc. are also allowed on the internal zone.&lt;br /&gt;
:In order to activate NAT you need to turn on the &amp;quot;masquerade&amp;quot; feature on your outside interface. This is probably already done if you correctly assigned your outside interface to the pre-defined external zone (it&#039;s one of the features of that zone). &lt;br /&gt;
: &#039;&#039;HINT: you can do this manually as well in case you setup a custom zone by running the &#039;&#039;&#039;firewall-cmd --add-masquerade --zone=external&#039;&#039;&#039; command.&#039;&#039;&lt;br /&gt;
: While routing and NAT should be working for hosts on your LAN interface now they probably still can&#039;t get an IP address! Just like all the other services being blocked by the firewall DHCP is also blocked unless you specifically allow it. &lt;br /&gt;
&amp;lt;li&amp;gt;To do this run the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-service=dhcp --zone=internal&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once you are satisfied your firewall is running correctly you can use this command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd VM as a LAN Host ==&lt;br /&gt;
Now we are going to setup a 2nd VM on the VMware server so we can have a client to connect to the LAN network segment we just created. For this though, we will be using Linux Mint instead of Debian so we have a graphical user interface to help us with testing.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; You&#039;ll need to make a Netlab reservation to work with your Mint system&#039;s GUI so go ahead and do that. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Enter the lab on Netlab&lt;br /&gt;
* Click the &amp;quot;Linux Desktop&amp;quot; tab to access your Mint machine.&lt;br /&gt;
: The VM should be booting from a Linux Mint virtual CD image. &lt;br /&gt;
&amp;lt;li&amp;gt; Get Linux Mint installed using the link on the desktop.&amp;lt;/li&amp;gt;&lt;br /&gt;
: Installation settings are not critical as we&#039;ll be using the system primarily to explore a Linux GUI and to test web browsing capability from our private network.&lt;br /&gt;
: [[File:Lab10_linux_mint_desktop.png | link=https://wiki.ihitc.net/mediawiki/images/f/f1/Lab10_linux_mint_desktop.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_desktop.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: By default Linux Mint will boot into a &amp;quot;Live CD&amp;quot; environment where you can use the system without installing. However, the Live CD environment is much slower and memory limited compared with a full installation to the hard drive so be sure to start an installation and reboot into the installed copy instead of from the Live CD. You will know you&#039;re working from an installed copy if you are prompted for your username and password when logging in and don&#039;t see a link on the desktop to Install Linux Mint anymore.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Once you have Linux Mint installed, reboot the machine and login. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Hopefully the machine is able to connect to the Internet through your Debian server which is acting as a DHCP server and router (see the topology diagram tab in Netlab to see a diagram of how they are connected).&lt;br /&gt;
&amp;lt;li&amp;gt; Press the Menu icon in the lower left corner, and enter &amp;quot;Terminal&amp;quot;. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Then, open the terminal application.&lt;br /&gt;
&amp;lt;li&amp;gt; You now have a shell on the system. From here, use the following command to check your network settings. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
: Notice how you have a IP from the DHCP pool we created earlier. &lt;br /&gt;
&amp;lt;li&amp;gt; Now try pinging &#039;&#039;172.17.50.1&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Are you able to ping? If so, NAT is working properly on your network because the 172.17.50.0/24 network is outside of the LAN segment this machine is attached to (192.168.1.0/24).&lt;br /&gt;
: &#039;&#039;NOTE: Notice how some Linux distributions like Mint haven&#039;t switched from the old naming of network interfaces with &#039;&#039;eth&#039;&#039; to the new &#039;&#039;ens&#039;&#039; style. You can also try using the older &#039;&#039;&#039;ifconfig&#039;&#039;&#039; way of checking the IP address and compare the output to the new &#039;&#039;&#039;ip address show&#039;&#039;&#039; method which we have been using so far in Debian.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Now run &#039;&#039;&#039;ping google.com&#039;&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: If you are able to ping, this shows that not only is NAT working, but DNS resolving as well.&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on the system (you can use a graphical browser this time since you have a GUI) and test browsing to a few websites.&amp;lt;/li&amp;gt;&lt;br /&gt;
: At this point we have a fully functional LAN environment.&lt;br /&gt;
&amp;lt;li&amp;gt; In order to allow automatic safe shutdown of your Linux Mint system and improve speed/efficiency use the package manager to install the &#039;&#039;open-vm-tools-desktop&#039;&#039; package. &amp;lt;/li&amp;gt;&lt;br /&gt;
:This provides better drivers and integration between the vmWare host which is running your Linux Mint virtual machine and the virtual machine itself.&lt;br /&gt;
&amp;lt;li&amp;gt; Finally, in the next section we&#039;ll be setting up SSH access to Mint through the Firewall so you&#039;ll want to install the &#039;&#039;openssh-server package&#039;&#039; through the package manager. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you&#039;ve done this you should be able to use the ssh program on the command line in Debian to access your Mint system like &#039;&#039;&#039;ssh mintusername@192.168.1.x&#039;&#039;&#039; where you are using a valid username on the Mint system and the IP address of the Mint system.&lt;br /&gt;
&amp;lt;li&amp;gt; Spend a few more minutes exploring the functionality of the Linux GUI and desktop.&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Port Forwarding and Firewalling ==&lt;br /&gt;
Now we are going to enable port forwarding to our VM. This will allow you to access the 2nd VM from the ITC network and VPN.&lt;br /&gt;
Because we are already using port 22 on our outside interface to provide SSH access to our main Debian system we need to use a different port to access the Mint system. Instead of changing the port number in the SSH server software on Mint we can have our firewall do it at the same time the NAT masquerading is occurring. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set up a rule by running the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-forward-port=port=2222:proto=tcp:toport=22:toaddr=192.168.1.100 --zone=external&amp;lt;/code&amp;gt;&lt;br /&gt;
:NOTE: this rule is a little unstable because it forwards the port to 192.168.1.100 which is currently the IP of our Mint system (if yours has a different IP you should change it in the command) but because that system gets an IP from DHCP it is subject to change which would break the rule. Therefore, if we wanted this to be stable in the long term, we would want to set up a static IP on any machines we were forwarding ports to.&lt;br /&gt;
:&#039;&#039;HINT: If your connection is refused, it may be because SSH is not installed in Mint.  Try installing SSH using the package manager or apt.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; From a computer on the ITC network, such as one connected to the VPN, try to SSH to port 2222 on the outside (172.17.50.xx) IP address of your Debian system. &amp;lt;/li&amp;gt;&lt;br /&gt;
:If everything was set up successfully, you should be able to sign into the Mint VM based on the port forwarding rule we have put in place.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
When you are done testing this section of the lab please power off your new Linux Mint VM as these require far more resources to run than the Debian VMs on our servers.&amp;lt;br&amp;gt;&lt;br /&gt;
: [[File:Lab10_linux_mint_shutdown.png | link=https://wiki.ihitc.net/mediawiki/images/1/1c/Lab10_linux_mint_shutdown.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_shutdown.png | Click for larger image]]&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
For this lab there are many things you need to check.&lt;br /&gt;
&lt;br /&gt;
#Firewall - attempt to connect using FTP on port 21, this should fail&lt;br /&gt;
#SSH - connect using FTP on port 22&lt;br /&gt;
#DNS - navigate to url of server&lt;br /&gt;
#SMTP - send a mail to auto-respond server&lt;br /&gt;
#IMAP - receive a mail from auto-respond server&lt;br /&gt;
#Samba - Create a file on server using file sharing&lt;br /&gt;
#HTTP - Navigate to ip address of server&lt;br /&gt;
#Webmin - Navigate to &amp;lt;your-ip&amp;gt;:10000&lt;br /&gt;
#PuTTY into linux mint using your ip address and port 2222&lt;br /&gt;
#Linux Mint DNS/NAT - ping google.com from within Linux Mint&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Run this script to automatically check your lab&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_10_test.py | sudo python3 &amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9540</id>
		<title>Lab 10 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_10_mnjk&amp;diff=9540"/>
		<updated>2021-03-02T01:33:55Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Checking your Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=dQw4w9WgXcQ Watch the video introduction]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This lab assumes you have successfully set up [[Lab_8_mnjk#Install_BIND_.26_Enable_Caching | DNS]] and [[Lab_9_mnjk#Install_the_Postfix_MTA |email]].  If you had any issues with those labs, you should resolve them before attempting this lab, since you will be unable to properly test the tasks in this lab if those are not fully functional.&lt;br /&gt;
&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Configuring a [https://firewalld.org/ Firewall]&lt;br /&gt;
*Enabling a 2nd interface&lt;br /&gt;
*Configuring [https://en.wikipedia.org/wiki/Network_address_translation NAT]&lt;br /&gt;
*Setting up [https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol DHCP]&lt;br /&gt;
*Installing [https://linuxmint.com/ Linux Mint] on a second VM&lt;br /&gt;
*Enabling [https://en.wikipedia.org/wiki/Port_forwarding Port Forwarding]&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
*&#039;&#039;&#039;[https://firewalld.org/documentation/man-pages/firewall-cmd.html firewall-cmd]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/echo echo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifconfig ifconfig]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software.&lt;br /&gt;
# Login with your standard user account.&lt;br /&gt;
# Have a browser window set to the webmin interface for your linux VM.&lt;br /&gt;
&lt;br /&gt;
== Configure a Firewall ==&lt;br /&gt;
&#039;&#039;NOTE: It is suggested that instead of managing a firewall directly  using nftables tools (which would also require us to create a script to reload our rules each time the system is restarted) we use a firewall daemon program to manage it based on a set of rules we create and automatically setup the firewall based on those rules each time the system boots. There are many command line firewall management programs out there but for this lab we will use the [https://firewalld.org/ firewalld] package suggested by Debian. &#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Begin by installing the &#039;&#039;firewalld&#039;&#039; package on your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s check to see if the firewall is now up and running using the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --state&amp;lt;/code&amp;gt;&lt;br /&gt;
: The firewall has been pre-configured with a couple of rules in it to prevent us from getting locked out. &lt;br /&gt;
: [[File:Lab10_firewalld_state.png | link=https://wiki.ihitc.net/mediawiki/images/1/11/Lab10_firewalld_state.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_state.png | Click for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Let&#039;s see what those rules are by using this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: [[File:Lab10_firewalld_initial_rules.png | link=https://wiki.ihitc.net/mediawiki/images/1/14/Lab10_firewalld_initial_rules.png|500px]]&lt;br /&gt;
: [[Media:Lab10_firewalld_initial_rules.png | Click for larger image]]&lt;br /&gt;
: By default all interfaces are in the public zone (this is set in the &#039;&#039;/etc/firewalld/firewalld.conf&#039;&#039; file). &lt;br /&gt;
: Before we start working on rules for our firewall we should assign our outside interface to the external zone which is designed for NAT routing which we&#039;ll be setting up shortly. &lt;br /&gt;
&amp;lt;li&amp;gt; We can do this with the command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-interface=ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
: We can create custom zones or use pre-defined security zones which will speed up configuring the firewall. Learn more about the [https://firewalld.org/documentation/zone/predefined-zones.html pre-defined zones in firewalld documentation].&lt;br /&gt;
&amp;lt;li&amp;gt;Since we have changed zones on our interface let&#039;s check and see what rules we have started with. Let&#039;s see what those rules are:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --list-all&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: You can also use the &#039;&#039;&#039;firewall-cmd --list-all-zones&#039;&#039;&#039; command to see a list of all available zones and their rules.&amp;lt;/li&amp;gt;&#039;&#039;&lt;br /&gt;
: If you were watching carefully you may have noted that the dhcpv6-client service which was allowed in the public zone but is not allowed by default on the external zone. &lt;br /&gt;
&amp;lt;li&amp;gt;In our case we want to allow DHCPv6 to operate on our outside interface so we can re-enable it with the following command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --zone=external --add-service=&amp;quot;dhcpv6-client&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check to see what other services can be allowed on an interface with:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --get-services&amp;lt;/code&amp;gt;&lt;br /&gt;
: If you check you will see that although you can connect with ssh (by default it&#039;s on the allowed service list you saw above) you can&#039;t connect to your webserver or Webmin anymore. Webmin is not a pre-defined service in the list we saw above so we could either set it up as a new service and then allow it or we could create a manual rule to allow the TCP traffic on port 10000 needed to access Webmin. In this case because the service only uses a single port and to see how manual rules can be created let&#039;s manually create a rule to allow access to TCP port 10000. &lt;br /&gt;
&amp;lt;li&amp;gt;Do this by running this command: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=external --add-port=10000/tcp &amp;lt;/code&amp;gt;&lt;br /&gt;
:You should now be able to access Webmin again.&lt;br /&gt;
&amp;lt;li&amp;gt; Using either service rules or manual port rules create additional rules so that the other services on your VM are again accessible from the outside (such as from your home PC over the VPN). &amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;HINT: Services we have setup so far include SSH, DNS, SMTP, IMAP, Samba, and HTTP.&#039;&#039;&lt;br /&gt;
: Make sure to test and ensure they are all working again!&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; firewall-cmd --runtime-to-permanent &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd NIC Interface ==&lt;br /&gt;
To start this lab we will need to configure a second network interface, named ens224 on our virtual machines. In our simulated setup our existing ens192 interface will be our WAN interface and ens224 will be our LAN interface which could be connected to a switch and then to multiple allow other computers which will connect to the Internet through our server.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open &#039;&#039;/etc/network/interfaces&#039;&#039; with your favorite text editor. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Go to the bottom of the file.&lt;br /&gt;
: [[File:Lab10_network_interfaces_before.png | link=https://wiki.ihitc.net/mediawiki/images/f/f8/Lab10_network_interfaces_before.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_before.png | Click for larger image]]&lt;br /&gt;
* Add the following to configure the second interface with a static IP of 192.168.1.1/24:&lt;br /&gt;
&amp;lt;pre&amp;gt;auto ens224&lt;br /&gt;
iface ens224 inet static&lt;br /&gt;
	address 192.168.1.1&lt;br /&gt;
	netmask 255.255.255.0&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: [[File:Lab10_network_interfaces_after.png | link=https://wiki.ihitc.net/mediawiki/images/8/80/Lab10_network_interfaces_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_network_interfaces_after.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: As this is a LAN only interface, we do not need to define a gateway for the server VM, as the server VM itself will be the gateway for this network.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Once this is done, save the file &lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to enable the new interface.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ifup ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the second interface is up and running with the correct IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enable Routing ==&lt;br /&gt;
Now we will need to enable NAT so we can route LAN traffic to the Internet and responding Internet traffic back to our LAN interface.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your console, you will need to edit &#039;&#039;/etc/sysctl.conf&#039;&#039;. This file is used to change and tweak multiple system variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Scroll down until you find the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;# Uncomment the next line to enable packet forwarding for IPv4&lt;br /&gt;
#net.ipv4.ip_forward=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Follow the instructions in the file to enable packet forwarding in the kernel. &lt;br /&gt;
: [[File:Lab10_sysctl_after.png | link=https://wiki.ihitc.net/mediawiki/images/1/1e/Lab10_sysctl_after.png|500px]]&lt;br /&gt;
: [[Media:Lab10_sysctl_after.png | Click for larger image]]&lt;br /&gt;
* When you are done, save the file.&lt;br /&gt;
: Changes to the &#039;&#039;sysctl.conf&#039;&#039; file require a reboot, but most can be set without a reboot by echoing response codes to &amp;quot;files&amp;quot; in &#039;&#039;/proc&#039;&#039;. &lt;br /&gt;
&amp;lt;li&amp;gt; We will get into that more in a later chapter, but for now run the following command to enable ip_forwarding without rebooting the machine: &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: If you are receiving an error when trying to run that command it&#039;s likely that the user you are running it as does not have permission to modify the &#039;&#039;&#039;/proc/sys/net/ipv4/ip_forward&#039;&#039;&#039; file (check the permissions by using &#039;&#039;&#039;ls&#039;&#039;&#039;). Read [http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission-to-wr this similar question] for more details and possible solutions.&#039;&#039;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a DHCP Server ==&lt;br /&gt;
To setup a DHCP server, we will first need to install the required software. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In your SSH console use your favorite package manager to install the &#039;&#039;isc-dhcp-server&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
: After you install the package you may get a warning about &#039;&#039;isc-dhcp-server&#039;&#039; being unable to start. This is normal as we have yet to define the interface and settings we want used.&lt;br /&gt;
&amp;lt;li&amp;gt;Now back in Webmin, select the Refresh Modules option. .&amp;lt;/li&amp;gt;&lt;br /&gt;
* After it is done, go to Servers, then DHCP Server&lt;br /&gt;
: Before we define our DHCP range, we need to set our listening interface. &lt;br /&gt;
* Click on the &#039;&#039;Edit Network Interface&#039;&#039; option. &lt;br /&gt;
*Select &#039;&#039;ens224&#039;&#039;. &lt;br /&gt;
* Press save.&lt;br /&gt;
&amp;lt;li&amp;gt;Now under Subnets and Shared Networks, select Add a new subnet. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Subnet description: LAN DHCP Range&lt;br /&gt;
Network Address: 192.168.1.0&lt;br /&gt;
Netmask: 255.255.255.0&lt;br /&gt;
Address Ranges: 192.168.1.100-192.168.1.254&amp;lt;/pre&amp;gt;&lt;br /&gt;
: [[File:Lab10_webmin_dhcp_create_subnet.png | link=https://wiki.ihitc.net/mediawiki/images/4/4e/Lab10_webmin_dhcp_create_subnet.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_create_subnet.png | Click for larger image]]&lt;br /&gt;
* When you are done, press Create. &lt;br /&gt;
* Now, click on the network you just created to review the settings, then press Edit Client Options at the bottom.&lt;br /&gt;
: From here we will setup the default gateway and DNS servers for the clients to use. &lt;br /&gt;
&amp;lt;li&amp;gt; Under Default Routers, set the option to 192.168.1.1 &lt;br /&gt;
* Under DNS servers, set it to 192.168.1.1. &lt;br /&gt;
: [[File:Lab10_webmin_dhcp_client_options.png | link=https://wiki.ihitc.net/mediawiki/images/d/d7/Lab10_webmin_dhcp_client_options.png|500px]]&lt;br /&gt;
: [[Media:Lab10_webmin_dhcp_client_options.png | Click for larger image]]&lt;br /&gt;
: Notice how we are setting these options to the IP of ens224 that we setup. This is because our Linux VM will act as the router and DNS for our clients as well.&lt;br /&gt;
* When you are done, press save&lt;br /&gt;
* Then on the Edit Subnet page, press save again.&lt;br /&gt;
&amp;lt;li&amp;gt;Now that you are back on the DHCP server page, press the Start Server button. &lt;br /&gt;
: If all goes well, the button should change to &amp;quot;Stop Server&amp;quot;. If this does not happen, then the server was unable start. If that happens, re-check your DHCP server configurations to make sure everything is correct.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling NAT and Firewall Rules for the LAN ==&lt;br /&gt;
Now we will use firewalld to setup NAT so that we can use private addresses on our internal LAN but still have access to the public Internet. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First, let&#039;s set our ens224 interface (LAN) to be in the internal zone with the following command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --zone=internal --add-interface=ens224&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;You should now take a minute to allow all of the same services and ports on the internal network that you have allowed on the external network. &amp;lt;/li&amp;gt;&lt;br /&gt;
:In other words, make sure that Webmin, Samba, DNS, etc. are also allowed on the internal zone.&lt;br /&gt;
:In order to activate NAT you need to turn on the &amp;quot;masquerade&amp;quot; feature on your outside interface. This is probably already done if you correctly assigned your outside interface to the pre-defined external zone (it&#039;s one of the features of that zone). &lt;br /&gt;
: &#039;&#039;HINT: you can do this manually as well in case you setup a custom zone by running the &#039;&#039;&#039;firewall-cmd --add-masquerade --zone=external&#039;&#039;&#039; command.&#039;&#039;&lt;br /&gt;
: While routing and NAT should be working for hosts on your LAN interface now they probably still can&#039;t get an IP address! Just like all the other services being blocked by the firewall DHCP is also blocked unless you specifically allow it. &lt;br /&gt;
&amp;lt;li&amp;gt;To do this run the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-service=dhcp --zone=internal&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once you are satisfied your firewall is running correctly you can use this command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup a 2nd VM as a LAN Host ==&lt;br /&gt;
Now we are going to setup a 2nd VM on the VMware server so we can have a client to connect to the LAN network segment we just created. For this though, we will be using Linux Mint instead of Debian so we have a graphical user interface to help us with testing.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; You&#039;ll need to make a Netlab reservation to work with your Mint system&#039;s GUI so go ahead and do that. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Enter the lab on Netlab&lt;br /&gt;
* Click the &amp;quot;Linux Desktop&amp;quot; tab to access your Mint machine.&lt;br /&gt;
: The VM should be booting from a Linux Mint virtual CD image. &lt;br /&gt;
&amp;lt;li&amp;gt; Get Linux Mint installed using the link on the desktop.&amp;lt;/li&amp;gt;&lt;br /&gt;
: Installation settings are not critical as we&#039;ll be using the system primarily to explore a Linux GUI and to test web browsing capability from our private network.&lt;br /&gt;
: [[File:Lab10_linux_mint_desktop.png | link=https://wiki.ihitc.net/mediawiki/images/f/f1/Lab10_linux_mint_desktop.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_desktop.png | Click for larger image]]&lt;br /&gt;
: &#039;&#039;NOTE: By default Linux Mint will boot into a &amp;quot;Live CD&amp;quot; environment where you can use the system without installing. However, the Live CD environment is much slower and memory limited compared with a full installation to the hard drive so be sure to start an installation and reboot into the installed copy instead of from the Live CD. You will know you&#039;re working from an installed copy if you are prompted for your username and password when logging in and don&#039;t see a link on the desktop to Install Linux Mint anymore.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Once you have Linux Mint installed, reboot the machine and login. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Hopefully the machine is able to connect to the Internet through your Debian server which is acting as a DHCP server and router (see the topology diagram tab in Netlab to see a diagram of how they are connected).&lt;br /&gt;
&amp;lt;li&amp;gt; Press the Menu icon in the lower left corner, and enter &amp;quot;Terminal&amp;quot;. &amp;lt;/li&amp;gt;&lt;br /&gt;
* Then, open the terminal application.&lt;br /&gt;
&amp;lt;li&amp;gt; You now have a shell on the system. From here, use the following command to check your network settings. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
: Notice how you have a IP from the DHCP pool we created earlier. &lt;br /&gt;
&amp;lt;li&amp;gt; Now try pinging &#039;&#039;172.17.50.1&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Are you able to ping? If so, NAT is working properly on your network because the 172.17.50.0/24 network is outside of the LAN segment this machine is attached to (192.168.1.0/24).&lt;br /&gt;
: &#039;&#039;NOTE: Notice how some Linux distributions like Mint haven&#039;t switched from the old naming of network interfaces with &#039;&#039;eth&#039;&#039; to the new &#039;&#039;ens&#039;&#039; style. You can also try using the older &#039;&#039;&#039;ifconfig&#039;&#039;&#039; way of checking the IP address and compare the output to the new &#039;&#039;&#039;ip address show&#039;&#039;&#039; method which we have been using so far in Debian.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Now run &#039;&#039;&#039;ping google.com&#039;&#039;&#039;. &amp;lt;/li&amp;gt;&lt;br /&gt;
: If you are able to ping, this shows that not only is NAT working, but DNS resolving as well.&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on the system (you can use a graphical browser this time since you have a GUI) and test browsing to a few websites.&amp;lt;/li&amp;gt;&lt;br /&gt;
: At this point we have a fully functional LAN environment.&lt;br /&gt;
&amp;lt;li&amp;gt; In order to allow automatic safe shutdown of your Linux Mint system and improve speed/efficiency use the package manager to install the &#039;&#039;open-vm-tools-desktop&#039;&#039; package. &amp;lt;/li&amp;gt;&lt;br /&gt;
:This provides better drivers and integration between the vmWare host which is running your Linux Mint virtual machine and the virtual machine itself.&lt;br /&gt;
&amp;lt;li&amp;gt; Finally, in the next section we&#039;ll be setting up SSH access to Mint through the Firewall so you&#039;ll want to install the &#039;&#039;openssh-server package&#039;&#039; through the package manager. &amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you&#039;ve done this you should be able to use the ssh program on the command line in Debian to access your Mint system like &#039;&#039;&#039;ssh mintusername@192.168.1.x&#039;&#039;&#039; where you are using a valid username on the Mint system and the IP address of the Mint system.&lt;br /&gt;
&amp;lt;li&amp;gt; Spend a few more minutes exploring the functionality of the Linux GUI and desktop.&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Port Forwarding and Firewalling ==&lt;br /&gt;
Now we are going to enable port forwarding to our VM. This will allow you to access the 2nd VM from the ITC network and VPN.&lt;br /&gt;
Because we are already using port 22 on our outside interface to provide SSH access to our main Debian system we need to use a different port to access the Mint system. Instead of changing the port number in the SSH server software on Mint we can have our firewall do it at the same time the NAT masquerading is occurring. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set up a rule by running the following command:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --add-forward-port=port=2222:proto=tcp:toport=22:toaddr=192.168.1.100 --zone=external&amp;lt;/code&amp;gt;&lt;br /&gt;
:NOTE: this rule is a little unstable because it forwards the port to 192.168.1.100 which is currently the IP of our Mint system (if yours has a different IP you should change it in the command) but because that system gets an IP from DHCP it is subject to change which would break the rule. Therefore, if we wanted this to be stable in the long term, we would want to set up a static IP on any machines we were forwarding ports to.&lt;br /&gt;
:&#039;&#039;HINT: If your connection is refused, it may be because SSH is not installed in Mint.  Try installing SSH using the package manager or apt.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; From a computer on the ITC network, such as one connected to the VPN, try to SSH to port 2222 on the outside (172.17.50.xx) IP address of your Debian system. &amp;lt;/li&amp;gt;&lt;br /&gt;
:If everything was set up successfully, you should be able to sign into the Mint VM based on the port forwarding rule we have put in place.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are satisfied your firewall is running correctly you can use the following command to set these rules to automatically load each time the system is started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;firewall-cmd --runtime-to-permanent&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
When you are done testing this section of the lab please power off your new Linux Mint VM as these require far more resources to run than the Debian VMs on our servers.&amp;lt;br&amp;gt;&lt;br /&gt;
: [[File:Lab10_linux_mint_shutdown.png | link=https://wiki.ihitc.net/mediawiki/images/1/1c/Lab10_linux_mint_shutdown.png|500px]]&lt;br /&gt;
: [[Media:Lab10_linux_mint_shutdown.png | Click for larger image]]&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
For this lab there are many things you need to check.&lt;br /&gt;
&lt;br /&gt;
#Firewall - attempt to connect using FTP on port 21, this should fail&lt;br /&gt;
#SSH - connect using FTP on port 22&lt;br /&gt;
#DNS - navigate to url of server&lt;br /&gt;
#SMTP - send a mail to auto-respond server&lt;br /&gt;
#IMAP - receive a mail from auto-respond server&lt;br /&gt;
#Samba - Create a file on server using file sharing&lt;br /&gt;
#HTTP - Navigate to ip address of server&lt;br /&gt;
#Webmin - Navigate to &amp;lt;your-ip&amp;gt;:10000&lt;br /&gt;
#PuTTY into linux mint using your ip address and port 2222&lt;br /&gt;
#Linux Mint DNS/NAT - ping google.com from within Linux Mint&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Run this script to automatically check your lab&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; curl https[]()://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_10_test.py | sudo python3 &amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9538</id>
		<title>Admin instructions mail server</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9538"/>
		<updated>2021-03-02T00:43:20Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Mail Server Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Mail Server Documentation==&lt;br /&gt;
:Basic configuration of server should follow the standard class server (see labs 1 and 9)&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server, capstone group used 172.17.50.28&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install postfix, see lab 9&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9537</id>
		<title>Admin instructions mail server</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9537"/>
		<updated>2021-03-02T00:42:04Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Mail Server Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Mail Server Documentation==&lt;br /&gt;
:Basic configuration of server should follow the standard class server, see lab 1&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server, capstone group used 172.17.50.28&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install postfix, see lab 9&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9536</id>
		<title>Admin instructions mail server</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9536"/>
		<updated>2021-03-02T00:39:39Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Mail Server Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Mail Server Documentation==&lt;br /&gt;
:Basic configuration of server should follow the standard class server, see lab 1&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server, capstone group used 172.17.50.28&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9535</id>
		<title>Admin instructions mail server</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Admin_instructions_mail_server&amp;diff=9535"/>
		<updated>2021-03-02T00:38:26Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: Created page with &amp;quot;==Mail Server Documentation== :Basic configuration of server should follow the standard class server, see lab 1 &amp;lt;ol&amp;gt; &amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt; &amp;lt;li&amp;gt;Install Debian L...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Mail Server Documentation==&lt;br /&gt;
:Basic configuration of server should follow the standard class server, see lab 1&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mnjk-inver&amp;diff=9534</id>
		<title>Mnjk-inver</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mnjk-inver&amp;diff=9534"/>
		<updated>2021-03-02T00:32:43Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* List of Labs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Stylesheet=&lt;br /&gt;
&lt;br /&gt;
[[Stylesheet mnjk | Stylesheet]]&lt;br /&gt;
&lt;br /&gt;
=List of Labs=&lt;br /&gt;
&lt;br /&gt;
[[Lab 1 mnjk|Lab 1: Install Debian, check IP, remote access with ssh/sftp]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 2 mnjk|Lab 2]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 3 mnjk|Lab 3]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 4 mnjk|Lab 4]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 5 mnjk|Lab 5: Set static IP, install PHP/mySQL, experiment with websites and databases, view logfiles]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 6 mnjk|Lab 6]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 7 mnjk|Lab 7]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 8 mnjk|Lab 8]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 9 mnjk|Lab 9: Install Postfix MTA, courier-imap]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 10 mnjk|Lab 10]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 11 mnjk|Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 12 mnjk|Lab 12]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 13 mnjk|Lab 13]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 14 mnjk|Lab 14]]&lt;br /&gt;
&lt;br /&gt;
[[mail server mnjk|mail]]&lt;br /&gt;
&lt;br /&gt;
[[Admin instructions mail server|admin setup mail]]&lt;br /&gt;
&lt;br /&gt;
=Test pages=&lt;br /&gt;
&lt;br /&gt;
[[Mike mnjk|Mike]]&lt;br /&gt;
&lt;br /&gt;
[[Nate mnjk|Nate]]&lt;br /&gt;
&lt;br /&gt;
[[Jon mnjk|Jon]]&lt;br /&gt;
&lt;br /&gt;
[[Kreid mnjk|Kreid]]&lt;br /&gt;
&lt;br /&gt;
=Lab 11 Rewrites=&lt;br /&gt;
&lt;br /&gt;
[[Final Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Mike Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Nate Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Jon Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Kreid lab 11]]&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9533</id>
		<title>Lab 1 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_1_mnjk&amp;diff=9533"/>
		<updated>2021-02-28T14:52:00Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Nmap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
:In this lab you will perform the following tasks:&lt;br /&gt;
*Access NetLab to access the environment for you virtual machine&lt;br /&gt;
*Install the latest version of Debian Linux in a virtual machine&lt;br /&gt;
*Learn how to login and check the IP address of the system&lt;br /&gt;
*Learn to remotely access the system with SSH and SFTP.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/apt apt]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/sudo sudo]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/useradd adduser]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ip ip address show]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Netlab Access==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=-hLejbDfPGM&amp;amp;feature=youtu.be Video Tutorial - NetLab Access]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Connect to the ITCnet &amp;lt;/li&amp;gt; &lt;br /&gt;
: This can be accomplished by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the [[ITC_VPN_Instructions|VPN]].&lt;br /&gt;
:&#039;&#039; Note: If you want to connect using a wireless connection on campus you need to [[Connecting to Eduroam|connect to the eduroam network]] before connecting to the VPN.&lt;br /&gt;
&amp;lt;li&amp;gt; After you are connected to ITCnet (by VPN or wired connection) you simply need to open a web browser and access https://ihcc-netlab.campus.ihitc.net&amp;lt;/li&amp;gt;&lt;br /&gt;
*  The first time you visit this site in a browser you may need to accept a self-signed security certificate&lt;br /&gt;
*  You will need to log in with a username and password established by your instructor.&lt;br /&gt;
*  The first time you log in you will need to change your password and set your timezone. Make sure your timezone is set correctly so you can schedule reservations to work with equipment at convenient times.&lt;br /&gt;
&amp;lt;li&amp;gt; Once you are logged in click the blue &amp;quot;New Lab Reservation&amp;quot; button&amp;lt;/li&amp;gt;&lt;br /&gt;
: Next, in the lower left corner of the screen, select &amp;quot;Schedule a Lab for Myself&amp;quot;. Reservations are used to hold a place on the Netlab system to work on labs during a specific time. You only need reservations in this class when working with the GUI, which will come later in the class, if you need to turn the power back on to your VM, or during the installation process. The rest of the time you will be able to connect directly to your Linux server using the SSH protocol, but more on that in a bit.&lt;br /&gt;
:&#039;&#039; Note: If you are enrolled in more than one class that is using Netlab you will be presented with a list of classes you are enrolled in, click on your Linux System Administration course of you see this screen.&lt;br /&gt;
: All of our lab work in this class is done in a single &amp;quot;Lab Environment&amp;quot; and your progress will be saved from one reservation to another. As a result there is only one lab listed in this course &amp;quot;Linux System Administration Labs&amp;quot;. Click on this lab title.&lt;br /&gt;
&amp;lt;li&amp;gt; Use the calendar to choose a date, time, and specific pod to reserve for your lab activity (when you will begin your Debian server installation).&amp;lt;/li&amp;gt;&lt;br /&gt;
: The red line on this screen indicates the current time. If you want to get started right away you can click just below this line. Pay attention to the title of the column at the top, it will say something like &amp;quot;LSA Pod Z&amp;quot;. The letter at the end of this pod name is your &amp;quot;pod letter&amp;quot; which you will use to set the host name and IP address of your machine in the future so make note of it.&lt;br /&gt;
: You will be presented with a summary screen for your reservation where you can set the end time of your reservation (up to a maximum). It is suggested to make your reservation a couple hours long the first time you plan to install Debian, though you can extend it if needed. Click submit once you are ready to make the reservation.&lt;br /&gt;
&amp;lt;li&amp;gt;You will see a confirmation screen that your reservation has been made.&amp;lt;/li&amp;gt;&lt;br /&gt;
: You are now ready to progress on to the Debian Linux Installation (as long as your reservation is right away).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debian Linux Installation==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=H0DcdEytpFQ&amp;amp;feature=youtu.be Video Tutorial - Debian Linux Installation]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Log in to the Netlab system&amp;lt;/li&amp;gt;&lt;br /&gt;
: Access this using a web browser at https://ihcc-netlab.campus.ihitc.net if you are not already logged in.&lt;br /&gt;
: If you have a currently active reservation you will see a green &amp;quot;Enter Lab&amp;quot; button on your list of reservations. Click the green &amp;quot;Enter Lab&amp;quot; button. If not, you will need to make a reservation (see above) and then click the &amp;quot;Enter Lab&amp;quot; button.&lt;br /&gt;
: Your virtual machines (VMs) will automatically power on when your reservation begins and because there is no operating system currently installed to their virtual hard drives they will boot from their virtual CD/DVD drives which have been pre-loaded with the installation discs for Linux.&lt;br /&gt;
&amp;lt;li&amp;gt; Access you virtual machine console&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once you are in your pod you can either click on the image of the &amp;quot;Linux Server&amp;quot; on the topology diagram or use the tabs across the top of your screen to access the console of your Linux Server VM.&lt;br /&gt;
: The console shows the display of your VM and allows you to type and interact with your VM just as if you were physically sitting down in front of a server with a monitor, keyboard, and mouse attached. Just like a separate physical machine you will not be able to copy and paste text or drag and drop files in and out of this console window. We will use other utilities across the network connection to do those things just like we would with a physical server.&lt;br /&gt;
&amp;lt;li&amp;gt;Learn to &amp;quot;Power Cycle&amp;quot; your virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: By now your VM has likely already booted from it&#039;s virtual CD/DVD drive and should be at the &amp;quot;Debian GNU/Linux installer menu&amp;quot;. Before continuing let&#039;s practice rebooting your system so you can watch the system boot and see how to reboot the system if needed. Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power Off&amp;quot; then click the red &amp;quot;Power Off&amp;quot; button on the popup to power off your VM. This is the equivalent of just pulling out the power cord, at least until we install the VMware Tools software which allows for a graceful shutdown, so you&#039;ll want to be careful to only do this if absolutely needed until then.&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
: Click the down arrow button on the right side of the &amp;quot;Linux Server&amp;quot; tab at the top of your screen and choose &amp;quot;Power On&amp;quot;, or press the blue &amp;quot;Power On&amp;quot; button in the middle of your screen, then press the green &amp;quot;Power On&amp;quot; button to boot your system.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has rebooted and is back to the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Installing sudo and Checking Your IP Address==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=TwXp5YfAvlw&amp;amp;feature=youtu.be Video Tutorial - Installing sudo and checking your IP address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Log in to NetLab&amp;lt;/li&amp;gt;&lt;br /&gt;
: Login through the Netlab local console with your root account and password (username &#039;&#039;root&#039;&#039;, password as set during the installation)&lt;br /&gt;
:&#039;&#039; Note: When entering a password on the command line of a Linux system it is normal that nothing should appear and the cursor will not move when you are typing. This prevents someone who is able to see your computer screen from seeing what your password is or even how long it is. Just type your password and trust that the system is receiving it, press enter to submit your password.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
[[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Logging in to a Remote Terminal==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Logging into a remote terminal]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A faster way to interact with your system is not through the Netlab local console but through a remote SSH session over the network directly to your server. Once you have mastered this you will be able to copy and paste text to your Linux server and will not need to make a reservation in Netlab to work on labs. For our purposes you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Putty&amp;lt;/li&amp;gt;&lt;br /&gt;
: Assuming you are running Windows, install the PuTTY software on your home PC from [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html this website].&lt;br /&gt;
: &#039;&#039;  Note: For other operating systems there are other ways and software you can use to make an SSH connection, you will need to research what tools are used for making SSH connections from your particular operating system.&lt;br /&gt;
&amp;lt;li&amp;gt;Open an SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the PuTTY software on your computer and enter in the IP address of your VM in the &amp;quot;Host Name&amp;quot; box and click the &amp;quot;Open&amp;quot; button.&lt;br /&gt;
:[[File:Lab1_putty.png|link=https://wiki.ihitc.net/mediawiki/images/f/f5/Lab1_putty.png|500px]]&lt;br /&gt;
:[[Media:Lab1_putty.png| Click here for larger image]]&lt;br /&gt;
:* Click Yes to save the host key on your system&lt;br /&gt;
: [[File:Lab1_puttycert.png|link=https://wiki.ihitc.net/mediawiki/images/4/4b/Lab1_puttycert.png|500px]]&lt;br /&gt;
: [[Media:Lab1_puttycert.png|Click here for larger image]]&lt;br /&gt;
:* Enter the standard username and password for your Linux system to connect.&lt;br /&gt;
: &#039;&#039;  Note: You should receive a prompt just like the one you had on the Netlab local console but it is now a direct connection from your computer over the ITCnet to your server.&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Remote File Transfer==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=JEiDkrlPMNw&amp;amp;feature=youtu.be Video Tutorial - Remote File Transfer]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The easiest way to transfer files to and from your VM is with SFTP software. For our purposes, you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install FileZilla&amp;lt;/li&amp;gt;&lt;br /&gt;
: Install the FileZilla client software on your home PC from [https://filezilla-project.org/download.php?type=client this website]&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SFTP session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run FileZilla and use the Quick Connect bar at the top of the screen to access your system. &lt;br /&gt;
:*  Enter the IP address of your Linux system in the &amp;quot;Host:&amp;quot; box&lt;br /&gt;
:*  Enter your standard username and password in the appropriate boxes&lt;br /&gt;
:*  Enter &#039;&#039;22&#039;&#039; in the &amp;quot;Port:&amp;quot; box&lt;br /&gt;
:*  Click the &amp;quot;Quickconnect&amp;quot; button.&lt;br /&gt;
: [[File:Lab1_filezillanew.png|link=https://wiki.ihitc.net/mediawiki/images/b/b1/Lab1_filezillanew.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillanew.png|Click here for larger image]]&lt;br /&gt;
: You should see some connection text scroll on the top of the screen and some files on the right side of the screen now such as &#039;&#039;.bashrc&#039;&#039; and &#039;&#039;.profile&#039;&#039; The right side of the screen is the drive on your Linux system and the left side of the screen is the drive on your home system. Files and folders can be dragged between the two sides to transfer them back and forth.&lt;br /&gt;
: [[File:Lab1_filezillaconnected.png|link=https://wiki.ihitc.net/mediawiki/images/c/ca/Lab1_filezillaconnected.png|500px]]&lt;br /&gt;
: [[Media:Lab1_filezillaconnected.png|Click here for larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Close the FileZilla software to disconnect.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install VM Tools==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Install VM Tools]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect into your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Python==&lt;br /&gt;
In order to check your work in the labs of this course you will need to have an application called [https://www.python.org/ Python] installed on your Linux system.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Download &#039;&#039;python3&#039;&#039; using &#039;&#039;&#039;apt&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
* When prompted type Y to install the app and its dependencies&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&#039;&#039;NOTE: This may take a while.&#039;&#039;&amp;lt;/ul&amp;gt;&lt;br /&gt;
* When prompted to specify the name of the host where the TANGO database server is running, just select ok.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_tango.png|link=https://wiki.ihitc.net/mediawiki/images/4/4c/Python_tango.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_tango.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command to verify that python version 3.6 is installed.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;python3 --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[File:Python_version.png|link=https://wiki.ihitc.net/mediawiki/images/7/70/Python_version.png|500px]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt; [[Media:Python_version.png | Click for Larger Image]]&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Nmap==&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:* &#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the following command at the command line.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install nmap&amp;lt;/code&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Curl==&lt;br /&gt;
:Curl is a tool that lets you run scripts that are not saved to your virtual machine. It will be used to check the labs for completion while working through the course.  &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run the following command at the command line. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install curl&amp;lt;/code&amp;gt;&lt;br /&gt;
: If prompted to install additional packages type &amp;quot;y&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Close the SSH session&amp;lt;/li&amp;gt;&lt;br /&gt;
: Type &#039;&#039;&#039;exit&#039;&#039;&#039; to close the connection while leaving your VM running.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Safely Shutdown==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=gLC1liwVJ8s&amp;amp;feature=youtu.be Video Tutorial - Safely Shutdown]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
:We will normally leave our VM running but it is important that you know how to shutdown a Linux system correctly so this time we&#039;ll turn it off.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect in to your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt; Safely shutdown you server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Run the &#039;&#039;&#039;sudo shutdown -h now&#039;&#039;&#039; at the command line to safely shutdown the system.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo shutdown -h now&amp;lt;/code&amp;gt;&lt;br /&gt;
: You should soon get a message that PuTTY has lost it&#039;s connection. Click OK and then you can close the PuTTY window.&lt;br /&gt;
&amp;lt;li&amp;gt;End NetLab Reservation&amp;lt;/li&amp;gt;&lt;br /&gt;
: If you still have time left in your reservation in Netlab it&#039;s polite to end the reservation so other users can work on the system, only a limited number of reservations can be made at one time. You can do this by logging into Netlab, opening your lab, and clicking the &amp;quot;Reservation&amp;quot; menu at the top of the screen and choose to &amp;quot;End Reservation Now&amp;quot; followed by confirming that you want to end the reservation.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Checking your Work=&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt; Testing your work goes here&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; Commands to use&amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;ul&amp;gt; Description of what you should see&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_9_mnjk&amp;diff=9526</id>
		<title>Lab 9 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_9_mnjk&amp;diff=9526"/>
		<updated>2021-02-23T01:55:38Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install the Postfix MTA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Install a basic email server &lt;br /&gt;
*Install Courier MDA software&lt;br /&gt;
*Learn how to allow remote users to send mail&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/telnet telnet]&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This lab assumes that you know the IP address of your Linux system and are connected to the ITCnet VPN network.  Additionally, this lab assumes that you have completed the Bind DNS and have created a MX record that directs mail to your mail server. &lt;br /&gt;
*[[Lab_8_mnjk#Install_BIND_&amp;amp;_Enable_Caching | Installing Bind]]&lt;br /&gt;
*[[Lab_8_mnjk#Adding_a_Delegated_Domain | Creating a MX record in DNS]]&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software, login with your standard user account&lt;br /&gt;
# Make sure that webmin is installed on your system. &lt;br /&gt;
# Get the username and domain name of someone else&#039;s system in the class who you can send mail to&lt;br /&gt;
# This lab requires that you have appropriate domain name records (at least a correct A and MX record) for your system working from the DNS lab before things will work.&lt;br /&gt;
&lt;br /&gt;
== Install the Postfix MTA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=6VsgO5695Z4&amp;amp;feature=youtu.be Video Tutorial - Install Postfix MTA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use a package manager to install the &#039;&#039;postfix&#039;&#039; package.&lt;br /&gt;
* During the installation process select &#039;&#039;Internet Site&#039;&#039; as the type of mail server and set the domain name to &#039;&#039;*.itc2480.campus.ihitc.net&#039;&#039; where * is the hostname letter of your system.&amp;lt;/li&amp;gt;&lt;br /&gt;
: MTA software listens for incoming connections from other MTA servers on port 25 and accepts mail on behalf of users on the system. Once the mail is received it is stored locally for users to retrieve. The most common methods for storing messages is in an .mbox file, where all messages are stored in a single file, or in a Maildir, which is a directory where each message is stored in a separate file. The MTA also listens for connections from client software (MUA) and accepts outbound messages from them and forwards them on to the destination domain&#039;s mail server. Advanced configuration of MTA software can allow for anti-spam filtering, mailing list support or other programs to intercept and manipulate mail as it passes through the server.&lt;br /&gt;
&amp;lt;li&amp;gt;Test the connection an verify the port is open&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Use Telnet to connect to the Postfix SMTP server on port 25: &#039;&#039;&#039;telnet localhost 25&#039;&#039;&#039;&lt;br /&gt;
: [[File:Lab9_open_telnet.png|link=https://wiki.ihitc.net/mediawiki/images/1/10/Lab9_open_telnet.png|500px]]&lt;br /&gt;
: [[Media:Lab9_open_telnet.png | Click here for larger image]]&lt;br /&gt;
:* Type &#039;&#039;&#039;quit&#039;&#039;&#039; and press enter after verifying Postfix is running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Configure Maildir&amp;lt;/li&amp;gt;&lt;br /&gt;
: Because the Courier IMAP and POP3 server software only supports Maildir style message stores and Postfix stores in mbox files by default you must edit the &#039;&#039;/etc/postfix/main.cf&#039;&#039; file to fix this. &lt;br /&gt;
:* Add the line &lt;br /&gt;
:&amp;lt;pre&amp;gt;home_mailbox = Maildir/&amp;lt;/pre&amp;gt; &lt;br /&gt;
: Edit or add the &#039;&#039;mailbox_command&#039;&#039; parameter so there is nothing on the line after the equals sign, delete the portion of the line referencing procmail if it exists. The line should look like: &lt;br /&gt;
:&amp;lt;pre&amp;gt;mailbox_command = &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Restart the &#039;&#039;postfix&#039;&#039; service to apply your change. Postfix is now saving new incoming messages into the Maildir folder inside each user&#039;s home directory. This folder is automatically created by Postfix the first time a new message comes in for a user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Set your shell to recognize the maildir as your mail location&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/login.defs&#039;&#039; file and comment out the &#039;&#039;MAIL_DIR /var/mail&#039;&#039; line (place a # in front of the line) and add a line setting &#039;&#039;MAIL_FILE&#039;&#039; like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#MAIL_DIR        /var/mail&lt;br /&gt;
MAIL_FILE      Maildir/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/login&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so standard&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so standard&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/su&#039;&#039; file, find and comment out the &#039;&#039;session    optional   pam_mail.so nopen&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional   pam_mail.so nopen&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir nopen&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/pam.d/sshd&#039;&#039; file, find and comment out the &#039;&#039;session    optional     pam_mail.so standard noenv&#039;&#039; line (place a # in front of the line) and add a line like this immediately below it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#session    optional     pam_mail.so standard noenv&lt;br /&gt;
session    optional   pam_mail.so dir=~/Maildir standard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Edit the &#039;&#039;/etc/profile&#039;&#039; file and at the end of the file add the line: &amp;lt;pre&amp;gt;export MAIL=~/Maildir&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Test sending and receiving mail as a locally logged on user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Install the &#039;&#039;mailutils&#039;&#039; package.&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try sending a message (replace username with your username): &amp;lt;pre&amp;gt;echo &amp;quot;This is my message&amp;quot; | mail -s &amp;quot;Email Subject&amp;quot; username@localhost&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Log out of your SSH session and open a new SSH session to apply the changes to the &#039;&#039;/etc/profile&#039;&#039; and &#039;&#039;/etc/login.defs&#039;&#039; files.&lt;br /&gt;
:* Check to see if the message was received using the &#039;&#039;&#039;mail&#039;&#039;&#039; command, press &#039;&#039;q&#039;&#039; to return to the command line.&lt;br /&gt;
:[[File:Lab9_cli_send_mail.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab9_cli_send_mail.png|500px]]&lt;br /&gt;
:[[Media:Lab9_cli_send_mail.png|Click here for a larger image]]&lt;br /&gt;
: You should also be able to see the message in &#039;&#039;~/Maildir/&#039;&#039; in either the &#039;&#039;new/&#039;&#039; or &#039;&#039;cur/&#039;&#039; directory depending on whether you have viewed the message list yet or not. In either case, the message will appear as a text file with a random-looking name. It&#039;s just a text file so you can use &#039;&#039;&#039;cat&#039;&#039;&#039; or &#039;&#039;&#039;less&#039;&#039;&#039; to view it.&lt;br /&gt;
&amp;lt;li&amp;gt; Create Aliases &amp;lt;/li&amp;gt;&lt;br /&gt;
: You can create aliases and forward mail between users by editing the &#039;&#039;/etc/aliases&#039;&#039; file and then running the &#039;&#039;&#039;newaliases&#039;&#039;&#039; program. &lt;br /&gt;
:* Create an &amp;quot;alias&amp;quot; for &#039;&#039;sysadmin&#039;&#039; which forwards mail sent to sysadmin@localhost to your username &lt;br /&gt;
:* Send a copy of all mail to the &#039;&#039;root&#039;&#039; account to your username &lt;br /&gt;
&lt;br /&gt;
: Now would be a good time to try logging on to Webmin again, re-scanning for modules and then taking a look at the Postfix module in the &#039;&#039;Servers&#039;&#039; section.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the mail log file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at your &#039;&#039;/var/log/mail.info&#039;&#039; log to see Postfix sending and receiving messages for users.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install Courier MDA ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=uvZlSiQHlxs&amp;amp;feature=youtu.be Video Tutorial - Install Courier MDA]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install required courier packages &amp;lt;/li&amp;gt;&lt;br /&gt;
: Most users prefer to retrieve mail from a mail server using an MDA protocol like POP3 or IMAP which can be provided by the Courier programs. Install the &#039;&#039;courier-pop&#039;&#039;, &#039;&#039;courier-imap&#039;&#039;, and &#039;&#039;fam&#039;&#039; packages.&lt;br /&gt;
:* Do not create the directories for web-based administration as they are unneeded for our setup&lt;br /&gt;
: Local users accessing their mailbox with MUA software can read and write to the .mbox file or Maildir directly. If a user not locally logged on to the system wants to access their mailbox the server runs MDA software which typically uses the POP3 or IMAP protocol for accessing the .mbox file or Maildir remotely.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Install MUA Client on remote system&amp;lt;/li&amp;gt;&lt;br /&gt;
:*Install an email client (MUA) on your host (home) system such as [http://www.mozilla.org/en-US/thunderbird/ Mozilla Thunderbird]&lt;br /&gt;
:* Setup two user accounts in your MUA, the usernames and passwords should be the same as users and their passwords on your system. Use &#039;&#039;IMAP&#039;&#039; as the protocol for retrieving mail. The email address for each should be &#039;&#039;username@*.itc2480.campus.ihitc.net&#039;&#039; where the * is replaced by the host letter of your system. You can verify the IMAP and SMTP settings that are detected, both server addresses should be &#039;&#039;*.itc2480.campus.ihitc.net&#039;&#039; where the * is replaced by the host letter of your system.&lt;br /&gt;
:&#039;&#039; NOTE: The first time you check messages and the first time you send messages to your server from Thunderbird you will need to accept an invalid security certificate in the Thunderbird window.&lt;br /&gt;
:[[File:Lab9_thunderbird_cert.png|link=https://wiki.ihitc.net/mediawiki/images/9/9a/Lab9_thunderbird_cert.png|500px]]&lt;br /&gt;
:[[Media:Lab9_thunderbird_cert.png|Click here for a larger image]]&lt;br /&gt;
:&#039;&#039; NOTE: To see the &#039;&#039;Tools&#039;&#039; menu with the &#039;&#039;Account Settings&#039;&#039; window in recent versions of Thunderbird (where you can add more accounts) you need to press ALT-F and then the menu bar will temporarily appear.&lt;br /&gt;
:[[File:Lab9_thunderbird_menu.png|link=https://wiki.ihitc.net/mediawiki/images/6/60/Lab9_thunderbird_menu.png|500px]]&lt;br /&gt;
:[[Media:Lab9_thunderbird_menu.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Send mail between local users&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try sending a message from one user to the other user by sending a message to the other account like &#039;&#039;username@localhost&#039;&#039; Verify that you can receive and read the messages.&lt;br /&gt;
:* Note: If a user has not yet received any mail Postfix has not created a Maildir for the user and the Courier software will send an error to the client software. Use the mail program explained above to send some mail to the user, see that the &#039;&#039;~/Maildir&#039;&#039; is then created and try retrieving the messages again with your MUA.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Allow Remote Users to Send Mail ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=0qh3mCMIzn4&amp;amp;feature=youtu.be Video tutorial - Allow Remote Users to Send Mail]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Testing SMTP mail to another domain&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Try setting up your MUA software to send mail by creating an SMTP server entry and sending an email to &#039;&#039;anotheruser@localhost&#039;&#039; This should work because localhost is your own server but if you try sending email to &#039;&#039;someuser@somedomain.com&#039;&#039; like &#039;&#039;root@ben.itc2480.campus.ihitc.net&#039;&#039; that will fail.&lt;br /&gt;
: The problem is you don&#039;t want just anyone to send mail through your mailserver (we did allow this in the olden days) because a spammer could then use your server to send mail worldwide and it would all trace back to the IP of your server, we call servers setup like this &amp;quot;open relays&amp;quot; because they relay mail for anyone and they are generally considered very bad practice and can get your mailserver on lists of servers to ignore all messages from. There are a number of ways to solve this. By default Postfix will only allow mail relaying from computers on the same network (based on IP) as set in the &#039;&#039;/etc/postfix/main.cf&#039;&#039; &#039;&#039;mynetworks&#039;&#039; parameter but this is inconvenient for remote users as you would need to know the remote IP address they are connecting from. The SASL protocol allows users to authenticate with a username and password before sending mail and then relay messages are accepted from them.&lt;br /&gt;
&amp;lt;li&amp;gt;Configure Simple Autherntication and Security Layer - SASL&amp;lt;/li&amp;gt;&lt;br /&gt;
:* See if you can follow [https://wiki.debian.org/PostfixAndSASL these instructions] for setting up SASL with Postfix.&lt;br /&gt;
:&#039;&#039; Note: You do NOT need to setup TLS to support SASL (more on that in the additional considerations section below)&lt;br /&gt;
&amp;lt;li&amp;gt;Test and troubleshoot SASL&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Modify your MUA to use a username and password when connecting to your SMTP server and try sending mail to someone else&#039;s system from your MUA using a destination address like &#039;&#039;root@*.itc2480.campus.ihitc.net&#039;&#039; where the * is replaced by the host letter of your system.&lt;br /&gt;
:&#039;&#039; NOTE: You MUST actually exchange messages with someone else in the class (both sending to them and receiving from them). It is not possible to test using an outside email account of your own (you will not be able to send a message back to your server because it is behind a firewall). It is not enough to just be able to send a message to another system. It is not enough to just be able to receive a message from another user.&lt;br /&gt;
:* Troubleshoot as needed using the mail log files on your system.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Additional Considerations=&lt;br /&gt;
Running a mailserver is tricky business. The basic server we have setup does not use valid certificates for encrypting connections meaning usernames, passwords, and mail contents are all being sent to an unverified server. This is very undesirable from a security standpoint and it would be suggested to support SSL/TLS encryption for both the MTA and MDA portions with a valid certificate purchased from a certificate authority (CA) or from a free CA like [https://letsencrypt.org/ Let&#039;s Encrypt]. In addition, you will almost certainly want spam filtering at the server. More complicated setups also use database tables for users, passwords and domains so that you can host multiple domains on a single server and have email user boxes for people who do not have local logins on the system.&lt;br /&gt;
&lt;br /&gt;
=Additional Resources=&lt;br /&gt;
* [https://help.ubuntu.com/community/PostfixBasicSetupHowto Ubuntu Postfix Basic Setup]&lt;br /&gt;
* [https://wiki.debian.org/Postfix Debian Wiki - Postfix Installation]&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9521</id>
		<title>Lab 5 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9521"/>
		<updated>2021-02-20T12:42:11Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* View Logfiles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Learn about static network configuration of Debian Linux systems&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net PHP]&#039;&#039;&#039;&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net MariaDB]&#039;&#039;&#039; on your server, this is an open-source MySQL alternative&lt;br /&gt;
*Experiment with websites and databases&lt;br /&gt;
*Explore the standard log files on your system.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifup ifup]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifdown ifdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ping ping]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2ensite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2dissite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/wget wget]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/zcat zcat]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/service service]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/tail tail]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will also use the following MySQL (MariaDB) commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/use USE]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/show SHOW]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/select SELECT]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/drop-database DROP database]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software, login with your standard user account&lt;br /&gt;
# Make a note of the static IP address information for your particular system in the table below, it is based on the system name identification letter in vmWare. These IP addresses will ONLY be valid in the ITC vmWare Linux class subnet. If you are working on a local VirtualBox system you will need to select an available static IP from the correct subnet for your system or skip the static IP addressing section. All vmWare systems will use a gateway address of 172.17.50.1 and a subnet mask of 255.255.255.0 with two nameservers 172.17.139.11 and 172.17.139.111&lt;br /&gt;
{| {{table}}&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;System ID&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Static IP&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| A||172.17.50.11&lt;br /&gt;
|-&lt;br /&gt;
| B||172.17.50.12&lt;br /&gt;
|-&lt;br /&gt;
| C||172.17.50.13&lt;br /&gt;
|-&lt;br /&gt;
| D||172.17.50.14&lt;br /&gt;
|-&lt;br /&gt;
| E||172.17.50.15&lt;br /&gt;
|-&lt;br /&gt;
| F||172.17.50.16&lt;br /&gt;
|-&lt;br /&gt;
| G||172.17.50.17&lt;br /&gt;
|-&lt;br /&gt;
| H||172.17.50.18&lt;br /&gt;
|-&lt;br /&gt;
| I||172.17.50.19&lt;br /&gt;
|-&lt;br /&gt;
| J||172.17.50.20&lt;br /&gt;
|-&lt;br /&gt;
| K||172.17.50.21&lt;br /&gt;
|-&lt;br /&gt;
| L||172.17.50.22&lt;br /&gt;
|-&lt;br /&gt;
| M||172.17.50.23&lt;br /&gt;
|-&lt;br /&gt;
| N||172.17.50.24&lt;br /&gt;
|-&lt;br /&gt;
| O||172.17.50.25&lt;br /&gt;
|-&lt;br /&gt;
| P||172.17.50.26&lt;br /&gt;
|-&lt;br /&gt;
| Q||172.17.50.27&lt;br /&gt;
|-&lt;br /&gt;
| R||172.17.50.28&lt;br /&gt;
|-&lt;br /&gt;
| S||172.17.50.29&lt;br /&gt;
|-&lt;br /&gt;
| T||172.17.50.30&lt;br /&gt;
|-&lt;br /&gt;
| U||172.17.50.31&lt;br /&gt;
|-&lt;br /&gt;
| V||172.17.50.32&lt;br /&gt;
|-&lt;br /&gt;
| W||172.17.50.33&lt;br /&gt;
|-&lt;br /&gt;
| X||172.17.50.34&lt;br /&gt;
|-&lt;br /&gt;
| Y||172.17.50.35&lt;br /&gt;
|-&lt;br /&gt;
| Z||172.17.50.36&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set a static IP==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=VcPA6gJ0Ohw&amp;amp;feature=youtu.be Video Tutorial - Setting a Static IP Address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
:&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install PHP &amp;amp; MySQL/MariaDB==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=Az0qtg4LSjA&amp;amp;feature=youtu.be Video Tutorial -  Install PHP and MySQL MariaDB]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install packages&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using &#039;&#039;&#039;apt&#039;&#039;&#039;, install the &#039;&#039;php&#039;&#039; and &#039;&#039;mariadb-server&#039;&#039; packages as well as the &#039;&#039;php-mysql&#039;&#039; package which provides the link between php and mysql and the &#039;&#039;libapache2-mod-php&#039;&#039; package which provides a copy of PHP which allows the Apache webserver to run website PHP scripts.&lt;br /&gt;
&#039;&#039; Note: Remember to do an &#039;&#039;&#039;apt update&#039;&#039;&#039; before installing packages to make sure you get the latest versions&lt;br /&gt;
&#039;&#039; Note: Maria-DB is a fully compatible replacement for MySQL that isn&#039;t controlled by Oracle.&lt;br /&gt;
* After the dependencies are found, go ahead and accept them to continue the install.&lt;br /&gt;
&amp;lt;li&amp;gt; After the install is complete, &#039;&#039;&#039;cd&#039;&#039;&#039; to &#039;&#039;/var/www/html&#039;&#039; which is the root directory of your webserver and so where all website files are served from.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; In order to fully enable the PHP-MySQL module you should restart your Apache webserver. You don&#039;t need to restart your entire system to do this. Do some research on the &amp;quot;apache2ctl&amp;quot; or the &amp;quot;service apache2&amp;quot;  commands which can be used to do this.&lt;br /&gt;
&amp;lt;li&amp;gt; At this point we will test to verify that php is working properly with Apache. Create a new file named &#039;&#039;phptest.php&#039;&#039;, and then open it in a text editor.&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039; Note: you may have to use sudo to create and edit files in this directory.  as your standard user account may not have privilidges to create and edit files in this directory.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo touch phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Enter the following into the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;?php&lt;br /&gt;
phpinfo();&lt;br /&gt;
?&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Now save the file, and on your local machine go to xxx.xxx.xxx.xxx/phptest.php in a web browser where xxx.xxx.xxx.xxx is your VM&#039;s static IP. You should now be on a page that shows your PHP Version, and system information.&amp;lt;/li&amp;gt; &lt;br /&gt;
:[[File:Lab5_php_info.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Use the &amp;quot;View Source&amp;quot; option in your browser to see what the HTML source code is for the page you&#039;re viewing is. Is it the same or different than the .php file you created? Why? How is this different than a standard .html file?&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Lab5_php_info_devtab.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info_devtab.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Website PHP==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=m_sUrt_quX4&amp;amp;feature=youtu.be Video Tutorial - Experiment with Website PHP]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore Apache symlinks&amp;lt;/li&amp;gt;&lt;br /&gt;
:In a previous lab we learned about editing the &#039;&#039;/var/www/index.html&#039;&#039; file to change the default web page displayed by your server. In a future lab you will install some PHP/MySQL based software which powers many Internet sites with forums, blogs, etc. Before we can do that we need to learn a little more about PHP and about databases. Like most software on Linux the Apache webserver configuration files are stored in the &#039;&#039;/etc&#039;&#039; directory. Specifically, you can find several of them which work together and are called from each other in &#039;&#039;/etc/apache2/&#039;&#039; take a look in the &#039;&#039;/etc/apache2/sites-enabled/&#039;&#039; directory. See how symlinks are used to point to configuration files which actually reside in the &#039;&#039;/etc/apache2/sites-available/&#039;&#039; directory? This allows us to turn off and on various sites by creating or removing a symlink rather than by deleting the actual configuration file, a handy thing if we just want to temporarily disable a site. In fact Apache provides a utility to automatically add and remove these links called &#039;&#039;&#039;a2ensite&#039;&#039;&#039; and &#039;&#039;&#039;a2dissite&#039;&#039;&#039;. Check the &#039;&#039;&#039;man&#039;&#039;&#039; pages for these commands to see how they work.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore &#039;&#039;&#039;/etc/apche2/sites-enabled&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:As you might have guessed the default site for your system is configured by the file linked to at &#039;&#039;/etc/apache2/sites-enabled/000-default&#039;&#039; If you open this file in your favorite text editor you will see a series of what Apache calls &amp;quot;directives&amp;quot; which explain how the webserver should function, what port it should listen on, where the website files will reside (&#039;&#039;/var/www/html&#039;&#039;), etc. &lt;br /&gt;
:&#039;&#039; NOTE: Going into all of the different Apache directives is outside of the scope of this course but you will find a lot of documentation about them on the Internet.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the Apache configuration files in Webmin&amp;lt;/li&amp;gt;&lt;br /&gt;
:In addition to configuring Apache directly through it&#039;s configuration files you can also configure it through an interface like Webmin which we installed in a previous lab. Bring up the Webmin configuration page for Apache and take a look at the settings for the default site. Note how the things you saw directly in the configuration file match up with what you see in Webmin. One of the things you may be interested in seeing is how the webserver knows to display the index.html file from a directory if it exists and no specific file is requested in the URL. Take a look on the &amp;quot;Directory Indexing&amp;quot; page for the default virtualhost and see if you can find this information. You&#039;ll notice that there is a list of files, not just index.html which the server will display.&lt;br /&gt;
:&#039;&#039; NOTE: You may need to refresh your Webmin modules or &amp;quot;scan for new modules&amp;quot; if you haven&#039;t done that since installing Apache and Webmin. Webmin scans your system for compatible server software packages (like Apache) when it is installed but needs to re-scan it&#039;s modules after you install new server software before you can configure it through Webmin.&lt;br /&gt;
&amp;lt;li&amp;gt;Expiriment with and learn PHP basics&amp;lt;/li&amp;gt;&lt;br /&gt;
:In another section of this lab you created a basic &#039;&#039;phptest.php&#039;&#039; file and saw how the server executed the PHP code and turned it into an HTML page your browser could display. Because PHP offers an easy way to write web applications it powers much of the Internet. To prepare us for setting up some PHP applications in a future lab it will be helpful to know a little about how PHP scripts work. Read through the [http://www.w3schools.com/php/default.asp W3 Schools PHP Basics Tutorial] (PHP Intro through PHP Superglobals) and try creating some PHP scripts on your own Linux server like the examples given in the tutorial pages to see if you can get them to run, try modifying them a little bit and see what the results are. There are many great Internet resources devoted to understanding how to do things with PHP so take some time to see how this language can be easily integrated in websites. You should definitely be familiar with editing PHP files to change variables, echo statements, etc. work which are all skills you&#039;ll need when installing PHP based website software.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own PHP files&amp;lt;/li&amp;gt;&lt;br /&gt;
:*Try writing some simple PHP scripts on your own using variables and echo statements and make them available through your webserver.&lt;br /&gt;
:*A good place to create these would be in your home directory, using your favorite text editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own &amp;quot;home&amp;quot; page by editing your &#039;&#039;index.html&#039;&#039; file located in the &#039;&#039;&#039;/var/www/html&#039;&#039;&#039; directory.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You will need to be familiar with the very basics of editing HTML files in order to create links, etc. If you haven&#039;t done this before there are many introductory HTML tutorials available online.  A good starting place is [https://www.w3schools.com/html/html_basic.asp W3 Schools HTML Basics Examples]&lt;br /&gt;
:&#039;&#039; NOTE:It is importatnt to know that an &#039;&#039;&#039;html&#039;&#039;&#039; file must include the &amp;lt;!DOCTYPE HTML&amp;gt; tag.  Additionally, you will notice that all tags have an opening tag and a closing tag.  The information between the tags is what will have the features of the tag&lt;br /&gt;
:*Backup your &#039;&#039;index.html&#039;&#039; file by copying to a new file name.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo cp /var/www/html/index.html /var/www/html/index.html.bak&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Edit your &#039;&#039;index.html&#039;&#039; file (or create a new &#039;&#039;index.php&#039;&#039; file which will be loaded instead if it exists) so there is a list and links to the various scripts you have created as part of your PHP experimentation.&lt;br /&gt;
:* Open your index.html file in your favorite text editor,&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano /var/www/html/index.html&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Since you have backed up the original index.html file I would edit this file to only include the basics.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;My ITC-2480 Server&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;This is a server on Pod-R in NetLab at 172.17.50.XX&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Here are some of the Projects I am working on:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;http://172.17.50.XX/phptest.php&amp;quot;&amp;gt;PHP Version Information&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Make sure to replace the XX in the IP with the IP address of your server.&lt;br /&gt;
:&lt;br /&gt;
:[[File:Lab5_basic_html.png|link=https://wiki.ihitc.net/mediawiki/images/2/29/Lab5_basic_html.png|500px]]&lt;br /&gt;
:[[Media:Lab5_basic_html.png|Click here for a larger image]]&lt;br /&gt;
:A first look for a basic page&lt;br /&gt;
:[[File:Lab5_initial_home.png|link=https://wiki.ihitc.net/mediawiki/images/9/92/Lab5_initial_home.png|500px]]&lt;br /&gt;
:[[Media:Lab5_initial_home.png|Click for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Try to add additional features to your &amp;quot;home&amp;quot; page.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You may get some ideas of features you might like to add by looking at the original &#039;&#039;index.html&#039;&#039; file that we backed up in step 6 of this lab.&lt;br /&gt;
:*As you complete your labs consider what you can add to this page.&lt;br /&gt;
:*Add links to the PHP scripts you created&lt;br /&gt;
:*A few good chalanges would be to add a title, change font size, style or color.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Databases==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=1zYXiWLoGdM&amp;amp;feature=youtu.be Video Tutorial - Experiment with Databases]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: In order to do really powerful things with a website we need a database where we can store dynamic content which can be queried to automatically build site pages from a template. One of the most common databases is an SQL database, and MySQL has long been the most prevalent Linux SQL software. These days MariaDB, which we installed, has been taking some MySQL marketshare because it is a community developed program instead of MySQL which is now owned by Oracle. The MariaDB software and MySQL software are essentially equivalent, especially for small sites/databases, and the same commands are used interchangeably including using the &#039;&#039;&#039;mysql&#039;&#039;&#039; command to access them. SQL itself is a standard language for interacting with a specific type of database called a relational database, we&#039;ll see why it&#039;s called a relational database in a minute. Each database is a collection of data stored in tables. You can think of a table as something like a spreadsheet with rows and columns, except we call the columns fields and the rows records (sometimes we actually call them rows too). The different tables are often related to one another, of course they are usually being used by the same web application, but usually the relationship goes deeper than that as we&#039;ll see in a little bit.&lt;br /&gt;
&amp;lt;li&amp;gt;Download a sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To jumpstart our exploration of databases we&#039;ll download a pre-built sample database with a few tables and many records already in it and import it into our MySQL database server. Download the employees database file [https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2 employees_db-full-1.0.6.tar.bz2] (about 26MB) and get it into your home directory. Instead of using the &#039;&#039;&#039;links&#039;&#039;&#039; browser to do this or downloading to your computer and then pushing this large file back across the Internet with an SCP/SFTP client like FileZilla a better choice might be to learn about the &#039;&#039;&#039;wget&#039;&#039;&#039; program which can be used like &amp;quot;&#039;&#039;&#039;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&#039;&#039;&#039;&amp;quot; to download the file into your current working directory.&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Unpack the database file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Figure out how to use the &#039;&#039;&#039;tar&#039;&#039;&#039; program to unpack this .tar.bz2 file. Note that this file uses bz2 compression which takes longer to compress than gzip but can compress the files more. Once unpacked you should have an &amp;quot;employees_db&amp;quot; folder.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the files included with sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: Inside the &#039;&#039;employees_db&#039;&#039; folder you should have a number of &#039;&#039;.sql&#039;&#039; script files and dump files which can be used to restore the database to your system.&lt;br /&gt;
:*Take a look at the &#039;&#039;employees.sql&#039;&#039; file, it&#039;s just a text file, which describes the format of the database. &lt;br /&gt;
:*Also take a look at the &#039;&#039;load_employees.dump&#039;&#039; file, also just a text file, which contains all of the records from the employees table of the database. :&#039;&#039; NOTE: there are 300,000 some employee records in this database so you probably don&#039;t want to just use &#039;&#039;&#039;cat&#039;&#039;&#039; to view these files as it could take a while to print them out to your screen. Using the &#039;&#039;&#039;less&#039;&#039;&#039; program would be a better choice as it will allow you to exit viewing the file by pressing q at any time.&lt;br /&gt;
&amp;lt;li&amp;gt;Open the MySQL (MariaDB) command line&amp;lt;/li&amp;gt;&lt;br /&gt;
: We can interact with the MySQL/MariaDB server in many different ways. The first way we&#039;ll take a look at is through the command line &#039;&#039;&#039;mysql&#039;&#039;&#039; program. Run the &amp;quot;&#039;&#039;&#039;sudo mysql&#039;&#039;&#039;&amp;quot; command. &lt;br /&gt;
:&#039;&#039; NOTE: that we are running this command with system administrator permissions which allows us to log in to the MySQL server with database administrator permissions as well. The MySQL program actually stores it&#039;s own usernames and passwords as a MySQL database itself, you can create and modify these permissions from the mysql command line but we&#039;ll learn more about modifying them through the Webmin interface later.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo MySQL&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_cli.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab5_mariadb_cli.png|500px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_cli.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Explore MySQL (MariaDB) Commands&amp;lt;/li&amp;gt;&lt;br /&gt;
: MySQL has it&#039;s own command line language the you can use through the &amp;quot;mysql&amp;gt;&amp;quot; prompt you are now running. For example, if we want to see a list of databases on the system we can run &amp;quot;&#039;&#039;&#039;SHOW databases;&#039;&#039;&#039;&amp;quot; run the command and note the databases that already exist by default.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW databases;&amp;lt;/code&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Each MySQL/MariaDB statement ends with a semicolon (;) if you do not put the semicolon at the end of the line the command will not execute when you press enter and you will be able to continue to add more commands to the statement before finishing with a semicolon. If you accidentally press enter without ending with a semicolon you can just enter a semicolon on the next line and press enter.&lt;br /&gt;
&amp;lt;li&amp;gt;Import the sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To import the employee database we can use the &amp;quot;&#039;&#039;&#039;source employees.sql;&#039;&#039;&#039;&amp;quot; command (assuming we were already working in the directory which contains the employees.sql file when we launched mysql. Import the employee database and verify the system now has an employees database.&lt;br /&gt;
&amp;lt;code&amp;gt;SOURCE employees.sql;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the employees database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;USE employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
: If we want to see all of the tables in the employees database we must first select the database we want to work on using the &amp;quot;&#039;&#039;&#039;USE employees;&#039;&#039;&#039;&amp;quot; command.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the employee table&amp;lt;/li&amp;gt;&lt;br /&gt;
: Use the &amp;quot;&#039;&#039;&#039;SHOW tables;&#039;&#039;&#039;&amp;quot; command to see a list of tables.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW tables;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View a list of employees in table&amp;lt;/li&amp;gt;&lt;br /&gt;
: To see a list of all the records in a table we need to run a SELECT query &amp;quot;&#039;&#039;&#039;SELECT * from &#039;&#039;&amp;lt;tablename&amp;gt;&#039;&#039;&#039;&#039;&#039;&amp;quot; like &amp;quot;&#039;&#039;&#039;SELECT * from employees&#039;&#039;&#039;&amp;quot; which will list all the records in the &#039;&#039;employees&#039;&#039; table of the employees database and display them.&lt;br /&gt;
&amp;lt;code&amp;gt;SELECT * from employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_show_tables.png|link=https://wiki.ihitc.net/mediawiki/images/d/d5/Lab5_mariadb_show_tables.png|350px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_show_tables.png|Click here for a larger image]]&lt;br /&gt;
:* Remember that we previously selected to USE the &#039;&#039;employees&#039;&#039; database, this will be remembered until we USE a different database. Try displaying the records in a couple of different tables like employees and departments.&lt;br /&gt;
:&#039;&#039; NOTE: The output can be broken by using CTRL-C on your local machine if you do not wish to wait for all of the records to be displayed.&lt;br /&gt;
:&lt;br /&gt;
: There is much more that we can do from the MySQL/MariaDB command line but that would be a whole class or more itself. The MySQL/MariaDB programs are well documented on the Internet and with these basic skills you should be able to figure out most of it. Remember, the vast majority of what you read about MySQL will also work in MariaDB and vice-versa.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the MySQL interface in Webmin&lt;br /&gt;
: Now that you have learned a bit about MySQL databases from the command line let&#039;s see how they look in the Webmin web management interface. Log back in to your Webmin interface through a browser on your host system.&lt;br /&gt;
:* Because MySQL was not installed when we first setup Webmin you need to &amp;quot;scan for new modules&amp;quot; first. Once that process has finished refresh the page to see that MySQL has been added to the server section of Webmin.&lt;br /&gt;
:* Take a look at the Webmin MySQL module and see how MySQL users and permissions are configured.&lt;br /&gt;
:* Try browsing through the &#039;&#039;employees&#039;&#039; database using the Webmin interface including viewing tables and records inside of the tables.&lt;br /&gt;
&amp;lt;li&amp;gt;Drop database and exit MySQL (MariaDB)&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Go back to your MySQL command line window and run the command &amp;quot;&#039;&#039;&#039;DROP DATABASE employees;&#039;&#039;&#039;&amp;quot; to delete the entire database.&lt;br /&gt;
:* Type &amp;quot;&#039;&#039;&#039;exit;&#039;&#039;&#039;&amp;quot; to quit the MySQL program and return to a Linux shell.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039; NOTE: Obviously, the DROP command is one to be careful with as you can easily wipe out a huge database with one line! &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==View Logfiles==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=cxIOQF-eMy0&amp;amp;feature=youtu.be Video Tutorial - Tutorial 5 View Logfiles]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: Linux stores most of log files in the &#039;&#039;/var/log&#039;&#039; directory so change your working directory to &#039;&#039;/var/log&#039;&#039;.&lt;br /&gt;
: Some log files are viewable by all users on the system but other log files may be restricted and you will need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to view them.&lt;br /&gt;
&amp;lt;li&amp;gt;View last 20 lines in &#039;&#039;&#039;/var/log/syslog&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;tail -20 /var/log/syslog&amp;lt;/code&amp;gt;&lt;br /&gt;
:[[File:Lab5_tail.png|link=https://wiki.ihitc.net/mediawiki/images/8/88/Lab5_tail.png|500px]]&lt;br /&gt;
:[[Media:Lab5_tail.png|Click here for a larger image]]&lt;br /&gt;
: Linux log files are typically standard text files and can be read with standard text file utilities like cat or less. One additional utility which comes in hand is the &#039;&#039;&#039;tail&#039;&#039;&#039; program which displays the last 10 lines (by default) of a text file and which can be configured to display more or less lines using a command like &#039;&#039;&#039;tail -20 /var/log/syslog&#039;&#039;&#039; which will display the last 20 lines of the main system log file. The manual page for the &#039;&#039;&#039;tail&#039;&#039;&#039; command contains additional information like how to use the &#039;&#039;-f&#039;&#039; option to view a log in realtime (exit with Ctrl-C).&lt;br /&gt;
&amp;lt;li&amp;gt;Save the tail output to a file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Often we may want to save the output from a &#039;&#039;&#039;tail&#039;&#039;&#039; command to share with others or document an issue.  This can easily be done using redirection we learned in a previous lab.  Experiment with how to save some tail commands.  Keep in mind you may need to escalate privileges for some files to be redirected.  Try the following:&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo tail -20 /var/log/syslog &amp;gt; logtail.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Explore some other log files&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at some of the log files on your system and see what kinds of information they contain specifically you should probably look at &#039;&#039;syslog&#039;&#039;, &#039;&#039;auth.log&#039;&#039;, &#039;&#039;kern.log&#039;&#039;, &#039;&#039;apache2/access.log&#039;&#039;, and &#039;&#039;apache2/error.log&#039;&#039; &lt;br /&gt;
:* Use the tail command to explore these logs&lt;br /&gt;
: In order to prevent log files from completely filling your drive old log files are eventually rotated on the system and compressed and then finally deleted. Take a look at some of the rotated log files like &#039;&#039;/var/log/syslog.1&#039;&#039; or &#039;&#039;/var/log/kern.log.1&#039;&#039; which will contain slightly older log entries.&lt;br /&gt;
:&#039;&#039; Note: After the first rotated file other files are usually compressed with gzip. You can decompress and view these on the fly using the &#039;&#039;&#039;zcat&#039;&#039;&#039; program.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9520</id>
		<title>Lab 5 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9520"/>
		<updated>2021-02-20T12:40:03Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* View Logfiles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Learn about static network configuration of Debian Linux systems&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net PHP]&#039;&#039;&#039;&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net MariaDB]&#039;&#039;&#039; on your server, this is an open-source MySQL alternative&lt;br /&gt;
*Experiment with websites and databases&lt;br /&gt;
*Explore the standard log files on your system.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifup ifup]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifdown ifdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ping ping]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2ensite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2dissite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/wget wget]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/zcat zcat]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/service service]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/tail tail]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will also use the following MySQL (MariaDB) commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/use USE]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/show SHOW]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/select SELECT]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/drop-database DROP database]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software, login with your standard user account&lt;br /&gt;
# Make a note of the static IP address information for your particular system in the table below, it is based on the system name identification letter in vmWare. These IP addresses will ONLY be valid in the ITC vmWare Linux class subnet. If you are working on a local VirtualBox system you will need to select an available static IP from the correct subnet for your system or skip the static IP addressing section. All vmWare systems will use a gateway address of 172.17.50.1 and a subnet mask of 255.255.255.0 with two nameservers 172.17.139.11 and 172.17.139.111&lt;br /&gt;
{| {{table}}&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;System ID&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Static IP&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| A||172.17.50.11&lt;br /&gt;
|-&lt;br /&gt;
| B||172.17.50.12&lt;br /&gt;
|-&lt;br /&gt;
| C||172.17.50.13&lt;br /&gt;
|-&lt;br /&gt;
| D||172.17.50.14&lt;br /&gt;
|-&lt;br /&gt;
| E||172.17.50.15&lt;br /&gt;
|-&lt;br /&gt;
| F||172.17.50.16&lt;br /&gt;
|-&lt;br /&gt;
| G||172.17.50.17&lt;br /&gt;
|-&lt;br /&gt;
| H||172.17.50.18&lt;br /&gt;
|-&lt;br /&gt;
| I||172.17.50.19&lt;br /&gt;
|-&lt;br /&gt;
| J||172.17.50.20&lt;br /&gt;
|-&lt;br /&gt;
| K||172.17.50.21&lt;br /&gt;
|-&lt;br /&gt;
| L||172.17.50.22&lt;br /&gt;
|-&lt;br /&gt;
| M||172.17.50.23&lt;br /&gt;
|-&lt;br /&gt;
| N||172.17.50.24&lt;br /&gt;
|-&lt;br /&gt;
| O||172.17.50.25&lt;br /&gt;
|-&lt;br /&gt;
| P||172.17.50.26&lt;br /&gt;
|-&lt;br /&gt;
| Q||172.17.50.27&lt;br /&gt;
|-&lt;br /&gt;
| R||172.17.50.28&lt;br /&gt;
|-&lt;br /&gt;
| S||172.17.50.29&lt;br /&gt;
|-&lt;br /&gt;
| T||172.17.50.30&lt;br /&gt;
|-&lt;br /&gt;
| U||172.17.50.31&lt;br /&gt;
|-&lt;br /&gt;
| V||172.17.50.32&lt;br /&gt;
|-&lt;br /&gt;
| W||172.17.50.33&lt;br /&gt;
|-&lt;br /&gt;
| X||172.17.50.34&lt;br /&gt;
|-&lt;br /&gt;
| Y||172.17.50.35&lt;br /&gt;
|-&lt;br /&gt;
| Z||172.17.50.36&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set a static IP==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=VcPA6gJ0Ohw&amp;amp;feature=youtu.be Video Tutorial - Setting a Static IP Address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
:&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install PHP &amp;amp; MySQL/MariaDB==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=Az0qtg4LSjA&amp;amp;feature=youtu.be Video Tutorial -  Install PHP and MySQL MariaDB]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install packages&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using &#039;&#039;&#039;apt&#039;&#039;&#039;, install the &#039;&#039;php&#039;&#039; and &#039;&#039;mariadb-server&#039;&#039; packages as well as the &#039;&#039;php-mysql&#039;&#039; package which provides the link between php and mysql and the &#039;&#039;libapache2-mod-php&#039;&#039; package which provides a copy of PHP which allows the Apache webserver to run website PHP scripts.&lt;br /&gt;
&#039;&#039; Note: Remember to do an &#039;&#039;&#039;apt update&#039;&#039;&#039; before installing packages to make sure you get the latest versions&lt;br /&gt;
&#039;&#039; Note: Maria-DB is a fully compatible replacement for MySQL that isn&#039;t controlled by Oracle.&lt;br /&gt;
* After the dependencies are found, go ahead and accept them to continue the install.&lt;br /&gt;
&amp;lt;li&amp;gt; After the install is complete, &#039;&#039;&#039;cd&#039;&#039;&#039; to &#039;&#039;/var/www/html&#039;&#039; which is the root directory of your webserver and so where all website files are served from.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; In order to fully enable the PHP-MySQL module you should restart your Apache webserver. You don&#039;t need to restart your entire system to do this. Do some research on the &amp;quot;apache2ctl&amp;quot; or the &amp;quot;service apache2&amp;quot;  commands which can be used to do this.&lt;br /&gt;
&amp;lt;li&amp;gt; At this point we will test to verify that php is working properly with Apache. Create a new file named &#039;&#039;phptest.php&#039;&#039;, and then open it in a text editor.&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039; Note: you may have to use sudo to create and edit files in this directory.  as your standard user account may not have privilidges to create and edit files in this directory.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo touch phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Enter the following into the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;?php&lt;br /&gt;
phpinfo();&lt;br /&gt;
?&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Now save the file, and on your local machine go to xxx.xxx.xxx.xxx/phptest.php in a web browser where xxx.xxx.xxx.xxx is your VM&#039;s static IP. You should now be on a page that shows your PHP Version, and system information.&amp;lt;/li&amp;gt; &lt;br /&gt;
:[[File:Lab5_php_info.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Use the &amp;quot;View Source&amp;quot; option in your browser to see what the HTML source code is for the page you&#039;re viewing is. Is it the same or different than the .php file you created? Why? How is this different than a standard .html file?&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Lab5_php_info_devtab.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info_devtab.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Website PHP==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=m_sUrt_quX4&amp;amp;feature=youtu.be Video Tutorial - Experiment with Website PHP]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore Apache symlinks&amp;lt;/li&amp;gt;&lt;br /&gt;
:In a previous lab we learned about editing the &#039;&#039;/var/www/index.html&#039;&#039; file to change the default web page displayed by your server. In a future lab you will install some PHP/MySQL based software which powers many Internet sites with forums, blogs, etc. Before we can do that we need to learn a little more about PHP and about databases. Like most software on Linux the Apache webserver configuration files are stored in the &#039;&#039;/etc&#039;&#039; directory. Specifically, you can find several of them which work together and are called from each other in &#039;&#039;/etc/apache2/&#039;&#039; take a look in the &#039;&#039;/etc/apache2/sites-enabled/&#039;&#039; directory. See how symlinks are used to point to configuration files which actually reside in the &#039;&#039;/etc/apache2/sites-available/&#039;&#039; directory? This allows us to turn off and on various sites by creating or removing a symlink rather than by deleting the actual configuration file, a handy thing if we just want to temporarily disable a site. In fact Apache provides a utility to automatically add and remove these links called &#039;&#039;&#039;a2ensite&#039;&#039;&#039; and &#039;&#039;&#039;a2dissite&#039;&#039;&#039;. Check the &#039;&#039;&#039;man&#039;&#039;&#039; pages for these commands to see how they work.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore &#039;&#039;&#039;/etc/apche2/sites-enabled&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:As you might have guessed the default site for your system is configured by the file linked to at &#039;&#039;/etc/apache2/sites-enabled/000-default&#039;&#039; If you open this file in your favorite text editor you will see a series of what Apache calls &amp;quot;directives&amp;quot; which explain how the webserver should function, what port it should listen on, where the website files will reside (&#039;&#039;/var/www/html&#039;&#039;), etc. &lt;br /&gt;
:&#039;&#039; NOTE: Going into all of the different Apache directives is outside of the scope of this course but you will find a lot of documentation about them on the Internet.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the Apache configuration files in Webmin&amp;lt;/li&amp;gt;&lt;br /&gt;
:In addition to configuring Apache directly through it&#039;s configuration files you can also configure it through an interface like Webmin which we installed in a previous lab. Bring up the Webmin configuration page for Apache and take a look at the settings for the default site. Note how the things you saw directly in the configuration file match up with what you see in Webmin. One of the things you may be interested in seeing is how the webserver knows to display the index.html file from a directory if it exists and no specific file is requested in the URL. Take a look on the &amp;quot;Directory Indexing&amp;quot; page for the default virtualhost and see if you can find this information. You&#039;ll notice that there is a list of files, not just index.html which the server will display.&lt;br /&gt;
:&#039;&#039; NOTE: You may need to refresh your Webmin modules or &amp;quot;scan for new modules&amp;quot; if you haven&#039;t done that since installing Apache and Webmin. Webmin scans your system for compatible server software packages (like Apache) when it is installed but needs to re-scan it&#039;s modules after you install new server software before you can configure it through Webmin.&lt;br /&gt;
&amp;lt;li&amp;gt;Expiriment with and learn PHP basics&amp;lt;/li&amp;gt;&lt;br /&gt;
:In another section of this lab you created a basic &#039;&#039;phptest.php&#039;&#039; file and saw how the server executed the PHP code and turned it into an HTML page your browser could display. Because PHP offers an easy way to write web applications it powers much of the Internet. To prepare us for setting up some PHP applications in a future lab it will be helpful to know a little about how PHP scripts work. Read through the [http://www.w3schools.com/php/default.asp W3 Schools PHP Basics Tutorial] (PHP Intro through PHP Superglobals) and try creating some PHP scripts on your own Linux server like the examples given in the tutorial pages to see if you can get them to run, try modifying them a little bit and see what the results are. There are many great Internet resources devoted to understanding how to do things with PHP so take some time to see how this language can be easily integrated in websites. You should definitely be familiar with editing PHP files to change variables, echo statements, etc. work which are all skills you&#039;ll need when installing PHP based website software.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own PHP files&amp;lt;/li&amp;gt;&lt;br /&gt;
:*Try writing some simple PHP scripts on your own using variables and echo statements and make them available through your webserver.&lt;br /&gt;
:*A good place to create these would be in your home directory, using your favorite text editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own &amp;quot;home&amp;quot; page by editing your &#039;&#039;index.html&#039;&#039; file located in the &#039;&#039;&#039;/var/www/html&#039;&#039;&#039; directory.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You will need to be familiar with the very basics of editing HTML files in order to create links, etc. If you haven&#039;t done this before there are many introductory HTML tutorials available online.  A good starting place is [https://www.w3schools.com/html/html_basic.asp W3 Schools HTML Basics Examples]&lt;br /&gt;
:&#039;&#039; NOTE:It is importatnt to know that an &#039;&#039;&#039;html&#039;&#039;&#039; file must include the &amp;lt;!DOCTYPE HTML&amp;gt; tag.  Additionally, you will notice that all tags have an opening tag and a closing tag.  The information between the tags is what will have the features of the tag&lt;br /&gt;
:*Backup your &#039;&#039;index.html&#039;&#039; file by copying to a new file name.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo cp /var/www/html/index.html /var/www/html/index.html.bak&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Edit your &#039;&#039;index.html&#039;&#039; file (or create a new &#039;&#039;index.php&#039;&#039; file which will be loaded instead if it exists) so there is a list and links to the various scripts you have created as part of your PHP experimentation.&lt;br /&gt;
:* Open your index.html file in your favorite text editor,&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano /var/www/html/index.html&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Since you have backed up the original index.html file I would edit this file to only include the basics.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;My ITC-2480 Server&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;This is a server on Pod-R in NetLab at 172.17.50.XX&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Here are some of the Projects I am working on:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;http://172.17.50.XX/phptest.php&amp;quot;&amp;gt;PHP Version Information&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Make sure to replace the XX in the IP with the IP address of your server.&lt;br /&gt;
:&lt;br /&gt;
:[[File:Lab5_basic_html.png|link=https://wiki.ihitc.net/mediawiki/images/2/29/Lab5_basic_html.png|500px]]&lt;br /&gt;
:[[Media:Lab5_basic_html.png|Click here for a larger image]]&lt;br /&gt;
:A first look for a basic page&lt;br /&gt;
:[[File:Lab5_initial_home.png|link=https://wiki.ihitc.net/mediawiki/images/9/92/Lab5_initial_home.png|500px]]&lt;br /&gt;
:[[Media:Lab5_initial_home.png|Click for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Try to add additional features to your &amp;quot;home&amp;quot; page.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You may get some ideas of features you might like to add by looking at the original &#039;&#039;index.html&#039;&#039; file that we backed up in step 6 of this lab.&lt;br /&gt;
:*As you complete your labs consider what you can add to this page.&lt;br /&gt;
:*Add links to the PHP scripts you created&lt;br /&gt;
:*A few good chalanges would be to add a title, change font size, style or color.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Databases==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=1zYXiWLoGdM&amp;amp;feature=youtu.be Video Tutorial - Experiment with Databases]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: In order to do really powerful things with a website we need a database where we can store dynamic content which can be queried to automatically build site pages from a template. One of the most common databases is an SQL database, and MySQL has long been the most prevalent Linux SQL software. These days MariaDB, which we installed, has been taking some MySQL marketshare because it is a community developed program instead of MySQL which is now owned by Oracle. The MariaDB software and MySQL software are essentially equivalent, especially for small sites/databases, and the same commands are used interchangeably including using the &#039;&#039;&#039;mysql&#039;&#039;&#039; command to access them. SQL itself is a standard language for interacting with a specific type of database called a relational database, we&#039;ll see why it&#039;s called a relational database in a minute. Each database is a collection of data stored in tables. You can think of a table as something like a spreadsheet with rows and columns, except we call the columns fields and the rows records (sometimes we actually call them rows too). The different tables are often related to one another, of course they are usually being used by the same web application, but usually the relationship goes deeper than that as we&#039;ll see in a little bit.&lt;br /&gt;
&amp;lt;li&amp;gt;Download a sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To jumpstart our exploration of databases we&#039;ll download a pre-built sample database with a few tables and many records already in it and import it into our MySQL database server. Download the employees database file [https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2 employees_db-full-1.0.6.tar.bz2] (about 26MB) and get it into your home directory. Instead of using the &#039;&#039;&#039;links&#039;&#039;&#039; browser to do this or downloading to your computer and then pushing this large file back across the Internet with an SCP/SFTP client like FileZilla a better choice might be to learn about the &#039;&#039;&#039;wget&#039;&#039;&#039; program which can be used like &amp;quot;&#039;&#039;&#039;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&#039;&#039;&#039;&amp;quot; to download the file into your current working directory.&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Unpack the database file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Figure out how to use the &#039;&#039;&#039;tar&#039;&#039;&#039; program to unpack this .tar.bz2 file. Note that this file uses bz2 compression which takes longer to compress than gzip but can compress the files more. Once unpacked you should have an &amp;quot;employees_db&amp;quot; folder.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the files included with sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: Inside the &#039;&#039;employees_db&#039;&#039; folder you should have a number of &#039;&#039;.sql&#039;&#039; script files and dump files which can be used to restore the database to your system.&lt;br /&gt;
:*Take a look at the &#039;&#039;employees.sql&#039;&#039; file, it&#039;s just a text file, which describes the format of the database. &lt;br /&gt;
:*Also take a look at the &#039;&#039;load_employees.dump&#039;&#039; file, also just a text file, which contains all of the records from the employees table of the database. :&#039;&#039; NOTE: there are 300,000 some employee records in this database so you probably don&#039;t want to just use &#039;&#039;&#039;cat&#039;&#039;&#039; to view these files as it could take a while to print them out to your screen. Using the &#039;&#039;&#039;less&#039;&#039;&#039; program would be a better choice as it will allow you to exit viewing the file by pressing q at any time.&lt;br /&gt;
&amp;lt;li&amp;gt;Open the MySQL (MariaDB) command line&amp;lt;/li&amp;gt;&lt;br /&gt;
: We can interact with the MySQL/MariaDB server in many different ways. The first way we&#039;ll take a look at is through the command line &#039;&#039;&#039;mysql&#039;&#039;&#039; program. Run the &amp;quot;&#039;&#039;&#039;sudo mysql&#039;&#039;&#039;&amp;quot; command. &lt;br /&gt;
:&#039;&#039; NOTE: that we are running this command with system administrator permissions which allows us to log in to the MySQL server with database administrator permissions as well. The MySQL program actually stores it&#039;s own usernames and passwords as a MySQL database itself, you can create and modify these permissions from the mysql command line but we&#039;ll learn more about modifying them through the Webmin interface later.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo MySQL&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_cli.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab5_mariadb_cli.png|500px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_cli.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Explore MySQL (MariaDB) Commands&amp;lt;/li&amp;gt;&lt;br /&gt;
: MySQL has it&#039;s own command line language the you can use through the &amp;quot;mysql&amp;gt;&amp;quot; prompt you are now running. For example, if we want to see a list of databases on the system we can run &amp;quot;&#039;&#039;&#039;SHOW databases;&#039;&#039;&#039;&amp;quot; run the command and note the databases that already exist by default.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW databases;&amp;lt;/code&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Each MySQL/MariaDB statement ends with a semicolon (;) if you do not put the semicolon at the end of the line the command will not execute when you press enter and you will be able to continue to add more commands to the statement before finishing with a semicolon. If you accidentally press enter without ending with a semicolon you can just enter a semicolon on the next line and press enter.&lt;br /&gt;
&amp;lt;li&amp;gt;Import the sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To import the employee database we can use the &amp;quot;&#039;&#039;&#039;source employees.sql;&#039;&#039;&#039;&amp;quot; command (assuming we were already working in the directory which contains the employees.sql file when we launched mysql. Import the employee database and verify the system now has an employees database.&lt;br /&gt;
&amp;lt;code&amp;gt;SOURCE employees.sql;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the employees database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;USE employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
: If we want to see all of the tables in the employees database we must first select the database we want to work on using the &amp;quot;&#039;&#039;&#039;USE employees;&#039;&#039;&#039;&amp;quot; command.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the employee table&amp;lt;/li&amp;gt;&lt;br /&gt;
: Use the &amp;quot;&#039;&#039;&#039;SHOW tables;&#039;&#039;&#039;&amp;quot; command to see a list of tables.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW tables;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View a list of employees in table&amp;lt;/li&amp;gt;&lt;br /&gt;
: To see a list of all the records in a table we need to run a SELECT query &amp;quot;&#039;&#039;&#039;SELECT * from &#039;&#039;&amp;lt;tablename&amp;gt;&#039;&#039;&#039;&#039;&#039;&amp;quot; like &amp;quot;&#039;&#039;&#039;SELECT * from employees&#039;&#039;&#039;&amp;quot; which will list all the records in the &#039;&#039;employees&#039;&#039; table of the employees database and display them.&lt;br /&gt;
&amp;lt;code&amp;gt;SELECT * from employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_show_tables.png|link=https://wiki.ihitc.net/mediawiki/images/d/d5/Lab5_mariadb_show_tables.png|350px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_show_tables.png|Click here for a larger image]]&lt;br /&gt;
:* Remember that we previously selected to USE the &#039;&#039;employees&#039;&#039; database, this will be remembered until we USE a different database. Try displaying the records in a couple of different tables like employees and departments.&lt;br /&gt;
:&#039;&#039; NOTE: The output can be broken by using CTRL-C on your local machine if you do not wish to wait for all of the records to be displayed.&lt;br /&gt;
:&lt;br /&gt;
: There is much more that we can do from the MySQL/MariaDB command line but that would be a whole class or more itself. The MySQL/MariaDB programs are well documented on the Internet and with these basic skills you should be able to figure out most of it. Remember, the vast majority of what you read about MySQL will also work in MariaDB and vice-versa.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the MySQL interface in Webmin&lt;br /&gt;
: Now that you have learned a bit about MySQL databases from the command line let&#039;s see how they look in the Webmin web management interface. Log back in to your Webmin interface through a browser on your host system.&lt;br /&gt;
:* Because MySQL was not installed when we first setup Webmin you need to &amp;quot;scan for new modules&amp;quot; first. Once that process has finished refresh the page to see that MySQL has been added to the server section of Webmin.&lt;br /&gt;
:* Take a look at the Webmin MySQL module and see how MySQL users and permissions are configured.&lt;br /&gt;
:* Try browsing through the &#039;&#039;employees&#039;&#039; database using the Webmin interface including viewing tables and records inside of the tables.&lt;br /&gt;
&amp;lt;li&amp;gt;Drop database and exit MySQL (MariaDB)&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Go back to your MySQL command line window and run the command &amp;quot;&#039;&#039;&#039;DROP DATABASE employees;&#039;&#039;&#039;&amp;quot; to delete the entire database.&lt;br /&gt;
:* Type &amp;quot;&#039;&#039;&#039;exit;&#039;&#039;&#039;&amp;quot; to quit the MySQL program and return to a Linux shell.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039; NOTE: Obviously, the DROP command is one to be careful with as you can easily wipe out a huge database with one line! &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==View Logfiles==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=cxIOQF-eMy0&amp;amp;feature=youtu.be Video Tutorial - Tutorial 5 View Logfiles]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: Linux stores most of log files in the &#039;&#039;/var/log&#039;&#039; directory so change your working directory to &#039;&#039;/var/log&#039;&#039;.&lt;br /&gt;
: Some log files are viewable by all users on the system but other log files may be restricted and you will need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to view them.&lt;br /&gt;
&amp;lt;li&amp;gt;View last 20 lines in &#039;&#039;&#039;/var/log/syslog&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;tail -20 /var/log/syslog&amp;lt;/code&amp;gt;&lt;br /&gt;
:[[File:Lab5_tail.png|link=https://wiki.ihitc.net/mediawiki/images/8/88/Lab5_tail.png|500px]]&lt;br /&gt;
:[[Media:Lab5_tail.png|Click here for a larger image]]&lt;br /&gt;
: Linux log files are typically standard text files and can be read with standard text file utilities like cat or less. One additional utility which comes in hand is the &#039;&#039;&#039;tail&#039;&#039;&#039; program which displays the last 10 lines (by default) of a text file and which can be configured to display more or less lines using a command like &#039;&#039;&#039;tail -20 /var/log/syslog&#039;&#039;&#039; which will display the last 20 lines of the main system log file. The manual page for the &#039;&#039;&#039;tail&#039;&#039;&#039; command contains additional information like how to use the &#039;&#039;-f&#039;&#039; option to view a log in realtime (exit with Ctrl-C).&lt;br /&gt;
&amp;lt;li&amp;gt;Save the tail output to a file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Often we may want to save the output from a &#039;&#039;&#039;tail&#039;&#039;&#039; command to share with others or document an issue.  This can easily be done using redirection we learned in a previous lab.  Experiment with how to save some tail commands.&lt;br /&gt;
: &amp;lt;code&amp;gt;tail -20 /var/log/syslog &amp;gt; logtail.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Explore some other log files&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at some of the log files on your system and see what kinds of information they contain specifically you should probably look at &#039;&#039;syslog&#039;&#039;, &#039;&#039;auth.log&#039;&#039;, &#039;&#039;kern.log&#039;&#039;, &#039;&#039;apache2/access.log&#039;&#039;, and &#039;&#039;apache2/error.log&#039;&#039; &lt;br /&gt;
:* Use the tail command to explore these logs&lt;br /&gt;
: In order to prevent log files from completely filling your drive old log files are eventually rotated on the system and compressed and then finally deleted. Take a look at some of the rotated log files like &#039;&#039;/var/log/syslog.1&#039;&#039; or &#039;&#039;/var/log/kern.log.1&#039;&#039; which will contain slightly older log entries.&lt;br /&gt;
:&#039;&#039; Note: After the first rotated file other files are usually compressed with gzip. You can decompress and view these on the fly using the &#039;&#039;&#039;zcat&#039;&#039;&#039; program.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9519</id>
		<title>Lab 5 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9519"/>
		<updated>2021-02-20T12:39:12Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* View Logfiles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Learn about static network configuration of Debian Linux systems&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net PHP]&#039;&#039;&#039;&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net MariaDB]&#039;&#039;&#039; on your server, this is an open-source MySQL alternative&lt;br /&gt;
*Experiment with websites and databases&lt;br /&gt;
*Explore the standard log files on your system.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifup ifup]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifdown ifdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ping ping]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2ensite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2dissite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/wget wget]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/zcat zcat]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/service service]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/tail tail]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will also use the following MySQL (MariaDB) commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/use USE]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/show SHOW]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/select SELECT]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/drop-database DROP database]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software, login with your standard user account&lt;br /&gt;
# Make a note of the static IP address information for your particular system in the table below, it is based on the system name identification letter in vmWare. These IP addresses will ONLY be valid in the ITC vmWare Linux class subnet. If you are working on a local VirtualBox system you will need to select an available static IP from the correct subnet for your system or skip the static IP addressing section. All vmWare systems will use a gateway address of 172.17.50.1 and a subnet mask of 255.255.255.0 with two nameservers 172.17.139.11 and 172.17.139.111&lt;br /&gt;
{| {{table}}&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;System ID&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Static IP&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| A||172.17.50.11&lt;br /&gt;
|-&lt;br /&gt;
| B||172.17.50.12&lt;br /&gt;
|-&lt;br /&gt;
| C||172.17.50.13&lt;br /&gt;
|-&lt;br /&gt;
| D||172.17.50.14&lt;br /&gt;
|-&lt;br /&gt;
| E||172.17.50.15&lt;br /&gt;
|-&lt;br /&gt;
| F||172.17.50.16&lt;br /&gt;
|-&lt;br /&gt;
| G||172.17.50.17&lt;br /&gt;
|-&lt;br /&gt;
| H||172.17.50.18&lt;br /&gt;
|-&lt;br /&gt;
| I||172.17.50.19&lt;br /&gt;
|-&lt;br /&gt;
| J||172.17.50.20&lt;br /&gt;
|-&lt;br /&gt;
| K||172.17.50.21&lt;br /&gt;
|-&lt;br /&gt;
| L||172.17.50.22&lt;br /&gt;
|-&lt;br /&gt;
| M||172.17.50.23&lt;br /&gt;
|-&lt;br /&gt;
| N||172.17.50.24&lt;br /&gt;
|-&lt;br /&gt;
| O||172.17.50.25&lt;br /&gt;
|-&lt;br /&gt;
| P||172.17.50.26&lt;br /&gt;
|-&lt;br /&gt;
| Q||172.17.50.27&lt;br /&gt;
|-&lt;br /&gt;
| R||172.17.50.28&lt;br /&gt;
|-&lt;br /&gt;
| S||172.17.50.29&lt;br /&gt;
|-&lt;br /&gt;
| T||172.17.50.30&lt;br /&gt;
|-&lt;br /&gt;
| U||172.17.50.31&lt;br /&gt;
|-&lt;br /&gt;
| V||172.17.50.32&lt;br /&gt;
|-&lt;br /&gt;
| W||172.17.50.33&lt;br /&gt;
|-&lt;br /&gt;
| X||172.17.50.34&lt;br /&gt;
|-&lt;br /&gt;
| Y||172.17.50.35&lt;br /&gt;
|-&lt;br /&gt;
| Z||172.17.50.36&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set a static IP==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=VcPA6gJ0Ohw&amp;amp;feature=youtu.be Video Tutorial - Setting a Static IP Address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
:&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install PHP &amp;amp; MySQL/MariaDB==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=Az0qtg4LSjA&amp;amp;feature=youtu.be Video Tutorial -  Install PHP and MySQL MariaDB]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install packages&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using &#039;&#039;&#039;apt&#039;&#039;&#039;, install the &#039;&#039;php&#039;&#039; and &#039;&#039;mariadb-server&#039;&#039; packages as well as the &#039;&#039;php-mysql&#039;&#039; package which provides the link between php and mysql and the &#039;&#039;libapache2-mod-php&#039;&#039; package which provides a copy of PHP which allows the Apache webserver to run website PHP scripts.&lt;br /&gt;
&#039;&#039; Note: Remember to do an &#039;&#039;&#039;apt update&#039;&#039;&#039; before installing packages to make sure you get the latest versions&lt;br /&gt;
&#039;&#039; Note: Maria-DB is a fully compatible replacement for MySQL that isn&#039;t controlled by Oracle.&lt;br /&gt;
* After the dependencies are found, go ahead and accept them to continue the install.&lt;br /&gt;
&amp;lt;li&amp;gt; After the install is complete, &#039;&#039;&#039;cd&#039;&#039;&#039; to &#039;&#039;/var/www/html&#039;&#039; which is the root directory of your webserver and so where all website files are served from.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; In order to fully enable the PHP-MySQL module you should restart your Apache webserver. You don&#039;t need to restart your entire system to do this. Do some research on the &amp;quot;apache2ctl&amp;quot; or the &amp;quot;service apache2&amp;quot;  commands which can be used to do this.&lt;br /&gt;
&amp;lt;li&amp;gt; At this point we will test to verify that php is working properly with Apache. Create a new file named &#039;&#039;phptest.php&#039;&#039;, and then open it in a text editor.&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039; Note: you may have to use sudo to create and edit files in this directory.  as your standard user account may not have privilidges to create and edit files in this directory.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo touch phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Enter the following into the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;?php&lt;br /&gt;
phpinfo();&lt;br /&gt;
?&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Now save the file, and on your local machine go to xxx.xxx.xxx.xxx/phptest.php in a web browser where xxx.xxx.xxx.xxx is your VM&#039;s static IP. You should now be on a page that shows your PHP Version, and system information.&amp;lt;/li&amp;gt; &lt;br /&gt;
:[[File:Lab5_php_info.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Use the &amp;quot;View Source&amp;quot; option in your browser to see what the HTML source code is for the page you&#039;re viewing is. Is it the same or different than the .php file you created? Why? How is this different than a standard .html file?&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Lab5_php_info_devtab.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info_devtab.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Website PHP==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=m_sUrt_quX4&amp;amp;feature=youtu.be Video Tutorial - Experiment with Website PHP]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore Apache symlinks&amp;lt;/li&amp;gt;&lt;br /&gt;
:In a previous lab we learned about editing the &#039;&#039;/var/www/index.html&#039;&#039; file to change the default web page displayed by your server. In a future lab you will install some PHP/MySQL based software which powers many Internet sites with forums, blogs, etc. Before we can do that we need to learn a little more about PHP and about databases. Like most software on Linux the Apache webserver configuration files are stored in the &#039;&#039;/etc&#039;&#039; directory. Specifically, you can find several of them which work together and are called from each other in &#039;&#039;/etc/apache2/&#039;&#039; take a look in the &#039;&#039;/etc/apache2/sites-enabled/&#039;&#039; directory. See how symlinks are used to point to configuration files which actually reside in the &#039;&#039;/etc/apache2/sites-available/&#039;&#039; directory? This allows us to turn off and on various sites by creating or removing a symlink rather than by deleting the actual configuration file, a handy thing if we just want to temporarily disable a site. In fact Apache provides a utility to automatically add and remove these links called &#039;&#039;&#039;a2ensite&#039;&#039;&#039; and &#039;&#039;&#039;a2dissite&#039;&#039;&#039;. Check the &#039;&#039;&#039;man&#039;&#039;&#039; pages for these commands to see how they work.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore &#039;&#039;&#039;/etc/apche2/sites-enabled&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:As you might have guessed the default site for your system is configured by the file linked to at &#039;&#039;/etc/apache2/sites-enabled/000-default&#039;&#039; If you open this file in your favorite text editor you will see a series of what Apache calls &amp;quot;directives&amp;quot; which explain how the webserver should function, what port it should listen on, where the website files will reside (&#039;&#039;/var/www/html&#039;&#039;), etc. &lt;br /&gt;
:&#039;&#039; NOTE: Going into all of the different Apache directives is outside of the scope of this course but you will find a lot of documentation about them on the Internet.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the Apache configuration files in Webmin&amp;lt;/li&amp;gt;&lt;br /&gt;
:In addition to configuring Apache directly through it&#039;s configuration files you can also configure it through an interface like Webmin which we installed in a previous lab. Bring up the Webmin configuration page for Apache and take a look at the settings for the default site. Note how the things you saw directly in the configuration file match up with what you see in Webmin. One of the things you may be interested in seeing is how the webserver knows to display the index.html file from a directory if it exists and no specific file is requested in the URL. Take a look on the &amp;quot;Directory Indexing&amp;quot; page for the default virtualhost and see if you can find this information. You&#039;ll notice that there is a list of files, not just index.html which the server will display.&lt;br /&gt;
:&#039;&#039; NOTE: You may need to refresh your Webmin modules or &amp;quot;scan for new modules&amp;quot; if you haven&#039;t done that since installing Apache and Webmin. Webmin scans your system for compatible server software packages (like Apache) when it is installed but needs to re-scan it&#039;s modules after you install new server software before you can configure it through Webmin.&lt;br /&gt;
&amp;lt;li&amp;gt;Expiriment with and learn PHP basics&amp;lt;/li&amp;gt;&lt;br /&gt;
:In another section of this lab you created a basic &#039;&#039;phptest.php&#039;&#039; file and saw how the server executed the PHP code and turned it into an HTML page your browser could display. Because PHP offers an easy way to write web applications it powers much of the Internet. To prepare us for setting up some PHP applications in a future lab it will be helpful to know a little about how PHP scripts work. Read through the [http://www.w3schools.com/php/default.asp W3 Schools PHP Basics Tutorial] (PHP Intro through PHP Superglobals) and try creating some PHP scripts on your own Linux server like the examples given in the tutorial pages to see if you can get them to run, try modifying them a little bit and see what the results are. There are many great Internet resources devoted to understanding how to do things with PHP so take some time to see how this language can be easily integrated in websites. You should definitely be familiar with editing PHP files to change variables, echo statements, etc. work which are all skills you&#039;ll need when installing PHP based website software.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own PHP files&amp;lt;/li&amp;gt;&lt;br /&gt;
:*Try writing some simple PHP scripts on your own using variables and echo statements and make them available through your webserver.&lt;br /&gt;
:*A good place to create these would be in your home directory, using your favorite text editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own &amp;quot;home&amp;quot; page by editing your &#039;&#039;index.html&#039;&#039; file located in the &#039;&#039;&#039;/var/www/html&#039;&#039;&#039; directory.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You will need to be familiar with the very basics of editing HTML files in order to create links, etc. If you haven&#039;t done this before there are many introductory HTML tutorials available online.  A good starting place is [https://www.w3schools.com/html/html_basic.asp W3 Schools HTML Basics Examples]&lt;br /&gt;
:&#039;&#039; NOTE:It is importatnt to know that an &#039;&#039;&#039;html&#039;&#039;&#039; file must include the &amp;lt;!DOCTYPE HTML&amp;gt; tag.  Additionally, you will notice that all tags have an opening tag and a closing tag.  The information between the tags is what will have the features of the tag&lt;br /&gt;
:*Backup your &#039;&#039;index.html&#039;&#039; file by copying to a new file name.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo cp /var/www/html/index.html /var/www/html/index.html.bak&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Edit your &#039;&#039;index.html&#039;&#039; file (or create a new &#039;&#039;index.php&#039;&#039; file which will be loaded instead if it exists) so there is a list and links to the various scripts you have created as part of your PHP experimentation.&lt;br /&gt;
:* Open your index.html file in your favorite text editor,&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano /var/www/html/index.html&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Since you have backed up the original index.html file I would edit this file to only include the basics.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;My ITC-2480 Server&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;This is a server on Pod-R in NetLab at 172.17.50.XX&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Here are some of the Projects I am working on:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;http://172.17.50.XX/phptest.php&amp;quot;&amp;gt;PHP Version Information&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Make sure to replace the XX in the IP with the IP address of your server.&lt;br /&gt;
:&lt;br /&gt;
:[[File:Lab5_basic_html.png|link=https://wiki.ihitc.net/mediawiki/images/2/29/Lab5_basic_html.png|500px]]&lt;br /&gt;
:[[Media:Lab5_basic_html.png|Click here for a larger image]]&lt;br /&gt;
:A first look for a basic page&lt;br /&gt;
:[[File:Lab5_initial_home.png|link=https://wiki.ihitc.net/mediawiki/images/9/92/Lab5_initial_home.png|500px]]&lt;br /&gt;
:[[Media:Lab5_initial_home.png|Click for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Try to add additional features to your &amp;quot;home&amp;quot; page.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You may get some ideas of features you might like to add by looking at the original &#039;&#039;index.html&#039;&#039; file that we backed up in step 6 of this lab.&lt;br /&gt;
:*As you complete your labs consider what you can add to this page.&lt;br /&gt;
:*Add links to the PHP scripts you created&lt;br /&gt;
:*A few good chalanges would be to add a title, change font size, style or color.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Databases==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=1zYXiWLoGdM&amp;amp;feature=youtu.be Video Tutorial - Experiment with Databases]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: In order to do really powerful things with a website we need a database where we can store dynamic content which can be queried to automatically build site pages from a template. One of the most common databases is an SQL database, and MySQL has long been the most prevalent Linux SQL software. These days MariaDB, which we installed, has been taking some MySQL marketshare because it is a community developed program instead of MySQL which is now owned by Oracle. The MariaDB software and MySQL software are essentially equivalent, especially for small sites/databases, and the same commands are used interchangeably including using the &#039;&#039;&#039;mysql&#039;&#039;&#039; command to access them. SQL itself is a standard language for interacting with a specific type of database called a relational database, we&#039;ll see why it&#039;s called a relational database in a minute. Each database is a collection of data stored in tables. You can think of a table as something like a spreadsheet with rows and columns, except we call the columns fields and the rows records (sometimes we actually call them rows too). The different tables are often related to one another, of course they are usually being used by the same web application, but usually the relationship goes deeper than that as we&#039;ll see in a little bit.&lt;br /&gt;
&amp;lt;li&amp;gt;Download a sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To jumpstart our exploration of databases we&#039;ll download a pre-built sample database with a few tables and many records already in it and import it into our MySQL database server. Download the employees database file [https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2 employees_db-full-1.0.6.tar.bz2] (about 26MB) and get it into your home directory. Instead of using the &#039;&#039;&#039;links&#039;&#039;&#039; browser to do this or downloading to your computer and then pushing this large file back across the Internet with an SCP/SFTP client like FileZilla a better choice might be to learn about the &#039;&#039;&#039;wget&#039;&#039;&#039; program which can be used like &amp;quot;&#039;&#039;&#039;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&#039;&#039;&#039;&amp;quot; to download the file into your current working directory.&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Unpack the database file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Figure out how to use the &#039;&#039;&#039;tar&#039;&#039;&#039; program to unpack this .tar.bz2 file. Note that this file uses bz2 compression which takes longer to compress than gzip but can compress the files more. Once unpacked you should have an &amp;quot;employees_db&amp;quot; folder.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the files included with sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: Inside the &#039;&#039;employees_db&#039;&#039; folder you should have a number of &#039;&#039;.sql&#039;&#039; script files and dump files which can be used to restore the database to your system.&lt;br /&gt;
:*Take a look at the &#039;&#039;employees.sql&#039;&#039; file, it&#039;s just a text file, which describes the format of the database. &lt;br /&gt;
:*Also take a look at the &#039;&#039;load_employees.dump&#039;&#039; file, also just a text file, which contains all of the records from the employees table of the database. :&#039;&#039; NOTE: there are 300,000 some employee records in this database so you probably don&#039;t want to just use &#039;&#039;&#039;cat&#039;&#039;&#039; to view these files as it could take a while to print them out to your screen. Using the &#039;&#039;&#039;less&#039;&#039;&#039; program would be a better choice as it will allow you to exit viewing the file by pressing q at any time.&lt;br /&gt;
&amp;lt;li&amp;gt;Open the MySQL (MariaDB) command line&amp;lt;/li&amp;gt;&lt;br /&gt;
: We can interact with the MySQL/MariaDB server in many different ways. The first way we&#039;ll take a look at is through the command line &#039;&#039;&#039;mysql&#039;&#039;&#039; program. Run the &amp;quot;&#039;&#039;&#039;sudo mysql&#039;&#039;&#039;&amp;quot; command. &lt;br /&gt;
:&#039;&#039; NOTE: that we are running this command with system administrator permissions which allows us to log in to the MySQL server with database administrator permissions as well. The MySQL program actually stores it&#039;s own usernames and passwords as a MySQL database itself, you can create and modify these permissions from the mysql command line but we&#039;ll learn more about modifying them through the Webmin interface later.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo MySQL&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_cli.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab5_mariadb_cli.png|500px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_cli.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Explore MySQL (MariaDB) Commands&amp;lt;/li&amp;gt;&lt;br /&gt;
: MySQL has it&#039;s own command line language the you can use through the &amp;quot;mysql&amp;gt;&amp;quot; prompt you are now running. For example, if we want to see a list of databases on the system we can run &amp;quot;&#039;&#039;&#039;SHOW databases;&#039;&#039;&#039;&amp;quot; run the command and note the databases that already exist by default.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW databases;&amp;lt;/code&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Each MySQL/MariaDB statement ends with a semicolon (;) if you do not put the semicolon at the end of the line the command will not execute when you press enter and you will be able to continue to add more commands to the statement before finishing with a semicolon. If you accidentally press enter without ending with a semicolon you can just enter a semicolon on the next line and press enter.&lt;br /&gt;
&amp;lt;li&amp;gt;Import the sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To import the employee database we can use the &amp;quot;&#039;&#039;&#039;source employees.sql;&#039;&#039;&#039;&amp;quot; command (assuming we were already working in the directory which contains the employees.sql file when we launched mysql. Import the employee database and verify the system now has an employees database.&lt;br /&gt;
&amp;lt;code&amp;gt;SOURCE employees.sql;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the employees database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;USE employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
: If we want to see all of the tables in the employees database we must first select the database we want to work on using the &amp;quot;&#039;&#039;&#039;USE employees;&#039;&#039;&#039;&amp;quot; command.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the employee table&amp;lt;/li&amp;gt;&lt;br /&gt;
: Use the &amp;quot;&#039;&#039;&#039;SHOW tables;&#039;&#039;&#039;&amp;quot; command to see a list of tables.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW tables;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View a list of employees in table&amp;lt;/li&amp;gt;&lt;br /&gt;
: To see a list of all the records in a table we need to run a SELECT query &amp;quot;&#039;&#039;&#039;SELECT * from &#039;&#039;&amp;lt;tablename&amp;gt;&#039;&#039;&#039;&#039;&#039;&amp;quot; like &amp;quot;&#039;&#039;&#039;SELECT * from employees&#039;&#039;&#039;&amp;quot; which will list all the records in the &#039;&#039;employees&#039;&#039; table of the employees database and display them.&lt;br /&gt;
&amp;lt;code&amp;gt;SELECT * from employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_show_tables.png|link=https://wiki.ihitc.net/mediawiki/images/d/d5/Lab5_mariadb_show_tables.png|350px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_show_tables.png|Click here for a larger image]]&lt;br /&gt;
:* Remember that we previously selected to USE the &#039;&#039;employees&#039;&#039; database, this will be remembered until we USE a different database. Try displaying the records in a couple of different tables like employees and departments.&lt;br /&gt;
:&#039;&#039; NOTE: The output can be broken by using CTRL-C on your local machine if you do not wish to wait for all of the records to be displayed.&lt;br /&gt;
:&lt;br /&gt;
: There is much more that we can do from the MySQL/MariaDB command line but that would be a whole class or more itself. The MySQL/MariaDB programs are well documented on the Internet and with these basic skills you should be able to figure out most of it. Remember, the vast majority of what you read about MySQL will also work in MariaDB and vice-versa.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the MySQL interface in Webmin&lt;br /&gt;
: Now that you have learned a bit about MySQL databases from the command line let&#039;s see how they look in the Webmin web management interface. Log back in to your Webmin interface through a browser on your host system.&lt;br /&gt;
:* Because MySQL was not installed when we first setup Webmin you need to &amp;quot;scan for new modules&amp;quot; first. Once that process has finished refresh the page to see that MySQL has been added to the server section of Webmin.&lt;br /&gt;
:* Take a look at the Webmin MySQL module and see how MySQL users and permissions are configured.&lt;br /&gt;
:* Try browsing through the &#039;&#039;employees&#039;&#039; database using the Webmin interface including viewing tables and records inside of the tables.&lt;br /&gt;
&amp;lt;li&amp;gt;Drop database and exit MySQL (MariaDB)&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Go back to your MySQL command line window and run the command &amp;quot;&#039;&#039;&#039;DROP DATABASE employees;&#039;&#039;&#039;&amp;quot; to delete the entire database.&lt;br /&gt;
:* Type &amp;quot;&#039;&#039;&#039;exit;&#039;&#039;&#039;&amp;quot; to quit the MySQL program and return to a Linux shell.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039; NOTE: Obviously, the DROP command is one to be careful with as you can easily wipe out a huge database with one line! &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==View Logfiles==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=cxIOQF-eMy0&amp;amp;feature=youtu.be Video Tutorial - Tutorial 5 View Logfiles]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: Linux stores most of log files in the &#039;&#039;/var/log&#039;&#039; directory so change your working directory to &#039;&#039;/var/log&#039;&#039;.&lt;br /&gt;
: Some log files are viewable by all users on the system but other log files may be restricted and you will need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to view them.&lt;br /&gt;
&amp;lt;li&amp;gt;View last 20 lines in &#039;&#039;&#039;/var/log/syslog&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;tail -20 /var/log/syslog&amp;lt;/code&amp;gt;&lt;br /&gt;
:[[File:Lab5_tail.png|link=https://wiki.ihitc.net/mediawiki/images/8/88/Lab5_tail.png|500px]]&lt;br /&gt;
:[[Media:Lab5_tail.png|Click here for a larger image]]&lt;br /&gt;
: Linux log files are typically standard text files and can be read with standard text file utilities like cat or less. One additional utility which comes in hand is the &#039;&#039;&#039;tail&#039;&#039;&#039; program which displays the last 10 lines (by default) of a text file and which can be configured to display more or less lines using a command like &#039;&#039;&#039;tail -20 /var/log/syslog&#039;&#039;&#039; which will display the last 20 lines of the main system log file. The manual page for the &#039;&#039;&#039;tail&#039;&#039;&#039; command contains additional information like how to use the &#039;&#039;-f&#039;&#039; option to view a log in realtime (exit with Ctrl-C).&lt;br /&gt;
&amp;lt;li&amp;gt;Save the tail output to a file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Often we may want to save the output from a &#039;&#039;&#039;tail&#039;&#039;&#039; command to share with others or document an issue.  This can easily be done using redirection we learned in a previous lab.&lt;br /&gt;
&amp;lt;code&amp;gt;tail -20 /var/log/syslog &amp;gt; logtail.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Explore some other log files&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at some of the log files on your system and see what kinds of information they contain specifically you should probably look at &#039;&#039;syslog&#039;&#039;, &#039;&#039;auth.log&#039;&#039;, &#039;&#039;kern.log&#039;&#039;, &#039;&#039;apache2/access.log&#039;&#039;, and &#039;&#039;apache2/error.log&#039;&#039; &lt;br /&gt;
:* Use the tail command to explore these logs&lt;br /&gt;
: In order to prevent log files from completely filling your drive old log files are eventually rotated on the system and compressed and then finally deleted. Take a look at some of the rotated log files like &#039;&#039;/var/log/syslog.1&#039;&#039; or &#039;&#039;/var/log/kern.log.1&#039;&#039; which will contain slightly older log entries.&lt;br /&gt;
:&#039;&#039; Note: After the first rotated file other files are usually compressed with gzip. You can decompress and view these on the fly using the &#039;&#039;&#039;zcat&#039;&#039;&#039; program.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9514</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9514"/>
		<updated>2021-02-19T02:43:26Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* Add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9513</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9513"/>
		<updated>2021-02-19T02:32:30Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; can be found at [https://vitux.com/how-to-setup-a-cron-job-in-debian-10 Vitux]. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9512</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9512"/>
		<updated>2021-02-19T02:29:33Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[File:MAILSVR_emailflush_sh.png|link=https://wiki.ihitc.net/mediawiki/images/b/b5/MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
:[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; is https://vitux.com/how-to-setup-a-cron-job-in-debian-10. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9511</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9511"/>
		<updated>2021-02-19T02:28:43Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:MAILSVR_emailflush_sh.png|500px]]&lt;br /&gt;
[[Media:MAILSVR_emailflush_sh.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; is https://vitux.com/how-to-setup-a-cron-job-in-debian-10. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=File:MAILSVR_emailflush_sh.png&amp;diff=9510</id>
		<title>File:MAILSVR emailflush sh.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=File:MAILSVR_emailflush_sh.png&amp;diff=9510"/>
		<updated>2021-02-19T02:27:42Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9509</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9509"/>
		<updated>2021-02-19T02:26:40Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: The script must be owned by root and executable.  Additionally, the crontab must be created with sudo priviledges&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; is https://vitux.com/how-to-setup-a-cron-job-in-debian-10. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9508</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9508"/>
		<updated>2021-02-19T02:23:39Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Maildir Clean Up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; is https://vitux.com/how-to-setup-a-cron-job-in-debian-10. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/scriptname.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9507</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9507"/>
		<updated>2021-02-19T02:22:53Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Auto Reply Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;First you will need to install BIND. to install it, use the package manager to install &#039;&#039;&#039;bind9&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open up &#039;&#039;/etc/bind/named.conf.options&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* You will also need to replace 0.0.0.0 with 172.17.139.11 for outside DNS lookups to function correctly.&amp;lt;/ul&amp;gt;&lt;br /&gt;
: [[File:Bind_named_conf.png | 500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Next, open up your interfaces file (&#039;&#039;/etc/network/interfaces&#039;&#039;).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
* Change the dns server for the primary network interface to &#039;&#039;127.0.0.1&#039;&#039;.&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In &#039;&#039;&#039;Webmin&#039;&#039;&#039;, go to &#039;&#039;Servers&#039;&#039;, then &#039;&#039;BIND DNS Server&#039;&#039;. Under &#039;&#039;Existing DNS Zones&#039;&#039; click on &#039;&#039;Create Master Zone&#039;&#039; and use the following settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Zone type: Forward (Names to Addresses)&lt;br /&gt;
Domain name / Network: *.itc2480.campus.ihitc.net&lt;br /&gt;
Records file: Automatic&lt;br /&gt;
Master server: *.itc2480.campus.ihitc.net.&lt;br /&gt;
Email address: root@ *.itc2480.campus.ihitc.net&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;NOTE:&#039;&#039;&#039; the * stands for your system name, &amp;quot;automail&amp;quot; was used when setting the mail server up.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;To create our &#039;&#039;A record&#039;&#039; which points your domain to an IP address, click the &#039;&#039;Address&#039;&#039; button.&amp;lt;/li&amp;gt;&lt;br /&gt;
* For the &#039;&#039;Name&#039;&#039; enter &#039;&#039;@&#039;&#039;.&lt;br /&gt;
* In the &#039;&#039;address&#039;&#039; field enter your VM&#039;s static IP and click &#039;&#039;Create&#039;&#039;.&lt;br /&gt;
&amp;lt;li&amp;gt;Create an &#039;&#039;MX&#039;&#039; record for the domain which directs mail for your delegated domain to your system as well. (This will involve creating another A record for &#039;&#039;mail.*.itc2480.campus.ihitc.net&#039;&#039; as well).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make sure to apply the changes using the button in the top right that shows two arrows in a cricle.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;After applying the changes and rebooting everything should be working. just make sure to test it using the nslookup and dig commands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Auto Maildir Clean Up==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create script to delete emails older than 45 days&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano &#039;&#039;&#039;&amp;lt;scriptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
find /home/testuser/Maildir/cur -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/new -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
find /home/testuser/Maildir/tmp -type f -mtime +45  -exec rm {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Make executable&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo chmod +x &#039;&#039;&#039;&amp;lt;sciptname.sh&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a &#039;&#039;&#039;crontab&#039;&#039;&#039; job&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: the astricks at the start of the following command are respective to the scheduling of time.  A good additional resource for &#039;&#039;&#039;cron&#039;&#039;&#039; is https://vitux.com/how-to-setup-a-cron-job-in-debian-10. Each astrik represents [Minute] [hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] &lt;br /&gt;
:* add the following line to the chrontab file to schedule the job at 8PM every day.&lt;br /&gt;
&amp;lt;pre&amp;gt;* 20 * * * * /home/ping/&#039;&#039;scriptname.sh&#039;&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mnjk-inver&amp;diff=9503</id>
		<title>Mnjk-inver</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mnjk-inver&amp;diff=9503"/>
		<updated>2021-02-18T03:00:12Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* List of Labs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Stylesheet=&lt;br /&gt;
&lt;br /&gt;
[[Stylesheet mnjk | Stylesheet]]&lt;br /&gt;
&lt;br /&gt;
=List of Labs=&lt;br /&gt;
&lt;br /&gt;
[[Lab 1 mnjk|Lab 1: Install Debian, check IP, remote access with ssh/sftp]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 2 mnjk|Lab 2]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 3 mnjk|Lab 3]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 4 mnjk|Lab 4]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 5 mnjk|Lab 5: Set static IP, install PHP/mySQL, experiment with websites and databases, view logfiles]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 6 mnjk|Lab 6]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 7 mnjk|Lab 7]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 8 mnjk|Lab 8]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 9 mnjk|Lab 9: Install Postfix MTA, courier-imap]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 10 mnjk|Lab 10]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 11 mnjk|Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 12 mnjk|Lab 12]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 13 mnjk|Lab 13]]&lt;br /&gt;
&lt;br /&gt;
[[Lab 14 mnjk|Lab 14]]&lt;br /&gt;
&lt;br /&gt;
[[mail server mnjk|mail]]&lt;br /&gt;
&lt;br /&gt;
=Test pages=&lt;br /&gt;
&lt;br /&gt;
[[Mike mnjk|Mike]]&lt;br /&gt;
&lt;br /&gt;
[[Nate mnjk|Nate]]&lt;br /&gt;
&lt;br /&gt;
[[Jon mnjk|Jon]]&lt;br /&gt;
&lt;br /&gt;
[[Kreid mnjk|Kreid]]&lt;br /&gt;
&lt;br /&gt;
=Lab 11 Rewrites=&lt;br /&gt;
&lt;br /&gt;
[[Final Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Mike Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Nate Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Jon Lab 11]]&lt;br /&gt;
&lt;br /&gt;
[[Kreid lab 11]]&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9502</id>
		<title>Lab 5 mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Lab_5_mnjk&amp;diff=9502"/>
		<updated>2021-02-18T02:40:57Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Set a static IP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
In this lab you will perform the following tasks:&lt;br /&gt;
*Learn about static network configuration of Debian Linux systems&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net PHP]&#039;&#039;&#039;&lt;br /&gt;
*Install &#039;&#039;&#039;[https://www.php.net MariaDB]&#039;&#039;&#039; on your server, this is an open-source MySQL alternative&lt;br /&gt;
*Experiment with websites and databases&lt;br /&gt;
*Explore the standard log files on your system.&lt;br /&gt;
&lt;br /&gt;
You will be introduced to the following commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifup ifup]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ifdown ifdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/ping ping]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/shutdown shutdown]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2ensite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://www.commandlinux.com/man-page/man8/a2dissite.8.html a2dissite]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/wget wget]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/zcat zcat]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/8/service service]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://linux.die.net/man/1/tail tail]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will also use the following MySQL (MariaDB) commands:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/use USE]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/show SHOW]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/select SELECT]&#039;&#039;&#039;&lt;br /&gt;
*&#039;&#039;&#039;[https://mariadb.com/kb/en/drop-database DROP database]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Lab Procedure=&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
# Open an SSH console to your Linux system using the PuTTY software, login with your standard user account&lt;br /&gt;
# Make a note of the static IP address information for your particular system in the table below, it is based on the system name identification letter in vmWare. These IP addresses will ONLY be valid in the ITC vmWare Linux class subnet. If you are working on a local VirtualBox system you will need to select an available static IP from the correct subnet for your system or skip the static IP addressing section. All vmWare systems will use a gateway address of 172.17.50.1 and a subnet mask of 255.255.255.0 with two nameservers 172.17.139.11 and 172.17.139.111&lt;br /&gt;
{| {{table}}&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;System ID&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Static IP&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| A||172.17.50.11&lt;br /&gt;
|-&lt;br /&gt;
| B||172.17.50.12&lt;br /&gt;
|-&lt;br /&gt;
| C||172.17.50.13&lt;br /&gt;
|-&lt;br /&gt;
| D||172.17.50.14&lt;br /&gt;
|-&lt;br /&gt;
| E||172.17.50.15&lt;br /&gt;
|-&lt;br /&gt;
| F||172.17.50.16&lt;br /&gt;
|-&lt;br /&gt;
| G||172.17.50.17&lt;br /&gt;
|-&lt;br /&gt;
| H||172.17.50.18&lt;br /&gt;
|-&lt;br /&gt;
| I||172.17.50.19&lt;br /&gt;
|-&lt;br /&gt;
| J||172.17.50.20&lt;br /&gt;
|-&lt;br /&gt;
| K||172.17.50.21&lt;br /&gt;
|-&lt;br /&gt;
| L||172.17.50.22&lt;br /&gt;
|-&lt;br /&gt;
| M||172.17.50.23&lt;br /&gt;
|-&lt;br /&gt;
| N||172.17.50.24&lt;br /&gt;
|-&lt;br /&gt;
| O||172.17.50.25&lt;br /&gt;
|-&lt;br /&gt;
| P||172.17.50.26&lt;br /&gt;
|-&lt;br /&gt;
| Q||172.17.50.27&lt;br /&gt;
|-&lt;br /&gt;
| R||172.17.50.28&lt;br /&gt;
|-&lt;br /&gt;
| S||172.17.50.29&lt;br /&gt;
|-&lt;br /&gt;
| T||172.17.50.30&lt;br /&gt;
|-&lt;br /&gt;
| U||172.17.50.31&lt;br /&gt;
|-&lt;br /&gt;
| V||172.17.50.32&lt;br /&gt;
|-&lt;br /&gt;
| W||172.17.50.33&lt;br /&gt;
|-&lt;br /&gt;
| X||172.17.50.34&lt;br /&gt;
|-&lt;br /&gt;
| Y||172.17.50.35&lt;br /&gt;
|-&lt;br /&gt;
| Z||172.17.50.36&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set a static IP==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=VcPA6gJ0Ohw&amp;amp;feature=youtu.be Video Tutorial - Setting a Static IP Address]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
:&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install PHP &amp;amp; MySQL/MariaDB==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=Az0qtg4LSjA&amp;amp;feature=youtu.be Video Tutorial -  Install PHP and MySQL MariaDB]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install packages&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using &#039;&#039;&#039;apt&#039;&#039;&#039;, install the &#039;&#039;php&#039;&#039; and &#039;&#039;mariadb-server&#039;&#039; packages as well as the &#039;&#039;php-mysql&#039;&#039; package which provides the link between php and mysql and the &#039;&#039;libapache2-mod-php&#039;&#039; package which provides a copy of PHP which allows the Apache webserver to run website PHP scripts.&lt;br /&gt;
&#039;&#039; Note: Remember to do an &#039;&#039;&#039;apt update&#039;&#039;&#039; before installing packages to make sure you get the latest versions&lt;br /&gt;
&#039;&#039; Note: Maria-DB is a fully compatible replacement for MySQL that isn&#039;t controlled by Oracle.&lt;br /&gt;
* After the dependencies are found, go ahead and accept them to continue the install.&lt;br /&gt;
&amp;lt;li&amp;gt; After the install is complete, &#039;&#039;&#039;cd&#039;&#039;&#039; to &#039;&#039;/var/www/html&#039;&#039; which is the root directory of your webserver and so where all website files are served from.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; In order to fully enable the PHP-MySQL module you should restart your Apache webserver. You don&#039;t need to restart your entire system to do this. Do some research on the &amp;quot;apache2ctl&amp;quot; or the &amp;quot;service apache2&amp;quot;  commands which can be used to do this.&lt;br /&gt;
&amp;lt;li&amp;gt; At this point we will test to verify that php is working properly with Apache. Create a new file named &#039;&#039;phptest.php&#039;&#039;, and then open it in a text editor.&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039; Note: you may have to use sudo to create and edit files in this directory.  as your standard user account may not have privilidges to create and edit files in this directory.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo touch phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano phptest.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Enter the following into the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;?php&lt;br /&gt;
phpinfo();&lt;br /&gt;
?&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Now save the file, and on your local machine go to xxx.xxx.xxx.xxx/phptest.php in a web browser where xxx.xxx.xxx.xxx is your VM&#039;s static IP. You should now be on a page that shows your PHP Version, and system information.&amp;lt;/li&amp;gt; &lt;br /&gt;
:[[File:Lab5_php_info.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Use the &amp;quot;View Source&amp;quot; option in your browser to see what the HTML source code is for the page you&#039;re viewing is. Is it the same or different than the .php file you created? Why? How is this different than a standard .html file?&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Lab5_php_info_devtab.png|500px]]&lt;br /&gt;
:[[Media:Lab5_php_info_devtab.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Website PHP==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=m_sUrt_quX4&amp;amp;feature=youtu.be Video Tutorial - Experiment with Website PHP]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore Apache symlinks&amp;lt;/li&amp;gt;&lt;br /&gt;
:In a previous lab we learned about editing the &#039;&#039;/var/www/index.html&#039;&#039; file to change the default web page displayed by your server. In a future lab you will install some PHP/MySQL based software which powers many Internet sites with forums, blogs, etc. Before we can do that we need to learn a little more about PHP and about databases. Like most software on Linux the Apache webserver configuration files are stored in the &#039;&#039;/etc&#039;&#039; directory. Specifically, you can find several of them which work together and are called from each other in &#039;&#039;/etc/apache2/&#039;&#039; take a look in the &#039;&#039;/etc/apache2/sites-enabled/&#039;&#039; directory. See how symlinks are used to point to configuration files which actually reside in the &#039;&#039;/etc/apache2/sites-available/&#039;&#039; directory? This allows us to turn off and on various sites by creating or removing a symlink rather than by deleting the actual configuration file, a handy thing if we just want to temporarily disable a site. In fact Apache provides a utility to automatically add and remove these links called &#039;&#039;&#039;a2ensite&#039;&#039;&#039; and &#039;&#039;&#039;a2dissite&#039;&#039;&#039;. Check the &#039;&#039;&#039;man&#039;&#039;&#039; pages for these commands to see how they work.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore &#039;&#039;&#039;/etc/apche2/sites-enabled&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:As you might have guessed the default site for your system is configured by the file linked to at &#039;&#039;/etc/apache2/sites-enabled/000-default&#039;&#039; If you open this file in your favorite text editor you will see a series of what Apache calls &amp;quot;directives&amp;quot; which explain how the webserver should function, what port it should listen on, where the website files will reside (&#039;&#039;/var/www/html&#039;&#039;), etc. &lt;br /&gt;
:&#039;&#039; NOTE: Going into all of the different Apache directives is outside of the scope of this course but you will find a lot of documentation about them on the Internet.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the Apache configuration files in Webmin&amp;lt;/li&amp;gt;&lt;br /&gt;
:In addition to configuring Apache directly through it&#039;s configuration files you can also configure it through an interface like Webmin which we installed in a previous lab. Bring up the Webmin configuration page for Apache and take a look at the settings for the default site. Note how the things you saw directly in the configuration file match up with what you see in Webmin. One of the things you may be interested in seeing is how the webserver knows to display the index.html file from a directory if it exists and no specific file is requested in the URL. Take a look on the &amp;quot;Directory Indexing&amp;quot; page for the default virtualhost and see if you can find this information. You&#039;ll notice that there is a list of files, not just index.html which the server will display.&lt;br /&gt;
:&#039;&#039; NOTE: You may need to refresh your Webmin modules or &amp;quot;scan for new modules&amp;quot; if you haven&#039;t done that since installing Apache and Webmin. Webmin scans your system for compatible server software packages (like Apache) when it is installed but needs to re-scan it&#039;s modules after you install new server software before you can configure it through Webmin.&lt;br /&gt;
&amp;lt;li&amp;gt;Expiriment with and learn PHP basics&amp;lt;/li&amp;gt;&lt;br /&gt;
:In another section of this lab you created a basic &#039;&#039;phptest.php&#039;&#039; file and saw how the server executed the PHP code and turned it into an HTML page your browser could display. Because PHP offers an easy way to write web applications it powers much of the Internet. To prepare us for setting up some PHP applications in a future lab it will be helpful to know a little about how PHP scripts work. Read through the [http://www.w3schools.com/php/default.asp W3 Schools PHP Basics Tutorial] (PHP Intro through PHP Superglobals) and try creating some PHP scripts on your own Linux server like the examples given in the tutorial pages to see if you can get them to run, try modifying them a little bit and see what the results are. There are many great Internet resources devoted to understanding how to do things with PHP so take some time to see how this language can be easily integrated in websites. You should definitely be familiar with editing PHP files to change variables, echo statements, etc. work which are all skills you&#039;ll need when installing PHP based website software.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own PHP files&amp;lt;/li&amp;gt;&lt;br /&gt;
:*Try writing some simple PHP scripts on your own using variables and echo statements and make them available through your webserver.&lt;br /&gt;
:*A good place to create these would be in your home directory, using your favorite text editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Create your own &amp;quot;home&amp;quot; page by editing your &#039;&#039;index.html&#039;&#039; file located in the &#039;&#039;&#039;/var/www/html&#039;&#039;&#039; directory.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You will need to be familiar with the very basics of editing HTML files in order to create links, etc. If you haven&#039;t done this before there are many introductory HTML tutorials available online.  A good starting place is [https://www.w3schools.com/html/html_basic.asp W3 Schools HTML Basics Examples]&lt;br /&gt;
:&#039;&#039; NOTE:It is importatnt to know that an &#039;&#039;&#039;html&#039;&#039;&#039; file must include the &amp;lt;!DOCTYPE HTML&amp;gt; tag.  Additionally, you will notice that all tags have an opening tag and a closing tag.  The information between the tags is what will have the features of the tag&lt;br /&gt;
:*Backup your &#039;&#039;index.html&#039;&#039; file by copying to a new file name.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo cp /var/www/html/index.html /var/www/html/index.html.bak&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Edit your &#039;&#039;index.html&#039;&#039; file (or create a new &#039;&#039;index.php&#039;&#039; file which will be loaded instead if it exists) so there is a list and links to the various scripts you have created as part of your PHP experimentation.&lt;br /&gt;
:* Open your index.html file in your favorite text editor,&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo nano /var/www/html/index.html&amp;lt;/code&amp;gt;&lt;br /&gt;
:*Since you have backed up the original index.html file I would edit this file to only include the basics.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;My ITC-2480 Server&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;This is a server on Pod-R in NetLab at 172.17.50.XX&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Here are some of the Projects I am working on:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;http://172.17.50.XX/phptest.php&amp;quot;&amp;gt;PHP Version Information&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Make sure to replace the XX in the IP with the IP address of your server.&lt;br /&gt;
:&lt;br /&gt;
:[[File:Lab5_basic_html.png|link=https://wiki.ihitc.net/mediawiki/images/2/29/Lab5_basic_html.png|500px]]&lt;br /&gt;
:[[Media:Lab5_basic_html.png|Click here for a larger image]]&lt;br /&gt;
:A first look for a basic page&lt;br /&gt;
:[[File:Lab5_initial_home.png|link=https://wiki.ihitc.net/mediawiki/images/9/92/Lab5_initial_home.png|500px]]&lt;br /&gt;
:[[Media:Lab5_initial_home.png|Click for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Try to add additional features to your &amp;quot;home&amp;quot; page.&amp;lt;/li&amp;gt;&lt;br /&gt;
:&#039;&#039;NOTE: You may get some ideas of features you might like to add by looking at the original &#039;&#039;index.html&#039;&#039; file that we backed up in step 6 of this lab.&lt;br /&gt;
:*As you complete your labs consider what you can add to this page.&lt;br /&gt;
:*Add links to the PHP scripts you created&lt;br /&gt;
:*A few good chalanges would be to add a title, change font size, style or color.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Experiment with Databases==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=1zYXiWLoGdM&amp;amp;feature=youtu.be Video Tutorial - Experiment with Databases]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: In order to do really powerful things with a website we need a database where we can store dynamic content which can be queried to automatically build site pages from a template. One of the most common databases is an SQL database, and MySQL has long been the most prevalent Linux SQL software. These days MariaDB, which we installed, has been taking some MySQL marketshare because it is a community developed program instead of MySQL which is now owned by Oracle. The MariaDB software and MySQL software are essentially equivalent, especially for small sites/databases, and the same commands are used interchangeably including using the &#039;&#039;&#039;mysql&#039;&#039;&#039; command to access them. SQL itself is a standard language for interacting with a specific type of database called a relational database, we&#039;ll see why it&#039;s called a relational database in a minute. Each database is a collection of data stored in tables. You can think of a table as something like a spreadsheet with rows and columns, except we call the columns fields and the rows records (sometimes we actually call them rows too). The different tables are often related to one another, of course they are usually being used by the same web application, but usually the relationship goes deeper than that as we&#039;ll see in a little bit.&lt;br /&gt;
&amp;lt;li&amp;gt;Download a sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To jumpstart our exploration of databases we&#039;ll download a pre-built sample database with a few tables and many records already in it and import it into our MySQL database server. Download the employees database file [https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2 employees_db-full-1.0.6.tar.bz2] (about 26MB) and get it into your home directory. Instead of using the &#039;&#039;&#039;links&#039;&#039;&#039; browser to do this or downloading to your computer and then pushing this large file back across the Internet with an SCP/SFTP client like FileZilla a better choice might be to learn about the &#039;&#039;&#039;wget&#039;&#039;&#039; program which can be used like &amp;quot;&#039;&#039;&#039;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&#039;&#039;&#039;&amp;quot; to download the file into your current working directory.&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Unpack the database file&amp;lt;/li&amp;gt;&lt;br /&gt;
: Figure out how to use the &#039;&#039;&#039;tar&#039;&#039;&#039; program to unpack this .tar.bz2 file. Note that this file uses bz2 compression which takes longer to compress than gzip but can compress the files more. Once unpacked you should have an &amp;quot;employees_db&amp;quot; folder.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the files included with sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: Inside the &#039;&#039;employees_db&#039;&#039; folder you should have a number of &#039;&#039;.sql&#039;&#039; script files and dump files which can be used to restore the database to your system.&lt;br /&gt;
:*Take a look at the &#039;&#039;employees.sql&#039;&#039; file, it&#039;s just a text file, which describes the format of the database. &lt;br /&gt;
:*Also take a look at the &#039;&#039;load_employees.dump&#039;&#039; file, also just a text file, which contains all of the records from the employees table of the database. :&#039;&#039; NOTE: there are 300,000 some employee records in this database so you probably don&#039;t want to just use &#039;&#039;&#039;cat&#039;&#039;&#039; to view these files as it could take a while to print them out to your screen. Using the &#039;&#039;&#039;less&#039;&#039;&#039; program would be a better choice as it will allow you to exit viewing the file by pressing q at any time.&lt;br /&gt;
&amp;lt;li&amp;gt;Open the MySQL (MariaDB) command line&amp;lt;/li&amp;gt;&lt;br /&gt;
: We can interact with the MySQL/MariaDB server in many different ways. The first way we&#039;ll take a look at is through the command line &#039;&#039;&#039;mysql&#039;&#039;&#039; program. Run the &amp;quot;&#039;&#039;&#039;sudo mysql&#039;&#039;&#039;&amp;quot; command. &lt;br /&gt;
:&#039;&#039; NOTE: that we are running this command with system administrator permissions which allows us to log in to the MySQL server with database administrator permissions as well. The MySQL program actually stores it&#039;s own usernames and passwords as a MySQL database itself, you can create and modify these permissions from the mysql command line but we&#039;ll learn more about modifying them through the Webmin interface later.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo MySQL&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_cli.png|link=https://wiki.ihitc.net/mediawiki/images/4/4f/Lab5_mariadb_cli.png|500px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_cli.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Explore MySQL (MariaDB) Commands&amp;lt;/li&amp;gt;&lt;br /&gt;
: MySQL has it&#039;s own command line language the you can use through the &amp;quot;mysql&amp;gt;&amp;quot; prompt you are now running. For example, if we want to see a list of databases on the system we can run &amp;quot;&#039;&#039;&#039;SHOW databases;&#039;&#039;&#039;&amp;quot; run the command and note the databases that already exist by default.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW databases;&amp;lt;/code&amp;gt;&lt;br /&gt;
:&#039;&#039; NOTE: Each MySQL/MariaDB statement ends with a semicolon (;) if you do not put the semicolon at the end of the line the command will not execute when you press enter and you will be able to continue to add more commands to the statement before finishing with a semicolon. If you accidentally press enter without ending with a semicolon you can just enter a semicolon on the next line and press enter.&lt;br /&gt;
&amp;lt;li&amp;gt;Import the sample database&amp;lt;/li&amp;gt;&lt;br /&gt;
: To import the employee database we can use the &amp;quot;&#039;&#039;&#039;source employees.sql;&#039;&#039;&#039;&amp;quot; command (assuming we were already working in the directory which contains the employees.sql file when we launched mysql. Import the employee database and verify the system now has an employees database.&lt;br /&gt;
&amp;lt;code&amp;gt;SOURCE employees.sql;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the employees database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;USE employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
: If we want to see all of the tables in the employees database we must first select the database we want to work on using the &amp;quot;&#039;&#039;&#039;USE employees;&#039;&#039;&#039;&amp;quot; command.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the employee table&amp;lt;/li&amp;gt;&lt;br /&gt;
: Use the &amp;quot;&#039;&#039;&#039;SHOW tables;&#039;&#039;&#039;&amp;quot; command to see a list of tables.&lt;br /&gt;
&amp;lt;code&amp;gt;SHOW tables;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View a list of employees in table&amp;lt;/li&amp;gt;&lt;br /&gt;
: To see a list of all the records in a table we need to run a SELECT query &amp;quot;&#039;&#039;&#039;SELECT * from &#039;&#039;&amp;lt;tablename&amp;gt;&#039;&#039;&#039;&#039;&#039;&amp;quot; like &amp;quot;&#039;&#039;&#039;SELECT * from employees&#039;&#039;&#039;&amp;quot; which will list all the records in the &#039;&#039;employees&#039;&#039; table of the employees database and display them.&lt;br /&gt;
&amp;lt;code&amp;gt;SELECT * from employees;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:[[File:Lab5_mariadb_show_tables.png|link=https://wiki.ihitc.net/mediawiki/images/d/d5/Lab5_mariadb_show_tables.png|350px]]&lt;br /&gt;
:[[Media:Lab5_mariadb_show_tables.png|Click here for a larger image]]&lt;br /&gt;
:* Remember that we previously selected to USE the &#039;&#039;employees&#039;&#039; database, this will be remembered until we USE a different database. Try displaying the records in a couple of different tables like employees and departments.&lt;br /&gt;
:&#039;&#039; NOTE: The output can be broken by using CTRL-C on your local machine if you do not wish to wait for all of the records to be displayed.&lt;br /&gt;
:&lt;br /&gt;
: There is much more that we can do from the MySQL/MariaDB command line but that would be a whole class or more itself. The MySQL/MariaDB programs are well documented on the Internet and with these basic skills you should be able to figure out most of it. Remember, the vast majority of what you read about MySQL will also work in MariaDB and vice-versa.&lt;br /&gt;
&amp;lt;li&amp;gt;Explore the MySQL interface in Webmin&lt;br /&gt;
: Now that you have learned a bit about MySQL databases from the command line let&#039;s see how they look in the Webmin web management interface. Log back in to your Webmin interface through a browser on your host system.&lt;br /&gt;
:* Because MySQL was not installed when we first setup Webmin you need to &amp;quot;scan for new modules&amp;quot; first. Once that process has finished refresh the page to see that MySQL has been added to the server section of Webmin.&lt;br /&gt;
:* Take a look at the Webmin MySQL module and see how MySQL users and permissions are configured.&lt;br /&gt;
:* Try browsing through the &#039;&#039;employees&#039;&#039; database using the Webmin interface including viewing tables and records inside of the tables.&lt;br /&gt;
&amp;lt;li&amp;gt;Drop database and exit MySQL (MariaDB)&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Go back to your MySQL command line window and run the command &amp;quot;&#039;&#039;&#039;DROP DATABASE employees;&#039;&#039;&#039;&amp;quot; to delete the entire database.&lt;br /&gt;
:* Type &amp;quot;&#039;&#039;&#039;exit;&#039;&#039;&#039;&amp;quot; to quit the MySQL program and return to a Linux shell.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039; NOTE: Obviously, the DROP command is one to be careful with as you can easily wipe out a huge database with one line! &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==View Logfiles==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[https://www.youtube.com/watch?v=cxIOQF-eMy0&amp;amp;feature=youtu.be Video Tutorial - Tutorial 5 View Logfiles]&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
: Linux stores most of log files in the &#039;&#039;/var/log&#039;&#039; directory so change your working directory to &#039;&#039;/var/log&#039;&#039;.&lt;br /&gt;
: Some log files are viewable by all users on the system but other log files may be restricted and you will need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to view them.&lt;br /&gt;
&amp;lt;li&amp;gt;View last 20 lines in &#039;&#039;&#039;/var/log/syslog&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;tail -20 /var/log/syslog&amp;lt;/code&amp;gt;&lt;br /&gt;
:[[File:Lab5_tail.png|link=https://wiki.ihitc.net/mediawiki/images/8/88/Lab5_tail.png|500px]]&lt;br /&gt;
:[[Media:Lab5_tail.png|Click here for a larger image]]&lt;br /&gt;
: Linux log files are typically standard text files and can be read with standard text file utilities like cat or less. One additional utility which comes in hand is the &#039;&#039;&#039;tail&#039;&#039;&#039; program which displays the last 10 lines (by default) of a text file and which can be configured to display more or less lines using a command like &#039;&#039;&#039;tail -20 /var/log/syslog&#039;&#039;&#039; which will display the last 20 lines of the main system log file. The manual page for the &#039;&#039;&#039;tail&#039;&#039;&#039; command contains additional information like how to use the &#039;&#039;-f&#039;&#039; option to view a log in realtime (exit with Ctrl-C).&lt;br /&gt;
&amp;lt;li&amp;gt;Explore some other log files&amp;lt;/li&amp;gt;&lt;br /&gt;
: Take a look at some of the log files on your system and see what kinds of information they contain specifically you should probably look at &#039;&#039;syslog&#039;&#039;, &#039;&#039;auth.log&#039;&#039;, &#039;&#039;kern.log&#039;&#039;, &#039;&#039;apache2/access.log&#039;&#039;, and &#039;&#039;apache2/error.log&#039;&#039; &lt;br /&gt;
:* Use the tail command to explore these logs&lt;br /&gt;
: In order to prevent log files from completely filling your drive old log files are eventually rotated on the system and compressed and then finally deleted. Take a look at some of the rotated log files like &#039;&#039;/var/log/syslog.1&#039;&#039; or &#039;&#039;/var/log/kern.log.1&#039;&#039; which will contain slightly older log entries.&lt;br /&gt;
:&#039;&#039; Note: After the first rotated file other files are usually compressed with gzip. You can decompress and view these on the fly using the &#039;&#039;&#039;zcat&#039;&#039;&#039; program.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9501</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9501"/>
		<updated>2021-02-18T02:36:29Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Set Static IP Address */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
:* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
:* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
:* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
: * Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
: * Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
:&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
:* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
:* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
:* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
:* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
:* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9500</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9500"/>
		<updated>2021-02-18T02:34:57Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Add User &amp;quot;Ping&amp;quot;, Install Webmin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or &#039;&#039;&#039;wget&#039;&#039;&#039; to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
&#039;&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9499</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9499"/>
		<updated>2021-02-18T02:34:43Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Add User &amp;quot;Ping&amp;quot;, Install Webmin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser or wget to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
&#039;&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9498</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9498"/>
		<updated>2021-02-18T02:34:04Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Add User &amp;quot;Ping&amp;quot;, Install Webmin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
&#039;&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9497</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9497"/>
		<updated>2021-02-18T02:33:08Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Add User &amp;quot;Ping&amp;quot;, Install Webmin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;ping&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; adduser ping&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
&#039;&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9496</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9496"/>
		<updated>2021-02-18T02:32:33Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Basic Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;jsmith&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; adduser jsmith &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
&#039;&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9495</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9495"/>
		<updated>2021-02-18T02:31:09Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Basic Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install nmap&amp;lt;/li&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
:* Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;jsmith&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; adduser jsmith &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
&#039;&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9494</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9494"/>
		<updated>2021-02-18T02:29:50Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Basic Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
:&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;jsmith&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; adduser jsmith &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
&#039;&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9493</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9493"/>
		<updated>2021-02-18T02:28:54Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Basic Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:* &#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the following command at the command line.&lt;br /&gt;
:&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;jsmith&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; adduser jsmith &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
&#039;&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9492</id>
		<title>Mail server mnjk</title>
		<link rel="alternate" type="text/html" href="https://wiki.ihitc.net/mediawiki/index.php?title=Mail_server_mnjk&amp;diff=9492"/>
		<updated>2021-02-18T02:27:50Z</updated>

		<summary type="html">&lt;p&gt;JonQuinn: /* Install Basic Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
:This section documents the creation of the Auto-Reply Mail Server.  This section will likely be created by an instructor or administrator.&lt;br /&gt;
==Mail Server Documentation==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Power on you Virtual machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* This server may reside in the VMware ESXi or NetLab as long as the network configuration allows connection to the course VLAN and student VM&#039;s.&lt;br /&gt;
&amp;lt;li&amp;gt;Install Debian Linux&amp;lt;/li&amp;gt;&lt;br /&gt;
: Once the system has booted and is on the &amp;quot;Debian GNU/Linux installer menu&amp;quot; choose &amp;quot;Install&amp;quot; and &#039;&#039;&#039;not&#039;&#039;&#039; &amp;quot;Graphical Install&amp;quot;. If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.&lt;br /&gt;
: In the installer you will use the space bar to select and unselect &amp;quot;checkboxes&amp;quot;, the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices&lt;br /&gt;
* Select &#039;&#039;English&#039;&#039; as the language, &#039;&#039;United States&#039;&#039; as your location, and &#039;&#039;American English&#039;&#039; as the keymap.&lt;br /&gt;
* Set &#039;&#039;ens192&#039;&#039; as your primary network interface.&lt;br /&gt;
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like &#039;&#039;2480-Z&#039;&#039; for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the &amp;quot;Topology&amp;quot; and &amp;quot;Linux Server&amp;quot; tabs and you should see a line with &amp;quot;LSA Pod&amp;quot; followed by a letter, that letter is your pod ID letter.&lt;br /&gt;
:&#039;&#039; Note: These steps are critical to future success in labs, check your spelling carefully&#039;&#039; &lt;br /&gt;
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_hostname.png|Click here for a larger image]]&lt;br /&gt;
* Set the domain name to &#039;&#039;itc2480.campus.ihitc.net&#039;&#039;&lt;br /&gt;
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]]&lt;br /&gt;
: [[Media:Lab1_domainname.png|Click here for a larger images]]&lt;br /&gt;
* Set the root password to something you will NOT FORGET, this is the administrator account, &#039;&#039;cisco&#039;&#039; might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)&lt;br /&gt;
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget&lt;br /&gt;
* Select your timezone&lt;br /&gt;
* Choose &amp;quot;Guided - Use entire disk&amp;quot; as the partitioning method and select the &#039;&#039;sda&#039;&#039; drive and &amp;quot;All files in one partition&amp;quot; as the partitioning scheme, &amp;quot;Finish partitioning and write the changes to the disk&amp;quot;, and then finally confirm you want to write the changes.&lt;br /&gt;
* You do not want to scan any other CDs or DVDs at this time.&lt;br /&gt;
* You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is &amp;quot;debian.uchicago.edu&amp;quot; with no http proxy.&lt;br /&gt;
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.&lt;br /&gt;
* On the software selection screen UNSELECT &amp;quot;Debian desktop environment&amp;quot; and &amp;quot;Print server&amp;quot; and make sure that &amp;quot;SSH server&amp;quot; and &amp;quot;Standard system utilities&amp;quot; are the only two selected options.&lt;br /&gt;
:&#039;&#039; Note: To select and unselect options move your cursor over the option and press the space bar.&lt;br /&gt;
* Choose that yes you want to install GRUB to the master boot record on the &#039;&#039;/dev/sda&#039;&#039; device.&lt;br /&gt;
&amp;lt;li&amp;gt;Complete the installation&amp;lt;/li&amp;gt;&lt;br /&gt;
: When the installation is complete you can select continue to &amp;quot;eject&amp;quot; the virtual CD and reboot into the new install&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Basic Tools==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;sudo&#039;&#039;&#039; from the command line using:&lt;br /&gt;
: &#039;&#039;Note: A good practice is to update your system before installing any packages, this should be completed using &#039;&#039;&#039;apt update&#039;&#039;&#039;, ensure to use &#039;&#039;&#039;sudo&#039;&#039;&#039; when not logged in as root.&lt;br /&gt;
: &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;apt install sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the &#039;&#039;&#039;sudo&#039;&#039;&#039; program. The &#039;&#039;&#039;sudo&#039;&#039;&#039; program is not installed by default so after you have logged in to the root account enter &#039;&#039;&#039;apt update&#039;&#039;&#039; and press enter which will update the list of software available for installation and then &#039;&#039;&#039;apt install sudo&#039;&#039;&#039; and press enter to install the sudo software.&lt;br /&gt;
&amp;lt;li&amp;gt;Add sudo privileges to our standard user account.&lt;br /&gt;
:&amp;lt;code&amp;gt;adduser &amp;lt;username&amp;gt; sudo&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command &#039;&#039;&#039;sudo adduser &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; sudo&#039;&#039;&#039; and press enter, replacing &#039;&#039;&amp;lt;username&amp;gt;&#039;&#039; with the name of your standard user account (set during the setup process, probably your first name in lowercase). We&#039;ll learn more about these commands later in the course.&lt;br /&gt;
&amp;lt;li&amp;gt;Reboot system&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shutdown -r now&amp;lt;/code&amp;gt;&lt;br /&gt;
: Reboot your system using the &#039;&#039;&#039;shutdown -r now&#039;&#039;&#039; command to apply the changes&lt;br /&gt;
&amp;lt;li&amp;gt;Log in as your standard user account, determine system IP address.&lt;br /&gt;
: Once you are logged in use the following command at the command line to determine the IP address of your system&lt;br /&gt;
:&amp;lt;code&amp;gt;ip address show&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command will allow you to check the IP address of your system. The IP address should be something like &#039;&#039;172.17.50.xxx&#039;&#039; and be an &#039;&#039;inet&#039;&#039; address on the &#039;&#039;ens192&#039;&#039; adapter.&lt;br /&gt;
: [[File:Lab1_ip_address_show2.PNG|500px]]&lt;br /&gt;
&amp;lt;li&amp;gt;Test sudo privileges&amp;lt;/li&amp;gt;&lt;br /&gt;
: Try running the same command as the administrator by typing &#039;&#039;&#039;sudo ip address show&#039;&#039;&#039;, you will need to enter in your password again when you run this command.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ip address show&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Connect into your system using the remote SSH console method explained above.&lt;br /&gt;
&amp;lt;li&amp;gt;Install &#039;&#039;&#039;open-vm-tools&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install open-vm-tools&#039;&#039;&#039; command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install open-vm-tools&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course.  This course&#039;s labwork often builds upon the work you have done in previous labs.  The self-check scripts are to assist you in ensuring you have not missed any &#039;&#039;critical&#039;&#039; steps in your work that would affect your success in subsequent labs.&lt;br /&gt;
&lt;br /&gt;
:* &#039;&#039;NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!&lt;br /&gt;
:*At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Open a SSH session to your server&amp;lt;/li&amp;gt;&lt;br /&gt;
: Run the following command at the command line.&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install nmap&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Run the &#039;&#039;&#039;sudo apt install nmap&#039;&#039;&#039; command to install the nmap tool. You will be prompted about additional software packages required to be installed, type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter to install the software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Exit from the local console&amp;lt;/li&amp;gt;&lt;br /&gt;
: To log out of the console type &#039;&#039;&#039;exit&#039;&#039;&#039; and press enter.&lt;br /&gt;
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add User &amp;quot;Ping&amp;quot;, Install Webmin==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Create a new user account &#039;&#039;&#039;jsmith&#039;&#039;&#039; using the &#039;&#039;&#039;adduser&#039;&#039;&#039; program&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt; adduser jsmith &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use the &#039;&#039;&#039;links&#039;&#039;&#039; browser to download the &#039;&#039;&#039;DEB&#039;&#039;&#039; package file from &#039;&#039;&#039;[https://www.webmin.com www.webmin.com]&#039;&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: Because this DEB file was downloaded directly instead of automatically by APT from a package repository the installation command is slightly different and some other commands such as &#039;&#039;&#039;apt show&#039;&#039;&#039; will not work.&#039;&#039;&lt;br /&gt;
&amp;lt;li&amp;gt;Install the package with &#039;&#039;&#039;apt install&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install ./&amp;lt;filename.deb&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: Don&#039;t forget that installation of software must be done with system administrator permissions.&#039;&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
:[[File:Apt-install-webmin.png | link= https://wiki.ihitc.net/mediawiki/images/f/f8/Apt-install-webmin.png | 500px]]&lt;br /&gt;
:[[Media:Apt-install-webmin.png | Click for Larger Image]]&lt;br /&gt;
: &#039;&#039;NOTE: You can get similar information to what you can get with &#039;&#039;&#039;apt show&#039;&#039;&#039; from a &#039;&#039;&#039;DEB&#039;&#039;&#039; package file using the following command:&#039;&#039;&lt;br /&gt;
: &amp;lt;code&amp;gt;dpkg -I &amp;lt;filename&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Notice the additional packages which are required by Webmin (dependencies) which will be downloaded and installed by &#039;&#039;&#039;apt&#039;&#039;&#039; from a repository in order to complete the installation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open a web browser on your host system and visit https://xxx.xxx.xxx.xxx:10000 where your IP replaces xxx.xxx.xxx.xxx&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login using your Debian username and password &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Explore the Webmin interface&lt;br /&gt;
:[[file:Webmin-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/0/0f/Webmin-dashboard.png | 500px]]&lt;br /&gt;
:[[media:Webmin-dashboard.png | Click for Larger Image]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
==Set Static IP Address==&lt;br /&gt;
&lt;br /&gt;
: An important first step is to learn how to diferenciate between network interfaces. Take a look at [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ this site] and [https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L20 this site] to understand how network interface names in Debian 9 and later are identified.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set a static IP for your server&amp;lt;/li&amp;gt;&lt;br /&gt;
* Using your text editor of choice, open up the file &#039;&#039;/etc/network/interfaces&#039;&#039;&lt;br /&gt;
* Notice how it is currently set to dhcp for the &#039;&#039;ens192&#039;&#039; interface.&lt;br /&gt;
* To set a static IP, you will need to change &#039;&#039;iface ens192 inet dhcp&#039;&#039; to &#039;&#039;iface ens192 inet static&#039;&#039;.&lt;br /&gt;
* Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.&lt;br /&gt;
:&#039;&#039;&#039; Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.&lt;br /&gt;
&#039;&#039; Note: Your configuration should be similar to this:&lt;br /&gt;
&amp;lt;pre&amp;gt;allow-hotplug ens192&lt;br /&gt;
iface ens192 inet static&lt;br /&gt;
	address xxx.xxx.xxx.xxx&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 172.17.50.1&lt;br /&gt;
	dns-nameservers 172.17.139.11 172.17.139.111&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Now save the file, and exit your file editor.&lt;br /&gt;
&amp;lt;li&amp;gt;Apply your static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Now we are going to apply the static IP change. Try using &#039;&#039;&#039;ip address show&#039;&#039;&#039; to view your active configuration now and you should see that your old address is still active.&lt;br /&gt;
&#039;&#039;&#039;NOTE: You should only make network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.&#039;&#039;&#039; If you lose working SSH access to your system after making these changes you&#039;ll need to connect in through the NetLab console interface (which is equivalent to physical access) and find and correct your configuration issues.&lt;br /&gt;
* Using the &#039;&#039;&#039;ifdown&#039;&#039;&#039; and &#039;&#039;&#039;ifup&#039;&#039;&#039; command, we are going to restart the network interface, this step is required to apply the change.&lt;br /&gt;
&#039;&#039; Note: A good method to watch this change is to have to ping windows open on your local machine ping both your old IP address and your new IP address with a &#039;&#039;&#039;ping 172.17.50.xx -t&#039;&#039;&#039; this will allow you to see how quickly the change will happen.  The first image below is with the DHCP address, the second is after the static address is applied.&lt;br /&gt;
:[[File:Lab5_ping_ifup_ifdown.png|link=https://wiki.ihitc.net/mediawiki/images/2/2f/Lab5_ping_ifup_ifdown.png|500px]]&lt;br /&gt;
:[[Media:Lab5_ping_ifup_ifdown.png|Click here for a larger image]]&lt;br /&gt;
* In a SSH terminal, run &#039;&#039;&#039;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&#039;&#039;&#039;. Notice the two &#039;&#039;&amp;amp;&amp;amp;&#039;&#039; symbols. This tells the Linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.&lt;br /&gt;
: &amp;lt;code&amp;gt;sudo ifdown ens192 &amp;amp;&amp;amp; sudo ifup ens192&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039; Note: you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
* At this point, your machine should now be using a static address. You may receive an error message indicating that an address cannot be assigned which is related to your old DHCP address still being on the interface as well. Use &#039;&#039;&#039;ip address show&#039;&#039;&#039; to verify the new IP address is assigned to the interface.&lt;br /&gt;
&amp;lt;li&amp;gt;Verify the new static IP address&amp;lt;/li&amp;gt;&lt;br /&gt;
* Used a &#039;&#039;&#039;ping&#039;&#039;&#039; command from your local PC to try pinging both the old DHCP address as well as your new static address of your VM. &lt;br /&gt;
* Once you have verified the VM is responding on the new static IP address reboot the system to ensure the old DHCP address is removed by restarting your VM with &#039;&#039;&#039;sudo shutdown -r now&#039;&#039;&#039; Note you will lose your SSH connection because the IP your SSH session is connected to is no longer in use by your VM.&lt;br /&gt;
&amp;lt;li&amp;gt;Reconnect through SSH to your new IP address and verify it is now applied using the &#039;&#039;&#039;ip address show&#039;&#039;&#039; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DNS Section==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Auto Reply Configuration==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install vacation&amp;lt;/li&amp;gt;&lt;br /&gt;
: Vacation is a Linux package that will auto-respond to received emails for the receiving users. &lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run the vacation program in the profile you wish to set up the reply message from&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;vacation&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Follow the prompts, for now reply with the default answer (Y)&amp;lt;/li&amp;gt;&lt;br /&gt;
: [[File:MAILSVR_vaca_prompts.png|link=https://wiki.ihitc.net/mediawiki/images/7/76/MAILSVR_vaca_prompts.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_prompts.png|Click here for a larger image]]&lt;br /&gt;
&amp;lt;li&amp;gt;Edit the vacation.msg file&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nano vacation.msg&amp;lt;/code&amp;gt; &lt;br /&gt;
: [[File:MAILSVR_vaca_msg.png|link=https://wiki.ihitc.net/mediawiki/images/b/b9/MAILSVR_vaca_msg.png|500px]]&lt;br /&gt;
: [[Media:MAILSVR_vaca_msg.png|Click for a larger image]]&lt;br /&gt;
:* Enter the message that you would like to have in the auto-response.&lt;br /&gt;
&amp;lt;li&amp;gt;Set the response to auto mail every message&amp;lt;/li&amp;gt;&lt;br /&gt;
: The default response is every one week to send an auto-reply, for our use it is important to reply to every email.&lt;br /&gt;
&amp;lt;code&amp;gt;vacation -i -r 0&amp;lt;/code&amp;gt;&lt;br /&gt;
: &#039;&#039;NOTE: It is important to understand this command sets the auto-reply delay. Using the &#039;&#039;&#039;-r 0&#039;&#039;&#039; sets the vacation program to reply to EVERY message it receives.  In a production environment, this is not recommended as it can create mail loops.&lt;br /&gt;
&amp;lt;li&amp;gt;Test your reply message from the CLI &#039;&#039;&#039;mailutils&#039;&#039;&#039; package or the MTA chosen to use on client computers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>JonQuinn</name></author>
	</entry>
</feed>