Repository navigation
fix: wait a second before verify writes its test event - #89
Merged
Merged
Conversation
verify.sh took the start time with date, wrote the canary file right away, and searched for the event with ausearch -ts <start>. The kernel stamps an audit event with a clock that runs a few ms behind the one date reads. When the start time fell just after a second boundary, the event carried the second before it, ausearch skipped it, and verify failed after 10 seconds. An install then rolled back although the rules worked. Measured on Rocky Linux 10.2: in 4000 writes the event time was earlier than the date taken before the write every time, by up to 2.3 ms, and 4 events were in the earlier second. verify.sh now waits one second between the start time and the write. It also takes the date and the time with one date call, so they can't be from two sides of midnight. Fixes #86 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
verify.shcould miss its own test event when it started just after a second boundary. An install then rolled back although the rules worked. Fixes #86.Cause
Verify took the start time with
date, wrote the canary file right away, and searched withausearch -ts <start>. The kernel stamps an audit event with a clock that runs a few milliseconds behind the onedatereads. So an event written right after the start time can carry the second before it, andausearchskips it.Measured on Rocky Linux 10.2 with 4000 writes: the event time was earlier than the
datetaken before the write every time, by up to 2.3 ms, and 4 events were in the earlier second. The failed CI job from #86 fits, because its test event was stamped at.998of a second.The explanation in the issue, that auditd held the records in memory, was wrong.
Fix
datecall. With two calls they could be from two sides of midnight.Tested
verify.shpassed 25 runs in a row on the Rocky VM.