// Package audit ports the sdf-serve audit-logging chain to udeServer: // trace/span context helpers, SM3 digests, MinIO raw-body storage, // HMAC-SM3 tamper evidence, the HTTP audit middleware (type=1 system log) // and the archive/restore machinery. package audit // Context keys for the trace/span fallbacks (go-zero trace comes from OTel). const ( TraceKey = "trace_id" SpanKey = "span_id" ) // Log types: 1. system log (HTTP requests); 2. interface log (device calls, // reserved, currently unused in udeServer). const ( SystemLog int64 = 1 InterfaceLog int64 = 2 ) // Audit states of a stored log entry. const ( UnAudited int64 = 1 // 未审计 AuditedPassed int64 = 2 // 审计通过 AuditedAnomaly int64 = 3 // 审计异常 ) // Restore states of an archive-restore run. const ( RestoreSuccess int64 = 1 // 成功 RestoreFail int64 = 2 // 失败 RestoreProcessing int64 = 3 // 处理中 ) // Archive modes. const ( ManualArchive int64 = 1 // 手动归档 AutoArchive int64 = 2 // 自动归档 ) // Dynamic configuration item names stored in t_config. const ( ItemFileEndpoint = "file_endpoint" ItemFileBucket = "file_bucket" ItemFileAccessKey = "file_access_key" ItemFileSecretKey = "file_secret_key" ItemFileUseSsl = "file_use_ssl" ItemLogRecordLevel = "log_record_level" ItemArchiveThresh = "archive_threshold" ItemLogHmacSecret = "log_hmac_secret" ) // MinIO object paths. const ( ObjectDirLogs = "logs" ObjectDirArchives = "archives" ) // HmacAlgo identifies the MAC algorithm family used for the tamper chain. const HmacAlgo = "HmacSM3" // operatorAdmin is used as archived_by/restored_by when the request carries // no user identity (udeServer has no auth headers yet). const operatorAdmin = "admin"