Lab 08 ‐ Web Server - Isaiah-River/SYS-255-02-SYSAdmin GitHub Wiki

Main Lab

Overview

This lab involves setting up a webserver virtual machine and installing Apache. The end of the lab it goes into some basic PHP scripting.

Objectives:

  • Setup web01
  • Install httpd
  • Configure httpd
  • Join web01 to AD domain

Part 01 - Configuring web01

The first part of this lab involved setting up and configuring web01. To do this I first cabled web01 with an LAN connection, and then used the commmand nmtui to configure the IPv4 to be 10.0.5.4, joined the domain isaiah.local, and set the hostname to web01-isaiah.

image image

After configuring these, I created a new administrator user using the command useradd isaiah to create the user 'isaiah'. I then use the command passwd isaiah to set a password for the account. I then needed to give the account administrative privlages with the command usermod -aG wheel isaiah.

image

After this I logged into the adm02-isaiah VM, launched DNS manager, and created A and PTR records for web-01-isaiah.

image

I then went back to web01-isaiah, and sent a control+alt+delete to restart the VM, and tested connectivity to other computers in the network, google.com, and confirmed that computers on my network could ping web01-isaiah through the hostname. After confirming this I was ready to move on with the lab.

Part 02 - SSH Security

With my VM successfully configured with successful connectivity it was time to disable the remote SSH. In order to do this I needed to edit the configuration file for SSH. I did this by using the command sudo vi /etc/ssh/sshd_config, and then finding the #PermitRootLogin yes and changing the yes to no.

image

After saving the file, I went to my ad02-isaiah VM, and used PowerShell to try to SSH into the root account using the command ssh root@web01-isaiah, which proved to be unsuccessful indicating that the web01-isaiah is no longer permitting login through the root account.

image

After configuring web01-isaiah, and disabling the ability to SSH into the root account, I used SSH to connect to web01-isaiah with my created administrative user account isaiah. I then used the command ping -c1 champlain.edu | grep packet to test connectivity to champlain.edu over one hop, and get the response that includes the string “packet” highlighted.

image

With SSH secured a little bit better, it was time to move onto installing Apache.

Part 03 - Running Apache

To set up Apache I started by installing the httpd packet using the command sudo yum install httpd.

image

After this I had to open up the ports 80/tcp and 443/tcp in my firewall. To do this I used the commands firewall-cmd --zone=public --add-port=80/tcp --permanent & firewall-cmd --zone=public --add-port=443/tcp --permanent

image

After this I enabled httpd using the command systemctl enable httpd and then used the command systemctl start httpd to start the service.

image

I then used the command firewall-cmd --list-all to show the enabled ports.

image

I then went to wks02-isaiah, and opened a web browser and connected to http://web01-isaiah to show that I am now able to navigate to my Apache landing page through the hostname.

image

After this I created my own landing page by first stopping the httpd service using the command systemctl stop httpd, after this I created a html file called index under /var/www/html/index.html using the command touch /var/www/html/index.html. I then used vi to edit index.html using the command vi /var/www/html/index.html to add a greeting to the new landing page. I then restarted the httpd services with systemctl start httpd, when I reloaded my webpage connected to web01-isaiah, I was greeted by my "fancy" new landing.

image

After customizing my Web Server landing page, it was time to move on to installing PHP.

Part 04 - PHP

My next move was to install PHP using the command sudo yum install -y php.

image

After this it was time to familiarize myself with some PHP. I started by creating index.php by using the command touch /var/www/html/index.php and then vi /var/www/html/index.php to edit the .php file with vi editor.

image

Using vi, I created a PHP script that will print the numbers starting from 1 to 10 using a variable created called "x".

image

When navigating to http://web01-isaiah/index.php I was greeted with my working PHP script.

image

With my landing page and index.php working succesfully it was time to join the domain with my web01-isaiah Linux VM.

Part 05 - Linux Domain Join

To start I installed the some several packages with the command sudo yum install -y realmd samba samba-common oddjob oddjob-mkhomedir sssd

image

After this I joined the domain with the command realm join [email protected] isaiah.local, and then used the command realm list to show the realms that my computer is currently connected to.

image

After this I exited out of my SSH connection, and used the command ssh [email protected]@web01-isaiah to remote connect back into web01-isaiah with my isaiah.river-adm domain account

image

After this I went to adm02-isaiah, and launched Active Directory Users and Computers, and navigated to isaiah.local > Computers to show that web01-isaiah was in fact added to the domain

image

With this working I've completed the lab, leading me to do some further research on some of the further questions posed by the lab.


Further Research

What does PHP stand for? What's it good for?

As it turns out PHP is a recursive acronym, standing for PHP: Hypertext Preprocessor. Supposedly according to one source it originally meant Personal Home Page. PHP is a HTML-embedded scripting language that borrows a much of its syntax from C, Java, and Perl. The language is used to script websites that are interactive and dynamic. PHP is also utilized all over the internet on nearly all major websites.

What does SSH stand for?

SSH stands for Secure Shell.

What is that ECDSA host key warning I got while using SSH, and how do I resolve it?

image A host key is a cryptographic key that is used in the authentication of computers when using SSH protocol. In this case I've likely misconfigured something when I first tried to connect to web01-isaiah. In order to resolve this I had to remove the Cached key from my wks02-isaiah VM. I did this by using the command ssh-keygen -R 10.0.5.4.

image

After doing this and attempting to SSH into my web01-isaiah VM I no longer ran into the error I was receiving before.

image

What does the tail command do?

The command tail is used to print the last lines of a file. I used this command in my module for this lab to get the last entries of my Apache access log.

image

⚠️ **GitHub.com Fallback** ⚠️