Skip to content

Commit f13fdc8

Browse files
implement change request + RHEL8 support
1 parent f76e317 commit f13fdc8

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

utils/oscap-docker.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!@OSCAP_DOCKER_PYTHON@
22

33
# Copyright (C) 2015 Brent Baude <[email protected]>
4-
# Copyright (C) 2019 Dominique Blaze <[email protected]>
4+
# Copyright (C) 2019 Dominique Blaze <[email protected]>
55
#
66
# This library is free software; you can redistribute it and/or
77
# modify it under the terms of the GNU Lesser General Public
@@ -108,7 +108,6 @@ if __name__ == '__main__':
108108
if args.action == "scan":
109109
rc = OscapDockerScan.scan(ODS, leftover_args)
110110
elif args.action == "scan_cve":
111-
print("Scan cve !")
112111
rc = OscapDockerScan.scan_cve(ODS, leftover_args)
113112
else:
114113
parser.print_help()
@@ -122,7 +121,7 @@ if __name__ == '__main__':
122121
sys.exit(255)
123122
except Exception as exc:
124123
traceback.print_exc(file=sys.stdout)
125-
sys.stderr.write("!!! WARNING !!! This software have crash, so you should "
124+
sys.stderr.write("!!! WARNING !!! This software have crashed, so you should "
126125
"check that no temporary container is still running\n")
127126
sys.exit(255)
128127

utils/oscap_docker_python/oscap_docker_util.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,6 @@ def __init__(self, message):
8181
except AtomicError as err:
8282
sys.stderr.write(err.message)
8383

84-
''' print state of atomic import '''
85-
if atomic_loaded:
86-
print("Atomic seems well installed and ready for use")
87-
else:
88-
print("Cannot load Atomic, native docker api will be used instead"
89-
" (requires root privileges)")
90-
91-
9284
def isAtomicLoaded():
9385
return atomic_loaded
9486

@@ -104,7 +96,7 @@ class OscapError(Exception):
10496
class OscapHelpers(object):
10597
''' oscap class full of helpers for scanning '''
10698
CPE = 'oval:org.open-scap.cpe.rhel:def:'
107-
DISTS = ["7", "6", "5"]
99+
DISTS = ["8", "7", "6", "5"]
108100

109101
def __init__(self, cve_input_dir, oscap_binary):
110102
self.cve_input_dir = cve_input_dir
@@ -134,7 +126,10 @@ def _get_dist(self, chroot, target):
134126
'''
135127
cpe_dict = '/usr/share/openscap/cpe/openscap-cpe-oval.xml'
136128
if not os.path.exists(cpe_dict):
137-
raise OscapError()
129+
cpe_dict = '/usr/local/share/openscap/cpe/openscap-cpe-oval.xml'
130+
if not os.path.exists(cpe_dict):
131+
raise OscapError()
132+
138133
for dist in self.DISTS:
139134
result = self.oscap_chroot(chroot, target, 'oval', 'eval',
140135
'--id', self.CPE + dist, cpe_dict,

utils/oscap_docker_python/oscap_docker_util_noatomic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class OscapError(Exception):
4040

4141
class OscapDockerScan(object):
4242
CPE_RHEL = 'oval:org.open-scap.cpe.rhel:def:'
43-
DISTS = ["7", "6", "5"]
43+
DISTS = ["8", "7", "6", "5"]
4444

4545
def __init__(self, target, is_image=False, oscap_binary='oscap'):
4646

@@ -174,7 +174,10 @@ def _get_dist(self):
174174
'''
175175
cpe_dict = '/usr/share/openscap/cpe/openscap-cpe-oval.xml'
176176
if not os.path.exists(cpe_dict):
177-
raise OscapError()
177+
cpe_dict = '/usr/local/share/openscap/cpe/openscap-cpe-oval.xml'
178+
if not os.path.exists(cpe_dict):
179+
raise OscapError()
180+
178181
for dist in self.DISTS:
179182
result = self.oscap_chroot(
180183
self.mountpoint, self.oscap_binary,

0 commit comments

Comments
 (0)