config

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceTLS   string = "tls"
	ServiceAdmin string = "admin"
	ServiceAPI   string = "api"
)

Types of services

View Source
const (
	// log levels
	LogLevelDebug string = "debug"
	LogLevelInfo  string = "info"
	LogLevelWarn  string = "warn"
	LogLevelError string = "error"
	// log formats
	LogFormatConsole string = "console"
	LogFormatJSON    string = "json"
)
View Source
const (
	AuthNone  string = "none"
	AuthJSON  string = "json"
	AuthDB    string = "db"
	AuthSAML  string = "saml"
	AuthJWT   string = "jwt"
	AuthOAuth string = "oauth"
	AuthOIDC  string = "oidc"
)

Types of authentication

View Source
const (
	LoggingNone     string = "none"
	LoggingStdout   string = "stdout"
	LoggingFile     string = "file"
	LoggingDB       string = "db"
	LoggingGraylog  string = "graylog"
	LoggingSplunk   string = "splunk"
	LoggingLogstash string = "logstash"
	LoggingKinesis  string = "kinesis"
	LoggingS3       string = "s3"
	LoggingKafka    string = "kafka"
	LoggingElastic  string = "elastic"
)

Types of logging

View Source
const (
	CarverLocal string = "local"
	CarverDB    string = "db"
	CarverS3    string = "s3"
)

Types of carver

View Source
const (
	DBTypePostgres string = "postgres"
	DBTypeMySQL    string = "mysql"
	DBTypeSQLite   string = "sqlite"
)

Types of backend

View Source
const YAMLConfigType = "yaml"
View Source
const YAMLDBType = "db"

Variables

This section is empty.

Functions

func GenerateAPIConfigFile added in v0.4.9

func GenerateAPIConfigFile(path string, cfg *ServiceParameters, overwrite bool) error

Helper to generate an example API configuration file

func GenerateAdminConfigFile added in v0.4.9

func GenerateAdminConfigFile(path string, cfg *ServiceParameters, overwrite bool) error

Helper to generate an example Admin configuration file

func GenerateGenericConfigFile added in v0.4.9

func GenerateGenericConfigFile(path string, cfg any, overwrite bool) error

Helper to generate an example configuration file

func GenerateTLSConfigFile added in v0.4.9

func GenerateTLSConfigFile(path string, cfg *ServiceParameters, overwrite bool) error

Helper to generate an example TLS configuration file

func InitAPIFlags

func InitAPIFlags(params *ServiceParameters) []cli.Flag

InitAPIFlags initializes all the flags needed for the API service

func InitAdminFlags

func InitAdminFlags(params *ServiceParameters) []cli.Flag

InitAdminFlags initializes all the flags needed for the Admin service

func InitTLSFlags

func InitTLSFlags(params *ServiceParameters) []cli.Flag

InitTLSFlags initializes all the flags needed for the TLS service

func ValidateTLSConfigValues added in v0.4.9

func ValidateTLSConfigValues(cfg TLSConfiguration) error

Helper to validate the TLS configuration values

Types

type APIConfiguration added in v0.4.7

type APIConfiguration struct {
	Service YAMLConfigurationService `mapstructure:"service"`
	DB      YAMLConfigurationDB      `mapstructure:"db"`
	Redis   YAMLConfigurationRedis   `mapstructure:"redis"`
	Osquery YAMLConfigurationOsquery `mapstructure:"osquery"`
	JWT     YAMLConfigurationJWT     `mapstructure:"jwt"`
	TLS     YAMLConfigurationTLS     `mapstructure:"tls"`
	Logger  YAMLConfigurationLogger  `mapstructure:"logger"`
	Carver  YAMLConfigurationCarver  `mapstructure:"carver"`
	Debug   YAMLConfigurationDebug   `mapstructure:"debug"`
}

APIConfiguration to hold osctrl-api configuration values

type AdminConfiguration added in v0.4.7

type AdminConfiguration struct {
	Service YAMLConfigurationService `mapstructure:"service"`
	DB      YAMLConfigurationDB      `mapstructure:"db"`
	Redis   YAMLConfigurationRedis   `mapstructure:"redis"`
	Osquery YAMLConfigurationOsquery `mapstructure:"osquery"`
	Osctrld YAMLConfigurationOsctrld `mapstructure:"osctrld"`
	SAML    YAMLConfigurationSAML    `mapstructure:"saml"`
	JWT     YAMLConfigurationJWT     `mapstructure:"jwt"`
	TLS     YAMLConfigurationTLS     `mapstructure:"tls"`
	Logger  YAMLConfigurationLogger  `mapstructure:"logger"`
	Carver  YAMLConfigurationCarver  `mapstructure:"carver"`
	Admin   YAMLConfigurationAdmin   `mapstructure:"admin"`
	Debug   YAMLConfigurationDebug   `mapstructure:"debug"`
}

AdminConfiguration to hold osctrl-admin configuration values

type ElasticLogger added in v0.4.9

type ElasticLogger struct {
	Host           string `yaml:"host"`
	Port           string `yaml:"port"`
	IndexPrefix    string `yaml:"indexPrefix"`
	DateSeparator  string `yaml:"dateSeparator"`  // Expected is . for YYYY.MM.DD
	IndexSeparator string `yaml:"indexSeparator"` // Expected is - for prefix-YYYY.MM.DD
}

ElasticLogger to hold all elastic configuration values

type GraylogLogger added in v0.4.9

type GraylogLogger struct {
	URL     string `yaml:"url"`
	Host    string `yaml:"host"`
	Queries string `yaml:"queries"`
	Status  string `yaml:"status"`
	Results string `yaml:"results"`
}

GraylogLogger to hold all graylog configuration values

type KafkaLogger added in v0.4.9

type KafkaLogger struct {
	BootstrapServer   string                  `yaml:"bootstrapServers"`
	SSLCALocation     string                  `yaml:"sslCALocation"`
	ConnectionTimeout time.Duration           `yaml:"connectionTimeout"`
	SASL              KafkaSASLConfigurations `yaml:"sasl"`
	Topic             string                  `yaml:"topic"`
}

KafkaLogger to hold all Kafka configuration values

type KafkaSASLConfigurations

type KafkaSASLConfigurations struct {
	Mechanism string `yaml:"mechanism"`
	Username  string `yaml:"username"`
	Password  string `yaml:"password"`
}

type KinesisLogger added in v0.4.9

type KinesisLogger struct {
	Stream          string `yaml:"stream"`
	Region          string `yaml:"region"`
	Endpoint        string `yaml:"endpoint"`
	AccessKeyID     string `yaml:"accessKey"`
	SecretAccessKey string `yaml:"secretKey"`
	SessionToken    string `yaml:"sessionToken"`
}

KinesisLogger to hold all Kinesis configuration values

type LocalCarver added in v0.4.9

type LocalCarver struct {
	CarvesDir string `yaml:"carvesDir"`
}

LocalCarver to hold all local carver configuration values

type LocalLogger added in v0.4.9

type LocalLogger struct {
	FilePath string `yaml:"filePath"`
	// Maximum size in megabytes of the log file before it gets rotated
	MaxSize int `yaml:"maxSize"`
	// Maximum number of old log files to retain
	MaxBackups int `yaml:"maxBackups"`
	// Maximum number of days to retain old log files based on the timestamp encoded in their filename
	MaxAge int `yaml:"maxAge"`
	// If the rotated log files should be compressed using gzip
	Compress bool `yaml:"compress"`
}

LocalLogger to hold all local logger configuration values

type LogstashLogger added in v0.4.9

type LogstashLogger struct {
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	Protocol string `yaml:"protocol"`
	Path     string `yaml:"path"`
}

LogstashLogger to hold all logstash configuration values

type S3Carver added in v0.4.9

type S3Carver struct {
	Bucket          string `yaml:"bucket"`
	Region          string `yaml:"region"`
	AccessKey       string `yaml:"accessKey"`
	SecretAccessKey string `yaml:"secretAccessKey"`
}

S3Carver to hold all S3 configuration values

type S3Logger added in v0.4.9

type S3Logger struct {
	Bucket          string `yaml:"bucket"`
	Region          string `yaml:"region"`
	AccessKey       string `yaml:"accessKey"`
	SecretAccessKey string `yaml:"secretAccessKey"`
}

S3Logger to hold all S3 configuration values

type ServiceParameters added in v0.4.9

