Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print profile names in "oscap info" #781

Merged
merged 2 commits into from
Aug 1, 2017

Conversation

jan-cerny
Copy link
Member

Along with profile IDs, profile names will be also displayed.

Releated to #685

@jan-cerny jan-cerny added this to the 1.2.15 milestone Jul 17, 2017
@jan-cerny
Copy link
Member Author

Example output:

$ oscap info /usr/local/share/xml/scap/ssg/content/ssg-rhel7-ds.xml 
Document type: Source Data Stream
Imported: 2017-06-06T08:26:26

Stream: scap_org.open-scap_datastream_from_xccdf_ssg-rhel7-xccdf-1.2.xml
Generated: (null)
Version: 1.2
Checklists:
	Ref-Id: scap_org.open-scap_cref_ssg-rhel7-xccdf-1.2.xml
		Status: draft
		Generated: 2017-06-06
		Resolved: true
		Profiles:
			Standard System Security Profile
				id: xccdf_org.ssgproject.content_profile_standard
			PCI-DSS v3 Control Baseline for Red Hat Enterprise Linux 7
				id: xccdf_org.ssgproject.content_profile_pci-dss
			C2S for Red Hat Enterprise Linux 7
				id: xccdf_org.ssgproject.content_profile_C2S
			Red Hat Corporate Profile for Certified Cloud Providers (RH CCP)
				id: xccdf_org.ssgproject.content_profile_rht-ccp
			Common Profile for General-Purpose Systems
				id: xccdf_org.ssgproject.content_profile_common
			DISA STIG for Red Hat Enterprise Linux 7
				id: xccdf_org.ssgproject.content_profile_stig-rhel7-disa
			STIG for Red Hat Virtualization Hypervisor
				id: xccdf_org.ssgproject.content_profile_stig-rhevh-upstream
			United States Government Configuration Baseline (USGCB / STIG) - DRAFT
				id: xccdf_org.ssgproject.content_profile_ospp-rhel7
			Criminal Justice Information Services (CJIS) Security Policy
				id: xccdf_org.ssgproject.content_profile_cjis-rhel7-server
			Standard Docker Host Security Profile
				id: xccdf_org.ssgproject.content_profile_docker-host
			Unclassified Information in Non-federal Information Systems and Organizations (NIST 800-171)
				id: xccdf_org.ssgproject.content_profile_nist-800-171-cui
		Referenced check files:
			ssg-rhel7-oval.xml
				system: http://oval.mitre.org/XMLSchema/oval-definitions-5
			ssg-rhel7-ocil.xml
				system: http://scap.nist.gov/schema/ocil/2
			https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL7.xml.bz2
				system: http://oval.mitre.org/XMLSchema/oval-definitions-5
	Ref-Id: scap_org.open-scap_cref_ssg-rhel7-pcidss-xccdf-1.2.xml
		Status: draft
		Generated: 2017-06-06
		Resolved: true
		Profiles:
			PCI-DSS v3 Control Baseline for Red Hat Enterprise Linux 7
				id: xccdf_org.ssgproject.content_profile_pci-dss_centric
		Referenced check files:
			ssg-rhel7-oval.xml
				system: http://oval.mitre.org/XMLSchema/oval-definitions-5
			ssg-rhel7-ocil.xml
				system: http://scap.nist.gov/schema/ocil/2
			https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL7.xml.bz2
				system: http://oval.mitre.org/XMLSchema/oval-definitions-5
Checks:
	Ref-Id: scap_org.open-scap_cref_ssg-rhel7-oval.xml
	Ref-Id: scap_org.open-scap_cref_ssg-rhel7-ocil.xml
	Ref-Id: scap_org.open-scap_cref_ssg-rhel7-cpe-oval.xml
	Ref-Id: scap_org.open-scap_cref_ssg-rhel7-oval.xml000
	Ref-Id: scap_org.open-scap_cref_ssg-rhel7-ocil.xml000
Dictionaries:
	Ref-Id: scap_org.open-scap_cref_ssg-rhel7-cpe-dictionary.xml

@yuumasato
Copy link
Member

Could you add Title: prefix, like we have with the profile id?
And I'm not sure whether the ID should be a subitem of ID, I lean towards the opposite the Profile Title being a sub item of Profile ID.

@mpreisler
Copy link
Member

mpreisler commented Jul 17, 2017

What if the profile doesn't have any title? Title is an optional element... Nvm, it has to be there.

Along with profile IDs, profile names will be also displayed.
@jan-cerny
Copy link
Member Author

I have added Title: prefix.

@jan-cerny
Copy link
Member Author

@yuumasato @WesleyCeraso @mpreisler Any volunteer for review? 😄

@WesleyCeraso
Copy link

Seems good to me.

oscap_text_iterator_free(title_it);
printf("%s\tTitle: %s\n", prefix, profile_title);
free(profile_title);
printf("%s\t\tId: %s%s\n", prefix,
xccdf_profile_get_abstract(prof) ? "(abstract) " : "",
xccdf_profile_get_id(prof));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is going to say Id: (abstract) xccdf_profile_.... which may not be what you were going for.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll swap that.

@jan-cerny
Copy link
Member Author

I have improved the output so that it's going to say Id: xccdf_profile_.... (abstract).

@mpreisler mpreisler self-assigned this Aug 1, 2017
@mpreisler mpreisler merged commit 52b7062 into OpenSCAP:maint-1.2 Aug 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants