Skip to content

Commit f47770c

Browse files
committed
Add option to run particular oscap binary to the oscap-podman wrapper
1 parent f6f9767 commit f47770c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

utils/oscap-podman

100755100644
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,26 @@ function usage()
2828
echo "oscap-podman -- Tool for SCAP evaluation of Podman images and containers."
2929
echo
3030
echo "Compliance scan of Podman image:"
31-
echo "$ sudo oscap-podman IMAGE_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]"
31+
echo "$ sudo oscap-podman [--oscap=<OSCAP_BINARY>] IMAGE_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]"
3232
echo
3333
echo "Compliance scan of Podman container:"
34-
echo "$ sudo oscap-podman CONTAINER_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]"
34+
echo "$ sudo oscap-podman [--oscap=<OSCAP_BINARY>] CONTAINER_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]"
3535
echo
3636
echo "See \`man oscap\` to learn more about semantics of OSCAP_ARGUMENT options."
3737
}
3838

39+
OSCAP_BINARY=oscap
40+
3941
if [ $# -lt 1 ]; then
4042
echo "No arguments provided."
4143
usage
4244
die
4345
elif [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
4446
usage
4547
die
48+
elif [[ "$1" == --oscap=* ]] && [ $# -gt 2 ]; then
49+
OSCAP_BINARY=${1#"--oscap="}
50+
shift
4651
elif [ "$#" -gt 1 ]; then
4752
true
4853
else
@@ -81,7 +86,7 @@ export OSCAP_PROBE_ARCHITECTURE="$(uname --hardware-platform)"
8186
export OSCAP_EVALUATION_TARGET="$TARGET"
8287
shift 1
8388

84-
oscap "$@"
89+
$OSCAP_BINARY "$@"
8590
EXIT_CODE=$?
8691
podman umount $ID > /dev/null || die
8792
if [ $CLEANUP -eq 1 ]; then

utils/oscap-podman.8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ This script cannot run in rootless mode.
1212
Usage of the tool mimics usage and options of oscap(8) tool.
1313

1414
.SS Compliance scan of Podman container image:
15-
oscap-podman IMAGE_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]
15+
oscap-podman [--oscap=<OSCAP_BINARY>] IMAGE_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]
1616

1717
.SS Compliance scan of Podman container:
18-
oscap-podman CONTAINER_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]
18+
oscap-podman [--oscap=<OSCAP_BINARY>] CONTAINER_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]
1919

2020
Refer to oscap(8) to learn about OSCAP_ARGUMENT options.
2121

0 commit comments

Comments
 (0)