type ServiceParameters struct {
	// Configuration will be loaded from a file
	ConfigFlag bool
	// Service configuration file
	ServiceConfigFile string
	// Service configuration values
	Service *YAMLConfigurationService
	// DB configuration values
	DB *YAMLConfigurationDB
	// Batch writer configuration values to handle bulk writes to the backend
	BatchWriter *YAMLConfigurationWriter
	// Redis configuration values
	Redis *YAMLConfigurationRedis
	// osquery configuration values
	Osquery *YAMLConfigurationOsquery
	// osctrld configuration values
	Osctrld *YAMLConfigurationOsctrld
	// Metrics configuration values
	Metrics *YAMLConfigurationMetrics
	// SAML configuration values
	SAML *YAMLConfigurationSAML
	// JWT configuration values
	JWT *YAMLConfigurationJWT
	// TLS configuration values
	TLS *YAMLConfigurationTLS
	// Logger configuration values
	Logger *YAMLConfigurationLogger
	// Carver configuration values
	Carver *YAMLConfigurationCarver
	// Admin configuration values
	Admin *YAMLConfigurationAdmin
	// Debug configuration values
	Debug *YAMLConfigurationDebug
}

ServiceParameters to keep all service parameters from flags

type SplunkLogger added in v0.4.9

type SplunkLogger struct {
	URL   string `yaml:"url"`
	Token string `yaml:"token"`
	Host  string `yaml:"host"`
	Index string `yaml:"index"`
}

SplunkLogger to hold all splunk configuration values

type TLSConfiguration added in v0.4.6

type TLSConfiguration struct {
	Service     YAMLConfigurationService `mapstructure:"service"`
	DB          YAMLConfigurationDB      `mapstructure:"db"`
	BatchWriter YAMLConfigurationWriter  `mapstructure:"batchWriter"`
	Redis       YAMLConfigurationRedis   `mapstructure:"redis"`
	Osquery     YAMLConfigurationOsquery `mapstructure:"osquery"`
	Osctrld     YAMLConfigurationOsctrld `mapstructure:"osctrld"`
	Metrics     YAMLConfigurationMetrics `mapstructure:"metrics"`
	TLS         YAMLConfigurationTLS     `mapstructure:"tls"`
	Logger      YAMLConfigurationLogger  `mapstructure:"logger"`
	Carver      YAMLConfigurationCarver  `mapstructure:"carver"`
	Debug       YAMLConfigurationDebug   `mapstructure:"debug"`
}

TLSConfiguration to hold osctrl-tls configuration values

type YAMLConfigurationAdmin added in v0.4.8

type YAMLConfigurationAdmin struct {
	SessionKey      string `yaml:"sessionKey"`
	StaticDir       string `yaml:"staticDir"`
	StaticOffline   bool   `yaml:"keyFile"`
	TemplatesDir    string `yaml:"templatesDir"`
	BrandingImage   string `yaml:"brandingImage"`
	BackgroundImage string `yaml:"backgroundImage"`
}

YAMLConfigurationAdmin to hold admin UI specific configuration values

type YAMLConfigurationCarver added in v0.4.6

type YAMLConfigurationCarver struct {
	Type  string       `yaml:"type"`
	S3    *S3Carver    `mapstructure:"s3"`
	Local *LocalCarver `mapstructure:"local"`
}

YAMLConfigurationCarver to hold the carver configuration values

type YAMLConfigurationDB added in v0.4.6

type YAMLConfigurationDB struct {
	Type            string `yaml:"type"` // Database type: postgres, mysql, sqlite
	Host            string `yaml:"host"`
	Port            int    `yaml:"port"`
	Name            string `yaml:"name"`
	Username        string `yaml:"username"`
	Password        string `yaml:"password"`
	SSLMode         string `yaml:"sslmode"` // For postgres
	MaxIdleConns    int    `yaml:"maxIdleConns"`
	MaxOpenConns    int    `yaml:"maxOpenConns"`
	ConnMaxLifetime int    `yaml:"connMaxLifetime"`
	ConnRetry       int    `yaml:"connRetry"`
	FilePath        string `yaml:"filePath"` // Used for SQLite
}

YAMLConfigurationDB to hold all backend configuration values

type YAMLConfigurationDebug added in v0.4.6

type YAMLConfigurationDebug struct {
	EnableHTTP bool   `yaml:"enableHttp"`
	HTTPFile   string `yaml:"httpFile"`
	ShowBody   bool   `yaml:"showBody"`
}

YAMLConfigurationDebug to hold the debug configuration values

type YAMLConfigurationJWT added in v0.4.7

type YAMLConfigurationJWT struct {
	JWTSecret     string `yaml:"jwtSecret"`
	HoursToExpire int    `yaml:"hoursToExpire"`
}

