Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Regression/RHEL-1843-capsh-print-all/PURPOSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PURPOSE of /CoreOS/libcap/Regression/RHEL-1843-capsh-print-all
Description: This test verifies the improved output of the `capsh --print` command as requested in RHEL-1843. It ensures that full capability sets are represented by the keyword "all" and empty sets by "none".
Author: QE Automation <sec-eng-special@redhat.com>
Bug: https://issues.redhat.com/browse/RHEL-1843
19 changes: 19 additions & 0 deletions Regression/RHEL-1843-capsh-print-all/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
summary: Test for RHEL-1843 - capsh --print should use "all" for full capability sets
description: |
Bug: https://issues.redhat.com/browse/RHEL-1843
This test verifies that the `capsh --print` command now uses the keyword "all"
to represent a full set of capabilities, and "none" for an empty set,
making the output more intuitive and less prone to misinterpretation.
contact: QE Automation <sec-eng-special@redhat.com>
test: ./runtest.sh
framework: beakerlib
recommend:
- libcap
duration: 5m
tag:
- rhel-9
- rhel-10
adjust:
- enabled: false
when: distro < rhel-9.9
continue: false
35 changes: 35 additions & 0 deletions Regression/RHEL-1843-capsh-print-all/runtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1

rlJournalStart
rlPhaseStartSetup "Setup"
rlAssertRpm "libcap"
rlPhaseEnd

rlPhaseStartTest "Verify capsh --print output for full capabilities"
# For a root user, the default capabilities should be full.
# The output should now contain 'all' instead of a long list of individual capabilities.
rlRun "capsh --print"
rlAssertGrep "Current: all=ep" "$rlRun_LOG" "Check for 'all=ep' in Current capabilities"
rlAssertGrep "Bounding set: all" "$rlRun_LOG" "Check for 'all' in Bounding set"
rlPhaseEnd

rlPhaseStartTest "Verify capsh --print output for empty ambient set"
# The ambient set is typically empty for a root user.
# The output should now explicitly say 'none'.
rlRun "capsh --print"
rlAssertGrep "Ambient set: none" "$rlRun_LOG" "Check for 'none' in Ambient set"
rlPhaseEnd

rlPhaseStartTest "Verify capsh --print output for a non-root user (no capabilities)"
rlRun "useradd capsh_test_user"
rlRun "su - capsh_test_user -c 'capsh --print'"
rlAssertGrep "Current: =" "$rlRun_LOG" "Current capabilities should be empty for non-root user"
rlRun "userdel -r capsh_test_user"
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Outdated
rlPhaseEnd

rlPhaseStartCleanup "Cleanup"
# No cleanup needed in this case
rlPhaseEnd
rlJournalPrintText
rlJournalEnd