xccdf

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// XMLHeader is the header for the XML doc
	XMLHeader string = `<?xml version="1.0" encoding="UTF-8"?>`

	// XCCDFNamespace is the XCCDF namespace of this project. Per the XCCDF
	// specification, this assiciates the content with the author
	XCCDFNamespace        string = "compliance.openshift.io"
	XCCDFURI              string = "http://checklists.nist.gov/xccdf/1.2"
	ContentFileNamePrefix string = "ssg-"
	ContentFileNameSuffix string = "-ds.xml"
)

Variables

This section is empty.

Functions

func GenerateUniqueIDFromDNS added in v1.5.0

func GenerateUniqueIDFromDNS(name string) string

GenerateUniqueIDFromDNS generates a unique identifier from a name using the DNS namespace

func GetContentFileName added in v1.5.0

func GetContentFileName(productName string) string

GetContentFileName gets the file name for a profile bundle

func GetDescriptionFromXMLString

func GetDescriptionFromXMLString(raw string) (string, error)

GetDescriptionFromXMLString gets a description from the given XML string

func GetManualRules

func GetManualRules(tp *cmpv1alpha1.TailoredProfile) []string

func GetProfileNameFromID

func GetProfileNameFromID(id string) string

GetProfileNameFromID gets a profile name from the xccdf ID

func GetProfileUniqueID added in v1.5.0

func GetProfileUniqueID(platform string, profileID string) string

GetProfileUniqueID gets the unique identifier of the Profile from the platform name and the profile ID

func GetProfileUniqueIDFromBundleName added in v1.5.0

func GetProfileUniqueIDFromBundleName(pbName, profileName string) string

GetProfileUniqueIDFromBundleName returns the unique identifier of the Profile

func GetProfileUniqueIDFromTP added in v1.5.0

func GetProfileUniqueIDFromTP(tpID string) string

GetProfileUniqueIDFromTP gets the unique identifier for a TailoredProfileID

func GetRationaleFromXMLString

func GetRationaleFromXMLString(raw string) (string, error)

GetRationaleFromXMLString gets the rationale from the given XML string

func GetRuleNameFromID

func GetRuleNameFromID(id string) string

GetRuleNameFromID gets a rule name from the xccdf ID

func GetVariableNameFromID

func GetVariableNameFromID(id string) string

func GetWarningFromXMLString

func GetWarningFromXMLString(raw string) (string, error)

GetWarningFromXMLString gets a warning from the given XML string

func GetXCCDFProfileID

func GetXCCDFProfileID(tp *cmpv1alpha1.TailoredProfile) string

GetXCCDFProfileID gets a profile xccdf ID from the TailoredProfile object

func IsManualRule

func IsManualRule(ruleName string, manualRules []string) bool

func TailoredProfileToXML

func TailoredProfileToXML(tp *cmpv1alpha1.TailoredProfile, p *cmpv1alpha1.Profile, pb *cmpv1alpha1.ProfileBundle, rules map[string]*cmpv1alpha1.Rule, variables []*cmpv1alpha1.Variable) (string, error)

TailoredProfileToXML gets an XML string from a TailoredProfile and the corresponding Profile

Types

type BenchmarkElement

type BenchmarkElement struct {
	XMLName xml.Name `xml:"xccdf-1.2:benchmark"`
	Href    string   `xml:"href,attr"`
}

type ProfileElement

type ProfileElement struct {
	XMLName     xml.Name                   `xml:"xccdf-1.2:Profile"`
	ID          string                     `xml:"id,attr"`
	Extends     string                     `xml:"extends,attr,omitempty"`
	Title       *TitleOrDescriptionElement `xml:"xccdf-1.2:title"`
	Description *TitleOrDescriptionElement `xml:"xccdf-1.2:description"`
	Selections  []SelectElement
	Values      []SetValueElement
}

type SelectElement

type SelectElement struct {
	XMLName  xml.Name `xml:"xccdf-1.2:select"`
	IDRef    string   `xml:"idref,attr"`
	Selected bool     `xml:"selected,attr"`
}

type SetValueElement

type SetValueElement struct {
	XMLName xml.Name `xml:"xccdf-1.2:set-value"`
	IDRef   string   `xml:"idref,attr"`
	Value   string   `xml:",chardata"`
}

type TailoringElement

type TailoringElement struct {
	XMLName         xml.Name `xml:"xccdf-1.2:Tailoring"`
	XMLNamespaceURI string   `xml:"xmlns:xccdf-1.2,attr"`
	ID              string   `xml:"id,attr"`
	Benchmark       BenchmarkElement
	Version         VersionElement
	Profile         ProfileElement
}

type TitleOrDescriptionElement

type TitleOrDescriptionElement struct {
	Override bool   `xml:"override,attr"`
	Value    string `xml:",chardata"`
}

type VersionElement

type VersionElement struct {
	XMLName xml.Name `xml:"xccdf-1.2:version"`
	// FIXME(jaosorior): time.Time doesn't satisfy the unmarshalling
	// interface needed by the XML library in golang. I used a string
	// instead cause I was lazy.
	Time  string `xml:"time,attr"`
	Value string `xml:",chardata"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL