This course is using an outdated version of the technology and is now considered to be Legacy content. It will be removed from our catalog on June 28, 2024. Please be sure to complete your course and finish any remaining labs before that date. We recommend moving to version 9.2, which is the latest version currently available.
This Guided Exercise requires that the previous exercise has been successfully completed. In this exercise, you will use NBDE to automatically decrypt a LUKS device at boot time, using three Tang servers if they are available and falling back to manual decryption by password if they are not.
Outcomes
You should be able to:
Install and configure a Tang server.
Decrypt a LUKS partition with multiple Tang servers.
Verify that workstation and servera are started.
Log in to workstation as student using student as the password.
On workstation, run lab luks-nbde setup to verify that the environment is ready.
[student@workstation ~]$lab luks-nbde setup
Install Tang servers on serverb, serverc, and serverd.
Open the firewall on those nodes to allow the default port for tang servers (80/TCP).
Log in to serverb as student.
No password is required.
[student@workstation ~]$ssh student@serverb[student@serverb ~]$
Use the sudo -i command to change to the root user.
Use student as the password.
[student@serverb ~]$sudo -i[sudo] password for student:student[root@serverb ~]#
Install the tang package.
[root@serverb ~]#yum install tang...output omitted...Is this ok [y/d/N]:y...output omitted... Installed: tang.x86_64 0:6-1.el7 ...output omitted... Complete!
Enable socket activation for the Tang server.
[root@serverb ~]#systemctl enable tangd.socket --nowCreated symlink from /etc/systemd/system/multi-user.target.wants/tangd.socket to /usr/lib/systemd/system/tangd.socket.
Open the 80/TCP port for the Tang server.
When done, log out from serverb.
[root@serverb ~]#firewall-cmd --zone=public --add-service=httpsuccess[root@serverb ~]#firewall-cmd --zone=public --add-service=http \>--permanentsuccess[root@serverb ~]#logout[student@serverb ~]$logout[student@workstation ~]$
Perform the same steps for serverc and serverd.
You can install and configure the Tang servers on serverb, serverc, and serverd with the /home/student/RH415/labs/luks-nbde/install_tang.yml Ansible Playbook.
On workstation as student, change the working directory to /home/student/RH415/labs/luks-nbde, and run the install_tang.yml playbook with the ansible-playbook command as follows:
[student@workstation ~]$cd ~/RH415/labs/luks-nbde[student@workstation luks-nbde]$ansible-playbook install_tang.yml
On servera, associate the LUKS-encrypted partition on /dev/vdb1 with the Tang servers on serverb, serverc, and serverd.
Configure SSS encryption so that at least two Tang servers must be available to decrypt the partition.
Log in to servera as student.
No password is required.
[student@workstation ~]$ssh student@servera[student@servera ~]$
Use the sudo -i command to change to the root user.
Use student as the password.
[student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#
Install the packages required to configure servera as a Clevis client.
[root@servera ~]#yum install clevis clevis-luks clevis-dracut...output omitted...Is this ok [y/d/N]:y...output omitted... Installed: clevis.x86_64 0:7-4.el7 clevis-dracut.x86_64 0:7-4.el7 clevis-luks.x86_64 0:7-4.el7 ...output omitted... Complete!
Associate the LUKS-encrypted partition on /dev/vdb1 with the Tang servers on serverb, serverc, and serverd.
Configure the SSS encryption so the three Tang servers must be available to decrypt the partition.
[root@servera ~]#cfg=$'{"t":3,"pins":{"tang":[\n>{"url":"http://serverb.lab.example.com"},\n>{"url":"http://serverc.lab.example.com"},\n>{"url":"http://serverd.lab.example.com"}]}}'[root@servera ~]#clevis luks bind -d /dev/vdb1 sss "$cfg"The advertisement contains the following signing keys:4R1tkfaTw-67bW0uxTAmTprUPooDo you wish to trust these keys? [ynYN]YThe advertisement contains the following signing keys:gks_IaVo1yog0KuQei95rg_yGnsDo you wish to trust these keys? [ynYN]YThe advertisement contains the following signing keys:vA5xAeUiKPqvkg4UyR4TemzXoAwDo you wish to trust these keys? [ynYN]YYou are about to initialize a LUKS device for metadata storage. Attempting to initialize it may result in data loss if data was already written into the LUKS header gap in a different format. A backup is advised before initialization is performed. Do you wish to initialize /dev/vdb1? [yn]yEnter existing LUKS password:redhatRHT
To avoid errors, you can copy and paste the previous command from the /home/student/RH415/labs/luks-nbde/tang-conf.txt file on workstation.
Enable clevis-luks-askpass.path to support non-root LUKS-encrypted partitions.
[root@servera ~]#systemctl enable clevis-luks-askpass.pathCreated symlink from /etc/systemd/system/remote-fs.target.wants/clevis-luks-askpass.path to /usr/lib/systemd/system/clevis-luks-askpass.path.
Configure the encrypted partition to automatically decrypt and mount on the /encrypted directory at boot time.
Modify the /etc/crypttab file to open the encrypted partition at boot time.
[root@servera ~]#vi /etc/crypttabencryptedvdb1 /dev/vdb1 none _netdev
Update the /etc/fstab file to mount the encrypted partition on the /encrypted directory.
When done, log out from servera.
[root@servera ~]#vi /etc/fstab...output omitted... /dev/mapper/encryptedvdb1 /encrypted xfs _netdev 1 2[root@servera ~]#logout[student@servera ~]#logout[student@workstation ~]$
Disable socket activation for the Tang server on serverb.
Reboot servera to verify that the LUKS-encrypted partition on /dev/vdb1 is decrypted and mounted automatically on the /encrypted directory by providing the encrypted partition passphrase at boot time.
The system asks for the passphrase at boot time because only two Tang servers are available.
Log in to serverb as student.
You do not need to enter any password.
[student@workstation ]$ssh student@serverb[student@serverb ~]$
Use the sudo -i command to change to the root user.
Use student as the password.
[student@serverb ]$sudo -i[sudo] password for student:student[root@serverb ~]#
Disable socket activation for the Tang server.
When done, log out from serverb.
[root@serverb ~]#systemctl disable tangd.socket --nowRemoved symlink /etc/systemd/system/multi-user.target.wants/tangd.socket.[root@serverb ~]#logout[student@serverb ~]$logout[student@workstation ~]$
Click → for servera to stop that virtual machine, and wait until the status for servera is STOPPED.
When done, click → for servera to start that virtual machine, and wait until the status for servera is STARTED.
Open the servera console while the system is booting.
The console prompts to enter manually the passphrase for the encrypted partition.
Enter redhatRHT as the passphrase.
On workstation, log in to servera as student.
You do not need to enter any password.
[student@workstation ~]$ssh student@servera[student@servera ~]#
Use the sudo -i command to change to the root user.
Use student as the password.
[student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#
Verify that the encrypted partition is mounted on the /encrypted directory.
When done, log out from servera.
[root@servera ~]#mount | grep /encrypted/dev/mapper/encryptedvdb1 on /encrypted type xfs (rw,relatime,seclabel,attr2,inode64,noquota,_netdev)[root@servera ~]#logout[student@servera ~]$logout[student@workstation ~]$
Enable socket activation for the Tang server on serverb. Reboot servera to verify that the LUKS-encrypted partition on /dev/vdb1 is decrypted and mounted automatically in the /encrypted directory.
Log in to serverb as student.
You do not need to enter any password.
[student@workstation ]$ssh student@serverb[student@serverb ~]$
Use the sudo -i command to change to the root user.
Use student as the password.
[student@serverb ]$sudo -i[sudo] password for student:student[root@serverb ~]#
Enable socket activation for the Tang server.
When done, log out from serverb.
[root@serverb ~]#systemctl enable tangd.socket --nowCreated symlink from /etc/systemd/system/multi-user.target.wants/tangd.socket to /usr/lib/systemd/system/tangd.socket.[root@serverb ~]#logout[student@serverb ~]$logout[student@workstation ~]$
Click → for servera to stop that virtual machine, and wait until the status for servera is STOPPED.
When done, click → for servera to start that virtual machine, and wait until the status for servera is STARTED.
Log in to servera as student.
You do not need to enter any password.
[student@workstation ~]$ssh student@servera[student@servera ~]#
Use the sudo -i command to change to the root user.
Use student as the password.
[student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#
Verify that the encrypted partition is mounted on the /encrypted directory.
[root@servera ~]#mount | grep /encrypted/dev/mapper/encryptedvdb1 on /encrypted type xfs (rw,relatime,seclabel,attr2,inode64,noquota,_netdev)
Verify that the previously created file is still available in the /encrypted directory.
When done, log out from servera.
[root@servera ~]#ls /encryptedtestfile[root@servera ~]#logout[student@servera ~]#logout[student@workstation ~]$
Rotate the keys for the Tang server on serverb.
Log in to serverb as student.
You do not need to enter any password.
[student@workstation ~]$ssh student@serverb[student@serverb ~]$
Use the sudo -i command to change to the root user.
Use student as the password.
[student@serverb ~]$sudo -i[sudo] password for student:student[root@serverb ~]#
Generate new signature and exchange keys in the directory for the Tang server key database, /var/db/tang.
The Tang server uses the new keys automatically for new client bindings.
[root@serverb ~]#cd /var/db/tang[root@serverb tang]#jose jwk gen -i '{"alg":"ES512"}' \>-o signature.jwk[root@serverb tang]#jose jwk gen -i '{"alg":"ECMR"}' \>-o exchange.jwk
Rename the old keys with a . as a prefix.
The names of your old keys may be different.
[root@serverb tang]#mvgxB7oqYiEu3zrLayhymtD10sV9E.jwk \>.gxB7oqYiEu3zrLayhymtD10sV9E.jwk[root@serverb tang]#mvk25k6PbmgUu-pWWUb210xgBelhfQ.jwk \>.k25k6PbmgUu-pWWUb210xgBelhfQ.jwk