Labs Flashcards
serverb is relocated to Jamaica. update the time zone and view the recorded log events.
tzselect
sudo timedatectl set-timezone America/Jamaica
journalctl --since 06:49:00 --until 07:19:00
Configure rsyslog to write the Logging test authpriv.alert message to the /var/log/auth-errors file.
echo "authpriv.alert /var/log/auth-errors" >> /var/rsyslog.d/auth-erros.conf
sudo systemctl restart rsyslog
logger -p authpriv.alert "Logging test authpriv.alert"
sudo tail /var/log/auth-errors
On serverb, synchronize /etc directory from servera to the /configsync directory.
rsync -av root@servera:/etc /configsync
Create a configfile-backup-servera.tar.gz archive with the /configsync directory contents.
tar -czf configfile-backup-servera.tar.gz /configsync
Securely copy /root/configfile-backup-servera.tar.gz from serverb to the /home/student directory on workstation.
sftp student@workstation
put configfile-backup-servera.tar.gz
bye
Extract the content of configfile-backup-servera.tar.gz to /tmp/savedconfig/
mkdir /tmp/savedconfig && cd $_
tar -xzf ~/configfile-backup-servera.tar.gz
Change the current tuning profile for serverb to balanced. List the information for the balanced tuning profile when it is the current tuning profile.
dnf list tuned
dnf install -y tuned
sudo tuned-adm list
sudo tune-adm profile balanced
sudo tuned-adm profile_info
Two processes on serverb are consuming a high percentage of CPU usage. Adjust each process’s nice level to 10.
ps aux --sort=pcpu
ps -o pid,pcpu,nice,comm
sudo renice -n 10 1079 1095
Open http://serverb/lab.html web page. You see an error message. Research and identify the SELinux issue that prevents Apache from serving web content.
less /var/log/messages
sealert -l 35c9e452-2552-4ca3-8217-493b72ba6d0b
ausearch -m AVC -ts recent
Display the SELinux context of the new HTTP document directory and the original HTTP document directory. Resolve the SELinux issue that prevents the Apache server from serving web content.
ls -dZ /lab-content /var/www/html
semanage fcontext -a -t httpd_sys_content_t '/lab-content(/.*)?'
restorecon -R /lab-content/
serverb has several unused disks. On first, create a GPT partition label and a 2 GB GPT partition named backup.
Configure the backup partition to host an XFS file system.
lsblk
parted /dev/vdb mklabel gpt
parted /dev/vdb mkpart backup 1028s 2GB
mkds.xfs /dev/vdb
udevadm settle
Initialize the two 512 MB partitions as swap spaces, and configure them to activate at boot. Set the swap space on the swap2 partition to be preferred over the other.
mkswap /dev/vdb2 mkswap /dev/vdb3
swapon /dev/vdb2 swapon /dev/vdb3
UUID=87976166-4697-47b7-86d1-73a02f0fc803 swap swap pri=10 0 0 UUID=4d9b847b-98e0-4d4e-9ef7-dfaaf736b942 swap swap pri=20 0 0
systemctl daemon-reload
swapon -a
swap --show
Create a 512 MiB partition on the /dev/vdb disk. Initialize this partition as a physical volume, and extend the serverb_01_vg volume group to use this partition.
parted /dev/vdb unit MiB print
parted /dev/vdb mkpart primary 514MiB 1026MiB
udevadm settle
pvcreate /dev/vdb2
vgextend serverb_01_vg /dev/vdb2
lvextend -L 768M /dev/serverb_01_vg/serverb_01_lv
xfs_growfs /storage/data1
Create serverb_02_lv LV with 128 MiB. Create the XFS file system on the newly created volume. Mount the newly created logical volume on the /storage/data2 directory.
lvcreate -n serverb_02_lv -L 128M serverb_01_vg
mkfs -t xfs /dev/serverb_01_vg/serverb_02_lv
mkdir /storage/data2
/etc/fstab: /dev/serverb_01_vg/serverb_02_lv /storage/data2 xfs defaults 0 0
systemctl daemon-reload
mount /storage/data2
df -h /storage/data1
lvdisplay /dev/serverb_01_vg/serverb_01_lv
Configure an automounter indirect map on servera with exports from serverb. Create an indirect map with files that are named /etc/auto.master.d/shares.autofs for the master map and /etc/auto.shares for the mapping file. Use the /remote directory as the main mount point on servera.
/remote /etc/auto.shares
* -rw,sync,fstype=nfs4 serverb.lab.example.com:/shares/&
systemctl enable --now autofs
Change the default systemd target on the serverb machine for the system to automatically start a graphical interface when it boots.
systemctl set-default graphical.target
Log in to the serverb machine to determine what is preventing access to the web servers.
systemctl status httpd.service
sudo sealert -a /var/log/audit/audit.log