constants.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Package audit ports the sdf-serve audit-logging chain to udeServer:
  2. // trace/span context helpers, SM3 digests, MinIO raw-body storage,
  3. // HMAC-SM3 tamper evidence, the HTTP audit middleware (type=1 system log)
  4. // and the archive/restore machinery.
  5. package audit
  6. // Context keys for the trace/span fallbacks (go-zero trace comes from OTel).
  7. const (
  8. TraceKey = "trace_id"
  9. SpanKey = "span_id"
  10. )
  11. // Log types: 1. system log (HTTP requests); 2. interface log (device calls,
  12. // reserved, currently unused in udeServer).
  13. const (
  14. SystemLog int64 = 1
  15. InterfaceLog int64 = 2
  16. )
  17. // Audit states of a stored log entry.
  18. const (
  19. UnAudited int64 = 1 // 未审计
  20. AuditedPassed int64 = 2 // 审计通过
  21. AuditedAnomaly int64 = 3 // 审计异常
  22. )
  23. // Restore states of an archive-restore run.
  24. const (
  25. RestoreSuccess int64 = 1 // 成功
  26. RestoreFail int64 = 2 // 失败
  27. RestoreProcessing int64 = 3 // 处理中
  28. )
  29. // Archive modes.
  30. const (
  31. ManualArchive int64 = 1 // 手动归档
  32. AutoArchive int64 = 2 // 自动归档
  33. )
  34. // Dynamic configuration item names stored in t_config.
  35. const (
  36. ItemFileEndpoint = "file_endpoint"
  37. ItemFileBucket = "file_bucket"
  38. ItemFileAccessKey = "file_access_key"
  39. ItemFileSecretKey = "file_secret_key"
  40. ItemFileUseSsl = "file_use_ssl"
  41. ItemLogRecordLevel = "log_record_level"
  42. ItemArchiveThresh = "archive_threshold"
  43. ItemLogHmacSecret = "log_hmac_secret"
  44. )
  45. // MinIO object paths.
  46. const (
  47. ObjectDirLogs = "logs"
  48. ObjectDirArchives = "archives"
  49. )
  50. // HmacAlgo identifies the MAC algorithm family used for the tamper chain.
  51. const HmacAlgo = "HmacSM3"
  52. // operatorAdmin is used as archived_by/restored_by when the request carries
  53. // no user identity (udeServer has no auth headers yet).
  54. const operatorAdmin = "admin"