Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:15.4:ARM
openscap
openscap-docker-add-suse.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openscap-docker-add-suse.patch of Package openscap
From 9a434c4e613224b25b4dc56e38de32eb4cbdcd0c Mon Sep 17 00:00:00 2001 From: Marcus Meissner <meissner@suse.de> Date: Tue, 7 Dec 2021 11:57:21 +0100 Subject: [PATCH] added suse support --- utils/oscap_docker_python/get_cve_input.py | 20 +++++++++---- .../oscap_docker_common.py | 30 ++++++++++++++++++- 2 files changed, 44 insertions(+), 6 deletions(-) Index: openscap-1.3.5/utils/oscap_docker_python/get_cve_input.py =================================================================== --- openscap-1.3.5.orig/utils/oscap_docker_python/get_cve_input.py +++ openscap-1.3.5/utils/oscap_docker_python/get_cve_input.py @@ -31,9 +31,12 @@ class getInputCVE(object): hdr = {'User-agent': 'Mozilla/5.0'} hdr2 = [('User-agent', 'Mozilla/5.0')] - url = "https://www.redhat.com/security/data/oval/" - dist_cve_name = "com.redhat.rhsa-RHEL{0}.xml.bz2" - dists = [5, 6, 7] + rhel_url = "https://www.redhat.com/security/data/oval/" + rhel_dist_cve_name = "com.redhat.rhsa-RHEL{0}.xml.bz2" + rhel_dists = [5, 6, 7] + suse_url = "https://ftp.suse.com/pub/projects/security/oval/" + suse_dist_cve_name = "suse.linux.enterprise.{0}.xml" + suse_dists = [12, 15] remote_pattern = '%a, %d %b %Y %H:%M:%S %Z' def __init__(self, fs_dest, DEBUG=False): @@ -46,10 +49,18 @@ class getInputCVE(object): Given a distribution number (i.e. 7), it will fetch the distribution specific data file if upstream has a newer input file. Returns the path of file. + We just hack that SUSE has versions above 10 to mean SUSE ''' - cve_file = self.dist_cve_name.format(dist) + if dist == "12" or dist == "15": + cve_file = self.suse_dist_cve_name.format(dist) + dist_url = urllib.parse.urljoin(self.suse_url, cve_file) + else: + cve_file = self.rhel_dist_cve_name.format(dist) + dist_url = urllib.parse.urljoin(self.rhel_url, cve_file) + + # stderr.write("URL {0} cve_file {1}\n".format(dist_url,cve_file)) dest_file = join(self.dest, cve_file) - dist_url = urllib.parse.urljoin(self.url, cve_file) + if self._is_cache_same(dest_file, dist_url): return dest_file Index: openscap-1.3.5/utils/oscap_docker_python/oscap_docker_common.py =================================================================== --- openscap-1.3.5.orig/utils/oscap_docker_python/oscap_docker_common.py +++ openscap-1.3.5/utils/oscap_docker_python/oscap_docker_common.py @@ -55,7 +55,7 @@ def get_dist(mountpoint, oscap_binary, l ''' Test the chroot and determine what RHEL dist it is; returns - an integer representing the dist + an integer representing the dist (5 - 8 for RHEL, 12 and 15 for SLES) ''' cpe_dict = '/usr/share/openscap/cpe/openscap-cpe-oval.xml' @@ -77,3 +77,32 @@ def get_dist(mountpoint, oscap_binary, l if "{0}{1}: true".format(CPE_RHEL, dist) in result.stdout: print("This system seems based on RHEL{0}.".format(dist)) return dist + + CPE_SLES = 'oval:org.open-scap.cpe.sles:def:' + DISTS = ["12", "15"] + + ''' + Test the chroot and determine what SUSE dist it is; returns + an integer representing the dist (12 and 15 for SUSE) + ''' + + cpe_dict = '/usr/share/openscap/cpe/openscap-cpe-oval.xml' + if not os.path.exists(cpe_dict): + # sometime it's installed into /usr/local/share instead of /usr/local + cpe_dict = '/usr/local/share/openscap/cpe/openscap-cpe-oval.xml' + if not os.path.exists(cpe_dict): + raise OscapError() + + for dist in DISTS: + result = oscap_chroot( + mountpoint, oscap_binary, + ("oval", "eval", "--id", CPE_SLES + dist, cpe_dict, + mountpoint, "2>&1", ">", "/dev/null"), + '*', + local_env + ) + + if "{0}{1}: true".format(CPE_SLES, dist) in result.stdout: + print("This system seems based on SLES {0}.".format(dist)) + return dist + print("System version not detected.")
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor