Skip to content

Commit 9b9d656

Browse files
authored
Merge pull request #1386 from evgenyz/oscap-vm
utils/oscap-vm: Add ability to run uninstalled oscap-vm.
2 parents 0ac7fb3 + ba3f28d commit 9b9d656

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

utils/oscap-docker.8

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
oscap-docker \- Tool for running oscap within docker container or image
44
.SH DESCRIPTION
55
oscap-docker tool can asses vulnerabilities or security compliance of running Docker
6-
containers or cold Docker images. OpenSCAP tool (oscap) is used underneath. Definition
6+
containers or cold Docker images. OpenSCAP tool \fBoscap(8)\fR is used underneath. Definition
77
of vulnerabilities (CVE stream) is downloaded from product vendor.
88

99
.SS Compliance scan of Docker image
1010
Usage: oscap-docker image IMAGE_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]
1111

12-
Run any OpenSCAP (oscap) command within chroot of mounted docker image. Learn more
13-
about oscap arguments in oscap(8) man page.
12+
Run any OpenSCAP \fBoscap(8)\fR command within chroot of mounted docker image. Learn more
13+
about arguments in \fBoscap(8)\fR man page.
1414

1515
.SS Compliance scan of Docker container
1616
Usage: oscap-docker container CONTAINER_NAME OSCAP_ARGUMENT [OSCAP_ARGUMENT...]
1717

18-
Run any OpenSCAP (oscap) command within chroot of mounted docker container. Result
18+
Run any OpenSCAP \fBoscap(8)\fR command within chroot of mounted docker container. Result
1919
of this command may differ from scanning just an image due to defined mount points.
2020

2121
.SS "Vulnerability scan of Docker image"
@@ -30,6 +30,8 @@ Usage: oscap-docker container-cve CONTAINER_NAME [--results oval-results-file.xm
3030
Chroot to running container, determine OS variant/version, download CVE stream applicable
3131
to the given OS and finally run a vulnerability scan.
3232

33+
In order to use different \fBoscap(8)\fR binary pass it like --oscap=<path/to/oscap>, as the first argument.
34+
3335
.SH SECURITY POLICIES
3436
.TP
3537
\fB SCAP-Security-Guide\fR package contains multiple configuration policies.

utils/oscap-vm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ function usage()
2828
echo
2929
echo "Usage:"
3030
echo
31-
echo "$ oscap-vm image VM_STORAGE_IMAGE xccdf eval [options] INPUT_CONTENT"
32-
echo "$ oscap-vm domain VM_DOMAIN xccdf eval [options] INPUT_CONTENT"
31+
echo "$ oscap-vm [--oscap=<oscap_binary>] image VM_STORAGE_IMAGE xccdf eval [options] INPUT_CONTENT"
32+
echo "$ oscap-vm [--oscap=<oscap_binary>] domain VM_DOMAIN xccdf eval [options] INPUT_CONTENT"
3333
echo
3434
echo "supported oscap xccdf eval options are:"
3535
echo " --profile"
@@ -73,13 +73,18 @@ function usage()
7373
echo "See \`man oscap\` to learn more about semantics of these options."
7474
}
7575

76+
OSCAP_BINARY=oscap
77+
7678
if [ $# -lt 1 ]; then
7779
echo "No arguments provided."
7880
usage
7981
die
8082
elif [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
8183
usage
8284
die
85+
elif [[ "$1" == --oscap=* ]] && [ $# -gt 3 ]; then
86+
OSCAP_BINARY=${1#"--oscap="}
87+
shift
8388
elif [ "$1" == "image" ] && [ $# -gt 2 ]; then
8489
true
8590
elif [ "$1" == "domain" ] && [ $# -gt 2 ]; then
@@ -132,7 +137,7 @@ OSCAP_PROBE_ARCHITECTURE="$(uname --hardware-platform)" # TODO
132137
export OSCAP_EVALUATION_TARGET="oscap-vm $1 $2"
133138
shift 2
134139

135-
oscap "$@"
140+
$OSCAP_BINARY "$@"
136141
EXIT_CODE=$?
137142
echo "Unmounting '$MOUNTPOINT'..."
138143
$UNMOUNT_COMMAND "$MOUNTPOINT"

utils/oscap-vm.8

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
oscap-vm \- Tool for offline SCAP evaluation of virtual machines.
55

66
.SH SYNOPSIS
7-
\fBoscap-vm domain\fR \fIVM_DOMAIN [OSCAP_OPTIONS] INPUT_CONTENT
7+
\fBoscap-vm\fR \fI[--oscap=<oscap_binary>]\fR \fBdomain\fR \fIVM_DOMAIN [OSCAP_OPTIONS] INPUT_CONTENT
88

9-
\fBoscap-vm image\fR \fIVM_STORAGE_IMAGE [OSCAP_OPTIONS] INPUT_CONTENT
9+
\fBoscap-vm\fR \fI[--oscap=<oscap_binary>]\fR \fBimage\fR \fIVM_STORAGE_IMAGE [OSCAP_OPTIONS] INPUT_CONTENT
1010

1111
.SH DESCRIPTION
1212
\fBoscap-vm\fR performs SCAP evaluation of virtual machine domains or virtual machine images.
@@ -26,6 +26,8 @@ Usage of the tool mimics usage and options of \fBoscap(8)\fR tool.
2626
The type of scan target (either \fIdomain\fR or \fIimage\fR) has to be specified first. Then identify the target by the domain name (name of a named libvirt domain) or the image path, respectively.
2727
Domain UUIDs can be used instead of names. Any domains including the running domains can be scanned.
2828

29+
Optionally, as the very first argument, different \fBoscap(8)\fR binary could be chosen to perform the scan, like --oscap=<path/to/oscap>.
30+
2931
The rest of the options are passed directly to \fBoscap(8)\fR utility. For the detailed description of its options please refer to \fBoscap(8)\fR manual page. However some of its options are not supported in \fBoscap-vm\fR because offline evaluation is used.
3032

3133
Last argument is SCAP content input file.

0 commit comments

Comments
 (0)