Skip to content

Commit

Permalink
feat(slemicro): added SUSE Linux Enterprise Micro support
Browse files Browse the repository at this point in the history
This adds support for the SUSE Linux Enterprise Micro family.

#7221

Signed-off-by: Marcus Meissner <[email protected]>
  • Loading branch information
msmeissn committed Jul 31, 2024
1 parent 2a0e529 commit fff41cd
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/detector/ospkg/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var (
ftypes.OpenSUSETumbleweed: suse.NewScanner(suse.OpenSUSETumbleweed),
ftypes.OpenSUSELeap: suse.NewScanner(suse.OpenSUSE),
ftypes.SLES: suse.NewScanner(suse.SUSEEnterpriseLinux),
ftypes.SLEMicro: suse.NewScanner(suse.SUSEEnterpriseLinuxMicro),
ftypes.Photon: photon.NewScanner(),
ftypes.Wolfi: wolfi.NewScanner(),
ftypes.Chainguard: chainguard.NewScanner(),
Expand Down
21 changes: 21 additions & 0 deletions pkg/detector/ospkg/suse/suse.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ var (
// 6 months after SLES 15 SP7 release
// "15.7": time.Date(2031, 7, 31, 23, 59, 59, 0, time.UTC),
}
slemicroEolDates = map[string]time.Time{
// Source: https://www.suse.com/lifecycle/
"5.0": time.Date(2022, 3, 31, 23, 59, 59, 0, time.UTC),
"5.1": time.Date(2025, 10, 31, 23, 59, 59, 0, time.UTC),
"5.2": time.Date(2026, 4, 30, 23, 59, 59, 0, time.UTC),
"5.3": time.Date(2026, 10, 30, 23, 59, 59, 0, time.UTC),
"5.4": time.Date(2027, 4, 30, 23, 59, 59, 0, time.UTC),
"5.5": time.Date(2027, 10, 31, 23, 59, 59, 0, time.UTC),
"6.0": time.Date(2028, 6, 30, 23, 59, 59, 0, time.UTC),
// 6.1 will be released late 2024
// "6.1": time.Date(2028, 11, 30, 23, 59, 59, 0, time.UTC),
}

opensuseEolDates = map[string]time.Time{
// Source: https://en.opensuse.org/Lifetime
Expand All @@ -66,6 +78,8 @@ type Type int
const (
// SUSEEnterpriseLinux is Linux Enterprise version
SUSEEnterpriseLinux Type = iota
// SUSE Linux Enterprise Micro is the micro series
SUSEEnterpriseLinuxMicro
// OpenSUSE for open versions
OpenSUSE
OpenSUSETumbleweed
Expand All @@ -83,6 +97,10 @@ func NewScanner(t Type) *Scanner {
return &Scanner{
vs: susecvrf.NewVulnSrc(susecvrf.SUSEEnterpriseLinux),
}
case SUSEEnterpriseLinuxMicro:
return &Scanner{
vs: susecvrf.NewVulnSrc(susecvrf.SUSEEnterpriseLinuxMicro),

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / Integration Test

undefined: susecvrf.SUSEEnterpriseLinuxMicro

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / K8s Integration Test

undefined: susecvrf.SUSEEnterpriseLinuxMicro

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / Build Test (windows-latest)

undefined: susecvrf.SUSEEnterpriseLinuxMicro

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / Module Integration Test

undefined: susecvrf.SUSEEnterpriseLinuxMicro

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / Build Test (macos-latest)

undefined: susecvrf.SUSEEnterpriseLinuxMicro

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

undefined: susecvrf.SUSEEnterpriseLinuxMicro (typecheck)

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

undefined: susecvrf.SUSEEnterpriseLinuxMicro) (typecheck)

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

undefined: susecvrf.SUSEEnterpriseLinuxMicro) (typecheck)

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / VM Integration Test

undefined: susecvrf.SUSEEnterpriseLinuxMicro

Check failure on line 102 in pkg/detector/ospkg/suse/suse.go

View workflow job for this annotation

GitHub Actions / Test (macos-latest)

undefined: susecvrf.SUSEEnterpriseLinuxMicro
}
case OpenSUSE:
return &Scanner{
vs: susecvrf.NewVulnSrc(susecvrf.OpenSUSE),
Expand Down Expand Up @@ -135,6 +153,9 @@ func (s *Scanner) IsSupportedVersion(ctx context.Context, osFamily ftypes.OSType
if osFamily == ftypes.SLES {
return osver.Supported(ctx, slesEolDates, osFamily, osVer)
}
if osFamily == ftypes.SLEMicro {
return osver.Supported(ctx, slemicroEolDates, osFamily, osVer)
}
// tumbleweed is a rolling release, it has no version and no eol
if osFamily == ftypes.OpenSUSETumbleweed {
return true
Expand Down
2 changes: 2 additions & 0 deletions pkg/fanal/analyzer/os/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func (a osReleaseAnalyzer) Analyze(_ context.Context, input analyzer.AnalysisInp
family = types.OpenSUSELeap
case "sles":
family = types.SLES
case "sle-micro", "sl-micro", "sle-micro-rancher":
family = types.SLEMicro
case "photon":
family = types.Photon
case "wolfi":
Expand Down
20 changes: 20 additions & 0 deletions pkg/fanal/analyzer/os/release/release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ func Test_osReleaseAnalyzer_Analyze(t *testing.T) {
},
},
},
{
name: "SUSE Linux Enterprise Micro",
inputFile: "testdata/slemicro",
want: &analyzer.AnalysisResult{
OS: types.OS{
Family: types.SLEMicro,
Name: "5.3",
},
},
},
{
name: "SUSE Linux Enterprise Micro 6.0",
inputFile: "testdata/slemicro6.0",
want: &analyzer.AnalysisResult{
OS: types.OS{
Family: types.SLEMicro,
Name: "6.0",
},
},
},
{
name: "Photon OS",
inputFile: "testdata/photon",
Expand Down
8 changes: 8 additions & 0 deletions pkg/fanal/analyzer/os/release/testdata/slemicro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NAME="SLE Micro"
VERSION="5.3"
VERSION_ID="5.3"
PRETTY_NAME="SUSE Linux Enterprise Micro 5.3"
ID="sle-micro"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sle-micro:5.3"
10 changes: 10 additions & 0 deletions pkg/fanal/analyzer/os/release/testdata/slemicro6.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NAME="SL-Micro"
VERSION="6.0"
VERSION_ID="6.0"
PRETTY_NAME="SUSE Linux Micro 6.0"
ID="sl-micro"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sl-micro:6.0"
HOME_URL="https://www.suse.com/products/micro/"
DOCUMENTATION_URL="https://documentation.suse.com/sl-micro/6.0/"
1 change: 1 addition & 0 deletions pkg/fanal/types/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
Photon OSType = "photon"
RedHat OSType = "redhat"
Rocky OSType = "rocky"
SLEMicro OSType = "suse linux enterprise micro"
SLES OSType = "suse linux enterprise server"
Ubuntu OSType = "ubuntu"
Wolfi OSType = "wolfi"
Expand Down

0 comments on commit fff41cd

Please sign in to comment.