auditlog

package
v0.0.0-...-a423d60 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreAuditlogOperation  = "pre-operation"
	PostAuditlogOperation = "post-operation"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditlogClient

type AuditlogClient interface {
	LogConfigurationChange(ctx context.Context, change model.ConfigurationChange) error
	LogSecurityEvent(ctx context.Context, event model.SecurityEvent) error
}

type AuditlogMessageFactory

type AuditlogMessageFactory interface {
	CreateConfigurationChange() model.ConfigurationChange
	CreateSecurityEvent() model.SecurityEvent
}

type AuthMode

type AuthMode string
const (
	Basic     AuthMode = "basic"
	OAuth     AuthMode = "oauth"
	OAuthMtls AuthMode = "oauth-mtls"
)

type BasicAuthConfig

type BasicAuthConfig struct {
	User     string `envconfig:"APP_AUDITLOG_USER"`
	Password string `envconfig:"APP_AUDITLOG_PASSWORD"`
	Tenant   string `envconfig:"APP_AUDITLOG_TENANT"`
}

type BasicHttpClient

type BasicHttpClient struct {
	// contains filtered or unexported fields
}

func NewBasicAuthClient

func NewBasicAuthClient(cfg BasicAuthConfig, client *http.Client) *BasicHttpClient

func (*BasicHttpClient) Do

func (cl *BasicHttpClient) Do(req *http.Request) (*http.Response, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg Config, httpClient HttpClient) (*Client, error)

func (*Client) LogConfigurationChange

func (c *Client) LogConfigurationChange(ctx context.Context, change model.ConfigurationChange) error

func (*Client) LogSecurityEvent

func (c *Client) LogSecurityEvent(ctx context.Context, event model.SecurityEvent) error

type Config

type Config struct {
	URL               string        `envconfig:"APP_AUDITLOG_URL"`
	ConfigPath        string        `envconfig:"APP_AUDITLOG_CONFIG_PATH"`
	SecurityPath      string        `envconfig:"APP_AUDITLOG_SECURITY_PATH"`
	AuthMode          AuthMode      `envconfig:"APP_AUDITLOG_AUTH_MODE"`
	ClientTimeout     time.Duration `envconfig:"APP_AUDITLOG_CLIENT_TIMEOUT,default=30s"`
	MsgChannelSize    int           `envconfig:"APP_AUDITLOG_CHANNEL_SIZE,default=100"`
	MsgChannelTimeout time.Duration `envconfig:"APP_AUDITLOG_CHANNEL_TIMEOUT,default=5s"`
	WriteWorkers      int           `envconfig:"APP_AUDITLOG_WRITE_WORKERS,default=5"`
}

type HttpClient

type HttpClient interface {
	Do(request *http.Request) (*http.Response, error)
}

type MessageFactory

type MessageFactory struct {
	// contains filtered or unexported fields
}

func NewMessageFactory

func NewMessageFactory(user, tenant string, uuidSvc UUIDService, timeSvc TimeService) *MessageFactory

func (*MessageFactory) CreateConfigurationChange

func (f *MessageFactory) CreateConfigurationChange() model.ConfigurationChange

func (*MessageFactory) CreateSecurityEvent

func (f *MessageFactory) CreateSecurityEvent() model.SecurityEvent

type MetricCollector

type MetricCollector interface {
	SetChannelSize(size int)
}

type NoOpService

type NoOpService struct {
}

func (*NoOpService) Log

func (*NoOpService) PreLog

type OAuthConfig

type OAuthConfig struct {
	ClientID     string `envconfig:"APP_AUDITLOG_CLIENT_ID"`
	ClientSecret string `envconfig:"APP_AUDITLOG_CLIENT_SECRET"`
	OAuthURL     string `envconfig:"APP_AUDITLOG_OAUTH_URL"`
	User         string `envconfig:"APP_AUDITLOG_OAUTH_USER,default=$USER"`
	Tenant       string `envconfig:"APP_AUDITLOG_OAUTH_TENANT,default=$PROVIDER"`
	TokenPath    string `envconfig:"APP_AUDITLOG_TOKEN_PATH"`
}

type OAuthMtlsConfig

type OAuthMtlsConfig struct {
	ClientID          string `envconfig:"APP_AUDITLOG_CLIENT_ID"`
	OAuthURL          string `envconfig:"APP_AUDITLOG_OAUTH_URL"`
	User              string `envconfig:"APP_AUDITLOG_OAUTH_USER,default=$USER"`
	Tenant            string `envconfig:"APP_AUDITLOG_OAUTH_TENANT,default=$PROVIDER"`
	TokenPath         string `envconfig:"APP_AUDITLOG_TOKEN_PATH"`
	SkipSSLValidation bool   `envconfig:"APP_AUDITLOG_SKIP_SSL_VALIDATION,default=false"`
	X509Cert          string `envconfig:"APP_AUDITLOG_X509_CERT"`
	X509Key           string `envconfig:"APP_AUDITLOG_X509_KEY"`
}

func (*OAuthMtlsConfig) ParseCertificate

func (c *OAuthMtlsConfig) ParseCertificate() (*tls.Certificate, error)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(client AuditlogClient, msgFactory AuditlogMessageFactory) *Service

func (*Service) Log

func (svc *Service) Log(ctx context.Context, msg proxy.AuditlogMessage) error

func (*Service) PreLog

func (svc *Service) PreLog(ctx context.Context, msg proxy.AuditlogMessage) error

type Sink

type Sink struct {
	// contains filtered or unexported fields
}

func NewSink

func NewSink(logsChannel chan proxy.AuditlogMessage, timeout time.Duration, collector MetricCollector) *Sink

func (*Sink) Log

func (sink *Sink) Log(ctx context.Context, msg proxy.AuditlogMessage) error

type TimeService

type TimeService interface {
	Now() time.Time
}

type UUIDService

type UUIDService interface {
	Generate() string
}

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(svc proxy.AuditlogService, auditlogChannel chan proxy.AuditlogMessage, collector MetricCollector) *Worker

func (*Worker) Start

func (w *Worker) Start(ctx context.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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