-
Notifications
You must be signed in to change notification settings - Fork 11
Add new tool "crau-monitor" #206
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
base: main
Are you sure you want to change the base?
Conversation
t184256
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline: less of a review, more of a mixture of high-level questions with learning Rust questions.
| use std::time::Duration; | ||
| use toml::{Table, Value}; | ||
|
|
||
| const CONFIG: &str = "/etc/crypto-auditing/monitor.conf"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it needs a config, what's would be a compelling reason to use one you're anticipating?
| let inotify_stream = inotify.into_event_stream(buffer)?; | ||
| let watch_descriptor = inotify_stream | ||
| .watches() | ||
| .add(&log_file, WatchMask::MODIFY | WatchMask::CREATE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the circumstances for getting a CREATE on a file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe when someone removes the log file and then re-creates it?
monitor/src/monitor.rs
Outdated
| }) | ||
| } | ||
|
|
||
| fn disable_monitor(&mut self) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More of a Rust question: should this kind of irreversible deinitialization go to drop()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, rewritten as Drop.
| reader.read(&event_tx, &mut shutdown_rx2), | ||
| publisher.publish(&mut event_rx, &mut shutdown_rx3), | ||
| ) | ||
| .map(|_| ()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't that swallow errors returned from the futures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's std::result::Result#map, which maps the Ok variant.
Signed-off-by: Daiki Ueno <[email protected]>
e0a2750 to
dff8e6a
Compare
It is a common use-case to monitor cryptographic usage on the system at real time. This adds a dedicated CLI tool, crau-monitor, by combining the functionalities of event-broker and client. Unlike those, crau-monitor doesn't require any system service but directly reads the log file. Signed-off-by: Daiki Ueno <[email protected]>
Signed-off-by: Daiki Ueno <[email protected]>
It is a common use-case to monitor cryptographic usage on the system
at real time. This adds a dedicated CLI tool, crau-monitor, by
combining the functionalities of event-broker and client. Unlike
those, crau-monitor doesn't require any system service but directly
reads the log file.