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

fix(scanner/debian): fill kernel version from kernel package #2064

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Nov 11, 2024

If this Pull Request is work in progress, Add a prefix of “[WIP]” in the title.

What did you implement:

The format of uname -a differs for each major version as shown below.
To reliably obtain the kernel version, set the version of the linux-image-(kernel release) package as the kernel version.

Debian 6

$ cat /etc/debian_version
6.0.10

$ uname -a
Linux debian-6 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC 2014 x86_64 GNU/Linux

$ dpkg-query -W -f='${Version}' linux-image-$(uname -r)
2.6.32-48squeeze6

Debian 7

$ cat /etc/debian_version
7.9

$ uname -a
Linux debian-7 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u3 x86_64 GNU/Linux

$ dpkg-query -W -f='${Version}' linux-image-$(uname -r)
3.2.68-1+deb7u3

Debian 8

$ cat /etc/debian_version
8.11

$ uname -a
Linux jessie 3.16.0-9-amd64 #1 SMP Debian 3.16.68-1 (2019-05-22) x86_64 GNU/Linux

$ dpkg-query -W -f='${Version}' linux-image-$(uname -r)
3.16.68-1

Debian 9

$ cat /etc/debian_version
9.12

$ uname -a
Linux stretch 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1 (2020-01-20) x86_64 GNU/Linux

$ dpkg-query -W -f='${Version}' linux-image-$(uname -r)
4.9.210-1

Debian 10

$ cat /etc/debian_version
10.13

$ uname -a
Linux buster 4.19.0-25-amd64 #1 SMP Debian 4.19.289-2 (2023-08-08) x86_64 GNU/Linux

$ dpkg-query -W -f='${Version}' linux-image-$(uname -r)
4.19.289-2

Debian 11

$ cat /etc/debian_version
11.11

$ uname -a
Linux bullseye 5.10.0-32-amd64 #1 SMP Debian 5.10.223-1 (2024-08-10) x86_64 GNU/Linux

$ dpkg-query -W -f='${Version}' linux-image-$(uname -r)
5.10.223-1

Debian 12

$ cat /etc/debian_version
12.7

$ uname -a
Linux bookworm 6.1.0-25-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.106-3 (2024-08-26) x86_64 GNU/Linux

$ dpkg-query -W -f='${Version}' linux-image-$(uname -r)
6.1.106-3

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

setup

$ uname -a
Linux bookworm 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux

$ dpkg-query -W -f='${Version}' linux-image-$(uname -r)
6.1.76-1

before

$ vuls scan
$ cat results/2024-11-12T03-54-30+0900/vagrant.json | jq .runningKernel
{
  "release": "6.1.0-18-amd64",
  "version": "",
  "rebootRequired": false
}

after

$ vuls scan
$ cat results/2024-11-12T03-56-30+0900/vagrant.json | jq .runningKernel
{
  "release": "6.1.0-18-amd64",
  "version": "6.1.76-1",
  "rebootRequired": false
}

Checklist:

You don't have to satisfy all of the following.

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

@MaineK00n MaineK00n self-assigned this Nov 11, 2024
@MaineK00n MaineK00n marked this pull request as ready for review November 11, 2024 19:50
@MaineK00n MaineK00n requested a review from shino November 11, 2024 19:51
Copy link
Collaborator

@shino shino left a comment

Choose a reason for hiding this comment

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

🎊

@MaineK00n MaineK00n merged commit dd28532 into master Nov 12, 2024
7 checks passed
@MaineK00n MaineK00n deleted the MaineK00n/patch-1 branch November 12, 2024 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants