Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit f392eb8

Browse files
committed
Support for atomic help feature
* Added container/help.sh to print basic info about openscap image including its version and info about bundled OpenSCAP packages. * generate-dockerfile.py extended to support atomic help feature * Example usage: sudo atomic help openscap or: sudo atomic help openscap | grep version
1 parent 74cdc86 commit f392eb8

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

container/help.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
DOCKER="/usr/bin/docker"
4+
SELF=$1
5+
6+
VERSION=$(${DOCKER} inspect -f '{{ index .Config.Labels "version" }}' ${SELF})
7+
RELEASE=$(${DOCKER} inspect -f '{{ index .Config.Labels "release" }}' ${SELF})
8+
if [ -z ${RELEASE} ]; then
9+
echo -e "${SELF} image version: ${VERSION}\n"
10+
else
11+
echo -e "${SELF} image version: ${VERSION}-${RELEASE}\n"
12+
fi
13+
14+
DESCRIPTION=$(${DOCKER} inspect -f '{{ index .Config.Labels "description" }}' ${SELF})
15+
echo -e "Description:\n${DESCRIPTION}\n"
16+
17+
echo "OpenSCAP packages bundled in ${SELF} image:"
18+
rpm -qa | grep openscap
19+
rpm -qa | grep scap-security-guide

generate-dockerfile.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
("io.k8s.description", "OpenSCAP is an auditing tool that utilizes the Extensible Configuration Checklist Description Format (XCCDF). XCCDF is a standard way of expressing checklist content and defines security checklists."),
1414
("io.openshift.tags", "security openscap scan"),
1515
("install", "docker run --rm --privileged -v /:/host/ IMAGE sh /root/install.sh IMAGE"),
16-
("run", "docker run -it --rm -v /:/host/ IMAGE sh /root/run.sh")
16+
("run", "docker run -it --rm -v /:/host/ IMAGE sh /root/run.sh"),
17+
("help", "docker run --rm --privileged -v /usr/bin:/usr/bin -v /var/run:/var/run -v /lib:/lib -v /lib64:/lib64 -v /etc/sysconfig:/etc/sysconfig IMAGE sh /root/help.sh IMAGE")
1718
]
1819
packages = [
1920
"bzip2",
@@ -24,7 +25,8 @@
2425
("container/run.sh", "/root"),
2526
("container/openscap", "/root"),
2627
("container/config.ini", "/root"),
27-
("container/remediate.py", "/root")
28+
("container/remediate.py", "/root"),
29+
("container/help.sh", "/root")
2830
]
2931
env_variables = [
3032
("container", "docker")

0 commit comments

Comments
 (0)