pub struct AuditLog {
pub max_log_size: u64,
/* private fields */
}Expand description
監査ログ管理
監査イベントの記録、検証、検索機能を提供します。
§セキュリティ特性
- HMAC-SHA256: すべてのログエントリに署名
- append-only: ログは追記のみ(上書き・削除不可)
- 自動ローテーション: 10MBを超えるとログファイルをローテーション
Fields§
§max_log_size: u64最大ログファイルサイズ(バイト)
Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
デフォルトのログパスを使用して監査ログを初期化
§Errors
- 設定ディレクトリが取得できない場合(
dirs::config_dir()がNoneを返す) - 設定ディレクトリ(
~/.config/backup-suite等)の作成に失敗した場合 - 秘密鍵の読み込みまたは生成に失敗した場合
Sourcepub fn log(&mut self, event: AuditEvent) -> Result<()>
pub fn log(&mut self, event: AuditEvent) -> Result<()>
監査イベントをログに記録
§Errors
- ログファイルのメタデータ取得に失敗した場合(ローテーションチェック時)
- ログローテーション(ファイル名変更)に失敗した場合
- ログファイルのオープンに失敗した場合
- イベントのJSON形式へのシリアライズに失敗した場合
- ログファイルへの書き込みに失敗した場合
Sourcepub fn read_all(&self) -> Result<Vec<AuditEvent>>
pub fn read_all(&self) -> Result<Vec<AuditEvent>>
Sourcepub fn verify_all(&self) -> Result<bool>
pub fn verify_all(&self) -> Result<bool>
Sourcepub fn get_events_since(&self, since: DateTime<Utc>) -> Result<Vec<AuditEvent>>
pub fn get_events_since(&self, since: DateTime<Utc>) -> Result<Vec<AuditEvent>>
Sourcepub fn get_events_by_type(
&self,
event_type: &EventType,
) -> Result<Vec<AuditEvent>>
pub fn get_events_by_type( &self, event_type: &EventType, ) -> Result<Vec<AuditEvent>>
Sourcepub fn current_user() -> String
pub fn current_user() -> String
現在のユーザー名を取得(システム環境変数から)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuditLog
impl RefUnwindSafe for AuditLog
impl Send for AuditLog
impl Sync for AuditLog
impl Unpin for AuditLog
impl UnwindSafe for AuditLog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.