Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6703 from mildas/rpm_verify_ownership_tests
rpm_verify_ownership test scenarios
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
.../software-integrity/rpm_verification/rpm_verify_ownership/tests/all_ownerships_ok.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Perform same steps as remediation | ||
declare -A SETOWNER_RPM_LIST | ||
FILES_WITH_INCORRECT_OWNERSHIP=($(rpm -Va --nofiledigest | awk '{ if (substr($0,6,1)=="U" || substr($0,7,1)=="G") print $NF }')) | ||
|
||
for FILE_PATH in "${FILES_WITH_INCORRECT_OWNERSHIP[@]}"; do | ||
RPM_PACKAGES=$(rpm -qf "$FILE_PATH") | ||
for pkg in $RPM_PACKAGES; do | ||
SETOWNER_RPM_LIST["$pkg"]=1 | ||
done | ||
done | ||
|
||
for RPM_PACKAGE in "${!SETOWNER_RPM_LIST[@]}"; do | ||
rpm --setugids "${RPM_PACKAGE}" | ||
done |
3 changes: 3 additions & 0 deletions
3
...tware-integrity/rpm_verification/rpm_verify_ownership/tests/wrong_group_ownership.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
chown :1 /etc/shadow |
3 changes: 3 additions & 0 deletions
3
...ty/software-integrity/rpm_verification/rpm_verify_ownership/tests/wrong_ownership.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
chown 1 /etc/shadow |