Skip to content

Refactor and enhance auditing within heartbeat components#1004

Closed
cgalibern wants to merge 20 commits intoopensvc:mainfrom
cgalibern:dev
Closed

Refactor and enhance auditing within heartbeat components#1004
cgalibern wants to merge 20 commits intoopensvc:mainfrom
cgalibern:dev

Conversation

@cgalibern
Copy link
Copy Markdown
Contributor


Summary

This pull request introduces several improvements and refactors to auditing and logging within the heartbeat (hb) components. Key updates include subsystem expansions, better integration of EnableAudit, log contextualization, and hbrelay enhancements.

Key Changes

  • Expanded auditable subsystems: Added hb.main, hb.ctrl, and hb.peer_dropper.
  • Integrated EnableAudit into transmitters, receivers, hb.main, and hb.ctrl.
  • Simplified audit event handling via enhanced EnableAudit capabilities.
  • Improved logging with better context prefixes for hb.main traceability.
  • Renamed components for consistency: peerDropWorker -> peerDropper.
  • Enhanced handling of audit sessions in hbrelay, including dynamic subscription updates.
  • Refactored hbrelay configuration handling for reload support upon key changes.
  • Added utility improvements, such as String() method for KeyMeta.

cgalibern added 20 commits April 3, 2026 23:07
- Consolidated configuration fields into a `cfg` struct for better encapsulation.
- Replaced inline client creation with reusable client logic in `cfg`.
- Added dynamic subscription updates for configuration changes.
- Improved error handling and logging during client updates.
…ndling

- Introduced `attachActiveAuditIfAny` to reattach ongoing audits during hbrelay operations.
- Added filters for `AuditStart` and `AuditStop` events to hbrelay subscriptions.
- Improved handling of audit subsystem mapping and logging.
- Introduced `EnableAudit` in transmitters and receivers to integrate with auditing.
- Added `hbaudit` package for managing audit session tracking and event handling.
- Enhanced logging for `AuditStart` and `AuditStop` events.
…lity

- Added specific prefixes (e.g., `msgToTx`, `msgFromRx`) to log messages for better context identification.
- Enhanced log clarity when tracing operations across heartbeat components.
…arity

- Replaced `hb.common` with `hb.peer_dropper` in audit subsystem references.
- Renamed `peerDropWorker` to `peerDropper` for consistency.
- Integrated `EnableAudit` in `hb.main` to activate auditing with context.
- Removed `AuditStart` and `AuditStop` handling for cleaner implementation.
- Adjusted subscription naming for better clarity (`daemon.hb.janitor`).
…ctrl`, and `hb.peer_dropper`

- Added new subsystems to list of audit targets for expanded logging capabilities.
…for streamlined password parsing

- Removed `getPasswordKM` in favor of `ParseKeyMetaRelWithFallback` for improved handling of password parsing with fallback logic.
- Simplified legacy backward compatibility code.
- Modified log prefix to include `main` for more precise context in log entries.
… for clarity

- Adjusted log prefix for better traceability by renaming `hbctrl:peerDropper` to `hb:peer_dropper`.
- Updated subscription name from `daemon.hb.peer_drop_worker` to `daemon.hb.peer_dropper` to align with naming conventions.
- Removed redundant subsystem checks in `AuditStart` and `AuditStop` handlers.
- Streamlined calls to `HandleAuditStart` and `HandleAuditStop` with consistent parameters.
During cluster join, the hb relay can start before its secret configuration
objects are available. As a result, the heartbeat previously failed to start,
leaving no opportunity for proper configuration afterward.

This change allows the hb relay to start and wait for password resolution
by subscribing to the passwordFrom configuration object.

Additional updates:
- Added a nil check for the client in the ticker loop to avoid unnecessary executions.
- Improved logging in refreshClient to enhance debugging and traceability.
- Fix missed initial password update
@cgalibern
Copy link
Copy Markdown
Contributor Author

replaced by #1005

@cgalibern cgalibern closed this Apr 7, 2026
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.

1 participant