github.com/quay/claircore@v1.5.28/suse/releases.go (about)

     1  package suse
     2  
     3  import "github.com/quay/claircore"
     4  
     5  // Suse has service pack releases however their security database files are bundled together
     6  // by major version. for example `SUSE Linux Enterprise Server 15 (all Service Packs) - suse.linux.enterprise.server.15.xml`
     7  // we choose to normalize detected distributions into major releases and parse vulnerabilities by major release versions.
     8  
     9  // Release indicates the SUSE release OVAL database to pull from.
    10  type Release string
    11  
    12  // These are some known Releases.
    13  const (
    14  	EnterpriseServer15 Release = `suse.linux.enterprise.server.15`
    15  	EnterpriseServer12 Release = `suse.linux.enterprise.server.12`
    16  	EnterpriseServer11 Release = `suse.linux.enterprise.server.11`
    17  	Leap151            Release = `opensuse.leap.15.1`
    18  	Leap150            Release = `opensuse.leap.15.0`
    19  	Leap423            Release = `opensuse.leap.42.3`
    20  )
    21  
    22  var enterpriseServer15Dist = &claircore.Distribution{
    23  	Name:       "SLES",
    24  	Version:    "15",
    25  	VersionID:  "15",
    26  	PrettyName: "SUSE Linux Enterprise Server 15",
    27  	DID:        "sles",
    28  }
    29  
    30  var enterpriseServer12Dist = &claircore.Distribution{
    31  	Name:       "SLES",
    32  	Version:    "12",
    33  	VersionID:  "12",
    34  	PrettyName: "SUSE Linux Enterprise Server 12",
    35  	DID:        "sles",
    36  }
    37  
    38  var enterpriseServer11Dist = &claircore.Distribution{
    39  	Name:       "SLES",
    40  	Version:    "11",
    41  	VersionID:  "11",
    42  	PrettyName: "SUSE Linux Enterprise Server 11",
    43  	DID:        "sles",
    44  }
    45  
    46  var leap151Dist = &claircore.Distribution{
    47  	Name:       "openSUSE Leap",
    48  	Version:    "15.1",
    49  	DID:        "opensuse-leap",
    50  	VersionID:  "15.1",
    51  	PrettyName: "openSUSE Leap 15.1",
    52  }
    53  
    54  var leap15Dist = &claircore.Distribution{
    55  	Name:       "openSUSE Leap",
    56  	Version:    "15.0",
    57  	DID:        "opensuse-leap",
    58  	VersionID:  "15.0",
    59  	PrettyName: "openSUSE Leap 15.0",
    60  }
    61  
    62  var leap423Dist = &claircore.Distribution{
    63  	Name:       "openSUSE Leap",
    64  	Version:    "42.3",
    65  	DID:        "opensuse",
    66  	VersionID:  "42.3",
    67  	PrettyName: "openSUSE Leap 42.3",
    68  }
    69  
    70  func releaseToDist(r Release) *claircore.Distribution {
    71  	switch r {
    72  	case EnterpriseServer15:
    73  		return enterpriseServer15Dist
    74  	case EnterpriseServer12:
    75  		return enterpriseServer12Dist
    76  	case EnterpriseServer11:
    77  		return enterpriseServer11Dist
    78  	case Leap150:
    79  		return leap15Dist
    80  	case Leap151:
    81  		return leap151Dist
    82  	case Leap423:
    83  		return leap423Dist
    84  	default:
    85  		// return empty dist
    86  		return &claircore.Distribution{}
    87  	}
    88  }