Skip to content

Machine ID: Handle Kernel Version check failing more gracefully#34780

Merged
strideynet merged 3 commits intomasterfrom
strideynet/handle-kernel-version-check-failing-graceflly
Nov 21, 2023
Merged

Machine ID: Handle Kernel Version check failing more gracefully#34780
strideynet merged 3 commits intomasterfrom
strideynet/handle-kernel-version-check-failing-graceflly

Conversation

@strideynet
Copy link
Copy Markdown
Contributor

Previously, if this check failed, tbot would crash out, e.g:

lstat /proc/sys/kernel/osrelease: no such file or directory

This occurred in a restricted container environment where much of /proc/sys is not available (Spacelift).

It makes more sense to gracefully degrade to not using kernel features we expect from newer versions.

Closes #34390

changelog: fix tbot crashing when used in environments where the kernel version cannot be queried.

Comment thread lib/tbot/botfs/fs_linux.go Outdated
@strideynet strideynet requested a review from bl-nero November 21, 2023 09:26
version, err := utils.KernelVersion()
if err != nil {
return false, trace.Wrap(err)
log.WithError(err).Info("Failed to determine kernel version. It will be assumed secure write support is not available.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we only ever call this once? It's gonna be annoying if we end up accidentally calling this in a loop.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup - this is only called on initialisation at the mo.

@strideynet strideynet enabled auto-merge November 21, 2023 09:42
@strideynet strideynet added this pull request to the merge queue Nov 21, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 21, 2023
@strideynet strideynet added this pull request to the merge queue Nov 21, 2023
Merged via the queue into master with commit 119d761 Nov 21, 2023
@strideynet strideynet deleted the strideynet/handle-kernel-version-check-failing-graceflly branch November 21, 2023 10:51
@public-teleport-github-review-bot
Copy link
Copy Markdown

@strideynet See the table below for backport results.

Branch Result
branch/v12 Failed
branch/v13 Failed
branch/v14 Create PR

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.

Machine ID: Handle environments where /proc/sys/kernel/osrelease is not available

4 participants