Repository navigation
feat: audit open line and log ID in the journal - #157
Merged
Merged
Conversation
…heck them Open writes "audit open SEQ:HASH LOGID" once, before any entry of the start; Append adds the log ID to each anchor line. ReadJournal reads the lines in order, with the old form too, and VerifyJournal checks the open lines against the last anchor of the log before them (#40).
An entry added while the broker was stopped, a deleted, moved and replaced log, old-form anchors, false journal lines, and a torn line.
SEQ:HASH must be in the form that Anchor.String writes, and a carriage return counts only before a newline (security review, #40).
4 tasks
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.
Refs #40
The broker writes
audit open SEQ:HASH LOGIDto the journal when it opens the audit log. Anchors carry the log ID (the SHA-256 of line 1).nodkey audit verify --anchorschecks that eachaudit openhead equals the last anchor of that log before it.Progress
audit verifywith the journal lines.seq1 is found.audit anchorline from other broker output is not read as an anchor.Choices
audit verifyprints "other log in the journal: ID …, up to entry N". The person decides whether it was moved on purpose, and can check that log with the same journal.SyslogIdentifier=nodkey-audit). The leaner option: every line of the broker goes through its logger, which starts each line withtime=and escapes line breaks, so no other broker line can read as an anchor or an open line.journalctl -u nodkeyalready limits the lines to the broker's unit, which journald sets and a process cannot fake. A separate stream would need the journal socket and changes to the sandbox of the unit. Test:noAnchorLineincmd/nodkey/broker_test.gonow also runsaudit.ReadJournalon the broker's output.Security review
Round 1 found nothing serious; it found no way to make a changed log pass. Findings and what I did:
--sinceway out. Reporting every gap and accepting a known gap: Audit verify: report every open gap, accept a known gap, and give old anchors a log ID #158.--since. Code fix: Audit verify: report every open gap, accept a known gap, and give old anchors a log ID #158.