YAMLConfigurationJWT to hold all JWT configuration values

type YAMLConfigurationLogger added in v0.4.6

type YAMLConfigurationLogger struct {
	Type         string               `yaml:"type"`
	LoggerDBSame bool                 `yaml:"loggerDBSame"`
	AlwaysLog    bool                 `yaml:"alwaysLog"`
	DB           *YAMLConfigurationDB `mapstructure:"db"`
	S3           *S3Logger            `mapstructure:"s3"`
	Graylog      *GraylogLogger       `mapstructure:"graylog"`
	Elastic      *ElasticLogger       `mapstructure:"elastic"`
	Splunk       *SplunkLogger        `mapstructure:"splunk"`
	Logstash     *LogstashLogger      `mapstructure:"logstash"`
	Kinesis      *KinesisLogger       `mapstructure:"kinesis"`
	Kafka        *KafkaLogger         `mapstructure:"kafka"`
	Local        *LocalLogger         `mapstructure:"local"`
}

YAMLConfigurationLogger to hold the logger configuration values

type YAMLConfigurationMetrics added in v0.4.6

type YAMLConfigurationMetrics struct {
	Enabled  bool   `yaml:"enabled"`
	Listener string `yaml:"listener"`
	Port     int    `yaml:"port"`
}

YAMLConfigurationMetrics to hold the metrics configuration values

type YAMLConfigurationOsctrld added in v0.4.6

type YAMLConfigurationOsctrld struct {
	Enabled bool `yaml:"enabled"`
}

YAMLConfigurationOsctrld to hold the osctrld configuration values

type YAMLConfigurationOsquery added in v0.4.7

type YAMLConfigurationOsquery struct {
	Version    string `yaml:"version"`
	TablesFile string `yaml:"tablesFile"`
	Logger     bool   `yaml:"logger"`
	Config     bool   `yaml:"config"`
	Query      bool   `yaml:"query"`
	Carve      bool   `yaml:"carve"`
}

YAMLConfigurationOsquery to hold the osquery configuration values

type YAMLConfigurationRedis added in v0.4.6

type YAMLConfigurationRedis struct {
	Host             string `yaml:"host"`
	Port             int    `yaml:"port"`
	Password         string `yaml:"password"`
	ConnectionString string `yaml:"connectionString"`
	DB               int    `yaml:"db"`
	ConnRetry        int    `yaml:"connRetry"`
}

YAMLConfigurationRedis to hold all redis configuration values

type YAMLConfigurationSAML added in v0.4.6

type YAMLConfigurationSAML struct {
	CertPath     string `yaml:"certPath"`
	KeyPath      string `yaml:"keyPath"`
	MetaDataURL  string `yaml:"metadataUrl"`
	RootURL      string `yaml:"rootUrl"`
	LoginURL     string `yaml:"loginUrl"`
	LogoutURL    string `yaml:"logoutUrl"`
	JITProvision bool   `yaml:"jitProvision"`
	SPInitiated  bool   `yaml:"spInitiated"`
}

YAMLConfigurationSAML to keep all SAML details for auth

type YAMLConfigurationService added in v0.4.6

type YAMLConfigurationService struct {
	Listener  string `yaml:"listener"`
	Port      int    `yaml:"port"`
	LogLevel  string `yaml:"logLevel"`
	LogFormat string `yaml:"logFormat"`
	Host      string `yaml:"host"`
	Auth      string `yaml:"auth"`
	AuditLog  bool   `yaml:"auditLog"`
}

YAMLConfigurationService to hold the service configuration values

type YAMLConfigurationTLS added in v0.4.6

type YAMLConfigurationTLS struct {
	Termination     bool   `yaml:"termination"`
	CertificateFile string `yaml:"certificateFile"`
	KeyFile         string `yaml:"keyFile"`
}

YAMLConfigurationTLS to hold the TLS/SSL termination configuration values

type YAMLConfigurationWriter added in v0.4.6

type YAMLConfigurationWriter struct {
	// BatchWriter configuration: it need be refactored to a separate struct
	WriterBatchSize  int           `yaml:"writerBatchSize"`
	WriterTimeout    time.Duration `yaml:"writerTimeout"`
	WriterBufferSize int           `yaml:"writerBufferSize"`
}

YAMLConfigurationWriter to hold the DB batch writer configuration values

Jump to

Keyboard shortcuts

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