audit

package
v3.7.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(auditor Auditor)

Register registers a new Auditor in the global auditor list

func SubmitEvent

func SubmitEvent(event interface{})

SubmitEvent handles an event for all auditors

Types

type Auditor

type Auditor interface {
	// Handle() takes an audit event and attempts to persists it;
	// how it is persisted and how errors are handled is up to the
	// implementation of this interface.
	Handle(event interface{})
}

Auditor is notified when noteworthy events happen, for example when a file is encrypted or decrypted.

type DecryptEvent

type DecryptEvent struct {
	File string
}

DecryptEvent contains fields relevant to a decryption event

type EncryptEvent

type EncryptEvent struct {
	File string
}

EncryptEvent contains fields relevant to an encryption event

type PostgresAuditor

type PostgresAuditor struct {
	DB *sql.DB
}

PostgresAuditor is a Postgres SQL DB implementation of the Auditor interface. It persists the audit event by writing a row to the 'audit_event' table. Errors with writing to the database will output a log message and the process will exit with status set to 1

func NewPostgresAuditor

func NewPostgresAuditor(connStr string) (*PostgresAuditor, error)

NewPostgresAuditor is the constructor for a new PostgresAuditor struct initialized with the given db connection string

func (*PostgresAuditor) Handle

func (p *PostgresAuditor) Handle(event interface{})

Handle persists the audit event by writing a row to the 'audit_event' postgres table

type RotateEvent

type RotateEvent struct {
	File string
}

RotateEvent contains fields relevant to a key rotation event

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL