Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions cc-eventlog/src/runtime_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,18 @@ impl RuntimeEvent {
.context("failed to get event log directory")?;
fs::create_dir_all(logfile_dir).context("failed to create event log directory")?;

let mut logfile = fs::OpenOptions::new()
.append(true)
.create(true)
let mut options = fs::OpenOptions::new();
options.append(true).create(true);

// Restrict runtime event log visibility and writability to the owner (root).
// This avoids other processes in the CVM tampering with or reading the log.
#[cfg(unix)]
{
use fs_err::os::unix::fs::OpenOptionsExt;
options.mode(0o600);
}

let mut logfile = options
.open(logfile_path)
.context("failed to open event log file")?;

Expand Down
Loading