@@ -213,6 +213,64 @@ Security features for the SSH server (`src/server/security/`):
213213 - Thread-safe with fail-closed behavior on lock contention
214214 - Configuration via ` allowed_ips ` and ` blocked_ips ` in server config
215215
216+ ### Audit Logging Module
217+
218+ Comprehensive audit logging infrastructure for the SSH server (` src/server/audit/ ` ):
219+
220+ ** Structure** :
221+ - ` mod.rs ` - ` AuditManager ` for collecting and distributing audit events
222+ - ` event.rs ` - ` AuditEvent ` type definitions and builder pattern
223+ - ` exporter.rs ` - ` AuditExporter ` trait and ` NullExporter ` implementation
224+
225+ ** Key Components** :
226+
227+ - ** AuditEvent** : Represents discrete auditable actions with fields for:
228+ - Unique event ID (UUID v4)
229+ - Timestamp (UTC)
230+ - Event type, session ID, username, client IP
231+ - File paths, bytes transferred, operation result
232+ - Protocol and additional details
233+
234+ - ** EventType** : Categorizes security and operational events:
235+ - Authentication: ` AuthSuccess ` , ` AuthFailure ` , ` AuthRateLimited `
236+ - Sessions: ` SessionStart ` , ` SessionEnd `
237+ - Commands: ` CommandExecuted ` , ` CommandBlocked `
238+ - File operations: ` FileOpenRead ` , ` FileOpenWrite ` , ` FileRead ` , ` FileWrite ` , ` FileClose ` , ` FileUploaded ` , ` FileDownloaded ` , ` FileDeleted ` , ` FileRenamed `
239+ - Directory operations: ` DirectoryCreated ` , ` DirectoryDeleted ` , ` DirectoryListed `
240+ - Filters: ` TransferDenied ` , ` TransferAllowed `
241+ - Security: ` IpBlocked ` , ` IpUnblocked ` , ` SuspiciousActivity `
242+
243+ - ** EventResult** : Operation outcomes (` Success ` , ` Failure ` , ` Denied ` , ` Error ` )
244+
245+ - ** AuditExporter Trait** : Interface for audit event destinations
246+ - ` export() ` - Export single event
247+ - ` export_batch() ` - Export multiple events (optimizable)
248+ - ` flush() ` - Ensure pending events are written
249+ - ` close() ` - Clean up resources
250+
251+ - ** NullExporter** : No-op exporter for testing and disabled audit logging
252+
253+ - ** AuditManager** : Central manager with async processing
254+ - Background worker for non-blocking event processing
255+ - Configurable buffering (buffer size, batch size)
256+ - Periodic flush intervals
257+ - Multiple exporter support
258+ - Graceful shutdown with event flush
259+
260+ ** Configuration** :
261+ ``` rust
262+ let config = AuditConfig :: new ()
263+ . with_enabled (true )
264+ . with_buffer_size (1000 )
265+ . with_batch_size (100 )
266+ . with_flush_interval (5 );
267+ ```
268+
269+ ** Future Exporters** (planned):
270+ - File exporter for local audit logs
271+ - OpenTelemetry exporter for distributed tracing
272+ - Logstash exporter for centralized logging
273+
216274### Server CLI Binary
217275** Binary** : ` bssh-server `
218276
@@ -274,6 +332,7 @@ SSH server implementation using the russh library for accepting incoming connect
274332- ` exec.rs ` - Command execution for SSH exec requests
275333- ` sftp.rs ` - SFTP subsystem handler with path traversal prevention
276334- ` auth/ ` - Authentication provider infrastructure
335+ - ` audit/ ` - Audit logging infrastructure (event types, exporters, manager)
277336
278337** Key Components** :
279338
0 commit comments