Assignment 2 - Linux Filesystem Integrity Check with HASH and AIDE -Win23(1)
Assignment 2 - Linux Filesystem Integrity Check with HASH and AIDE -Win23(1)
Required Resources
RedHat Enterprise Linux VM with Internet access.
d. Still from the terminal window, issue the command below to hash the text file. The command will use MD5
as hashing algorithm to generate a hash of the text file. The hash will be displayed on the screen after
OpenSSL has computed it.
openssl md5 t1.txt
Note down or screenshot the output:
Notice the format of the output. OpenSSL displays the hashing algorithm used, MD5, followed by the
name of file used as input data. The MD5 hash itself is displayed after the equal (‘=’) sign.
Hash functions are useful for verifying the integrity of the data regardless of whether it is an image, a
song, or a simple text file. The smallest change results in a completely different hash. Hashes can be
calculated before and after transmission, and then compared. If the hashes do not match, then data was
modified during transmission.
Let’s modify the t1.txt text file and recalculate the MD5 hash. Click ApplicationAccessoriesText
Editor.
In Text Edit Window, Click Open Other Document Home to open t1.txt file.
Change the word gift to gifts, and then save the t1.txt file.
e. Now that the file has been modified and saved, run the same command again to generate a MD5 hash of
the file.
openssl md5 t1.txt
Note down or screenshot the output:
Is the new hash different than hash calculated in item (d)? How different?
f. MD5 hashes are considered weak and susceptible to attacks. More robust hashing algorithms include
SHA-1 and SHA-2. To generate a SHA-1 hash of the letter_to_grandma.txt file, use the command below:
openssl sha1 t1.txt
Note: Other tools exist to generate hashes. Namely, md5sum, sha1sum, and sha256sum can be used to
generate MD5, SHA-1 and SHA-2-256 hashes, respectively. Issue man openssl command to find the
HASH options, list here: _
________________________________________.
g. Use md5sum and sha1sum to generate MD5 and SHA-1 hash of the letter_to_grandma.txt file:
md5sum t1.txt
Note down or screenshot the output:
sha1sum t1.txt
Note down or screenshot the output:
Do the hashes generated with md5sum and sha1sum match the images generated in items (e) and (f),
respectively? Explain.
Yes,
Note: While SHA-1 has not yet been effectively compromised, computers are becoming more and more
powerful. It is expected that this natural evolution will soon make it possible for attackers to break SHA-1.
In a proactive move, SHA-2 is now the recommended standard for hashing. It is also worth noting that
SHA-2 is in fact, a family of hashing algorithms. The SHA-2 family is comprised of six hash functions,
namely SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256. These functions generate
hash values that are 224, 256, 384 or 512 bits long, respectively.
Step 1:
a. Now, work as root user. Run su root command, key in password.
b. Before using yum, register your system with an entitlement server by the following command.
(Note: the username and password are based on your account that you signed up in RedHat Developer portal
https://developers.redhat.com/?source=sso. Consult with RHEL Download and VM Installation file sign up
account info from installation steps.)
subscription-manager register --username username --password password --auto-attach
c. To see which installed packages on your system have updates available, use the following command:
yum check-update
Do you any packages installed on your Linux?
AIDE helps monitor those files that are recently changed or modified. You can keep track of
files or directories when someone tries to modify or change them.
cd ~
To verity if AIDE works as expected, now make some changes on your filesystem (by creating new files
and/or changing permissions of existing files.)
touch newt{1,2,3}.txt
You have created sample files- newt{1,2,3}, now delete any of these files.
Delete some sample files as the following:
rm newt3.txt
rm newt2.txt
Modify the content of newt5.txt text file as the following:
echo New content added for integrity testing. >>newt1.txt
cat newt1.txt
Issue command su root, key in the same password of the above account.
Note: $ (dollar sign) indicates regular user privilege. If a ‘#’ (hashtag or pound sign) is displayed
at the prompt, it indicates elevated privilege (root user).
b. Issue command useradd to add new user account in Linux. (Example, useradd jack)
c. Issue command passwd to create a password for the above new user. (Example, passwd
jack)
d. Create two more user accounts with passwords, list here:
Username Password
alex passalex
jack passjack
e. Issue command cat /etc/passwd to verify the above accounts. (Example, jack account)
jack:x:1001:1001::/home/jack:/bin/bash
The line has the following characteristics:
Issue command groups to verify the group membership of the new accounts. (Example,
groups jack). List your new user account group outputs.
If your Linux VM lab username is alex, how do you modify /etc/aide.conf file to allow AIDE to perform
PERMS group checks on /home/alex directory?
_______________yes_______________________________
Reference
https://www.redhat.com/sysadmin/linux-security-aide
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/
sec-using-aide