Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1342623

Summary: [RFE] Extend the foreman API for improved compliance/openscap usage
Product: Red Hat Satellite Reporter: David Critch <dcritch>
Component: SCAP PluginAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Sebastian Gräßl <sgraessl>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.8CC: agadhave, cfields, ehelms, gkeegan, jcallaha, mhulan, mjahangi, oprazak, sgraessl, szadok, will_darton
Target Milestone: UnspecifiedKeywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 12:35:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Critch 2016-06-03 17:14:10 UTC
Description of problem:
We are looking at deploying the OpenSCAP plugin for Satellite 6, and use a lot of hammer/API requests. Currently, the foreman API exposes a limited amount of access to those resources:

# curl -s -k -u admin:NOTAPASSWORD https://$(hostname)/api/v2/ | jq . | grep -A2 scaptimony_policies
    "scaptimony_policies": {
      "Show a policy's SCAP content": "/api/v2/compliance/policies/:id/content"
    },


The hammer CLI appears to have no support at all:
# hammer --help | egrep -i 'compliance|policy|audit|openscap'
#

It would be great to e.g. list all policies, create or delete a policy, etc.

Version-Release number of selected component (if applicable):
ruby193-rubygem-scaptimony-0.3.0.1-1.el7sat.noarch
rubygem-smart_proxy_openscap-0.3.0.9-1.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. Query foreman for API endpoints (above)
2. Returns just the one endpoint


Actual results:
API call returns one endpoint
hammer --help shows no ability to manage policies

Expected results:
Additional access to the resources, similar to say hostgroups:

    "hostgroups": {
      "List all host groups": "/api/hostgroups",
      "Show a host group": "/api/hostgroups/:id",
      "Create a host group": "/api/hostgroups",
      "Update a host group": "/api/hostgroups/:id",
      "Delete a host group": "/api/hostgroups/:id",
      "Clone a host group": "/api/hostgroups/:id/clone"
    },


Additional info:

Comment 1 Bryan Kearney 2016-07-26 18:56:51 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 8 Sebastian Gräßl 2017-09-06 10:21:58 UTC
Verified on Satellite 6.3 snap 14.

Hammer commands are available and API has more endpoints to manage scap_content:
...
"scap_contents": {
  "List SCAP contents": "/api/compliance/scap_contents",
  "Show an SCAP content as XML": "/api/compliance/scap_contents/:id/xml",
  "Show an SCAP content": "/api/compliance/scap_contents/:id",
  "Create SCAP content": "/api/compliance/scap_contents",
  "Update an SCAP content": "/api/compliance/scap_contents/:id",
  "Deletes an SCAP content": "/api/compliance/scap_contents/:id"
},
...

Comment 11 errata-xmlrpc 2018-02-21 12:35:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336