chconfig

package
v0.0.0-...-7578c0e Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinKeepDisconnectedClients     = time.Second
	MaxKeepDisconnectedClients     = 7 * 24 * time.Hour
	DefaultVaultDBName             = "vault.sqlite.db"
	NotificationLogStorageDuration = "7d"
	NotificationLogCleanupInterval = "1d"
)

Variables

View Source
var (
	CheckClientsConnectionIntervalMinimum = time.Minute * 2
)

Functions

func ConfigReplaceDeprecated

func ConfigReplaceDeprecated(s any) (map[string]string, error)

ConfigReplaceDeprecated maps deprecated config settings to their new replacements.

Types

type APIConfig

type APIConfig struct {
	Address                string   `mapstructure:"address"`
	BaseURL                string   `mapstructure:"base_url"`
	EnableAcme             bool     `mapstructure:"enable_acme"`
	Auth                   string   `mapstructure:"auth"`
	AuthFile               string   `mapstructure:"auth_file"`
	AuthUserTable          string   `mapstructure:"auth_user_table"`
	AuthGroupTable         string   `mapstructure:"auth_group_table"`
	AuthGroupDetailsTable  string   `mapstructure:"auth_group_details_table"`
	AuthHeader             string   `mapstructure:"auth_header"`
	UserHeader             string   `mapstructure:"user_header"`
	CreateMissingUsers     bool     `mapstructure:"create_missing_users"`
	DefaultUserGroup       string   `mapstructure:"default_user_group"`
	JWTSecret              string   `mapstructure:"jwt_secret"`
	DocRoot                string   `mapstructure:"doc_root"`
	CertFile               string   `mapstructure:"cert_file"`
	KeyFile                string   `mapstructure:"key_file"`
	AccessLogFile          string   `mapstructure:"access_log_file"`
	UserLoginWait          float32  `mapstructure:"user_login_wait"`
	MaxFailedLogin         int      `mapstructure:"max_failed_login"`
	BanTime                int      `mapstructure:"ban_time"`
	MaxTokenLifeTimeHours  int      `mapstructure:"max_token_lifetime"`
	PasswordMinLength      int      `mapstructure:"password_min_length"`
	PasswordZxcvbnMinscore int      `mapstructure:"password_zxcvbn_minscore"`
	TLSMin                 string   `mapstructure:"tls_min"`
	EnableWsTestEndpoints  bool     `mapstructure:"enable_ws_test_endpoints"`
	MaxRequestBytes        int64    `mapstructure:"max_request_bytes"`
	MaxFilePushSize        int64    `mapstructure:"max_filepush_size"`
	CORS                   []string `mapstructure:"cors"`

	TwoFATokenDelivery       string                 `mapstructure:"two_fa_token_delivery"`
	TwoFATokenTTLSeconds     int                    `mapstructure:"two_fa_token_ttl_seconds"`
	TwoFASendTimeout         time.Duration          `mapstructure:"two_fa_send_timeout"`
	TwoFASendToType          message.ValidationType `mapstructure:"two_fa_send_to_type"`
	TwoFASendToRegex         string                 `mapstructure:"two_fa_send_to_regex"`
	TwoFASendToRegexCompiled *regexp.Regexp

	AuditLog                auditlog.Config `mapstructure:",squash"`
	TotPEnabled             bool            `mapstructure:"totp_enabled"`
	TotPLoginSessionTimeout time.Duration   `mapstructure:"totp_login_session_ttl"`
	TotPAccountName         string          `mapstructure:"totp_account_name"`
}

func (*APIConfig) IsTwoFAOn

func (c *APIConfig) IsTwoFAOn() bool

type Config

type Config struct {
	Server        ServerConfig         `mapstructure:"server"`
	Caddy         caddy.Config         `mapstructure:"caddy-integration"`
	Logging       LogConfig            `mapstructure:"logging"`
	API           APIConfig            `mapstructure:"api"`
	Database      DatabaseConfig       `mapstructure:"database"`
	Pushover      PushoverConfig       `mapstructure:"pushover"`
	SMTP          SMTPConfig           `mapstructure:"smtp"`
	Monitoring    MonitoringConfig     `mapstructure:"monitoring"`
	Notifications NotificationsConfig  `mapstructure:"notifications"`
	PlusConfig    rportplus.PlusConfig `mapstructure:",squash"`
}

func (*Config) AllowedPorts

func (c *Config) AllowedPorts() mapset.Set

func (*Config) CaddyEnabled

func (c *Config) CaddyEnabled() bool

func (*Config) GetUploadDir

func (c *Config) GetUploadDir() string

func (*Config) GetVaultDBPath

func (c *Config) GetVaultDBPath() string

func (*Config) InitRequestLogOptions

func (c *Config) InitRequestLogOptions() *requestlog.Options

func (*Config) ParseAndValidate

func (c *Config) ParseAndValidate(mLog *logger.MemLogger) error

func (*Config) WriteCaddyBaseConfig

func (c *Config) WriteCaddyBaseConfig(caddyConfig *caddy.Config) (bc *caddy.BaseConfig, err error)

type DatabaseConfig

type DatabaseConfig struct {
	Type     string `mapstructure:"db_type"`
	Host     string `mapstructure:"db_host"`
	User     string `mapstructure:"db_user"`
	Password string `mapstructure:"db_password"`
	Name     string `mapstructure:"db_name"`

	Driver string
	Dsn    string
}

func (*DatabaseConfig) DsnForLogs

func (d *DatabaseConfig) DsnForLogs() string

func (*DatabaseConfig) ParseAndValidate

func (d *DatabaseConfig) ParseAndValidate() error

type LogConfig

type LogConfig struct {
	LogOutput logger.LogOutput `mapstructure:"log_file"`
	LogLevel  logger.LogLevel  `mapstructure:"log_level"`
}

type MonitoringConfig

type MonitoringConfig struct {
	DataStorageDuration string `mapstructure:"data_storage_duration"`
	DataStorageDays     int64  `mapstructure:"data_storage_days"`
	Enabled             bool   `mapstructure:"enabled"`
	// contains filtered or unexported fields
}

func (*MonitoringConfig) GetDataStorageDuration

func (mc *MonitoringConfig) GetDataStorageDuration() (duration time.Duration)

type NotificationsConfig

type NotificationsConfig struct {
	NotificationScriptDir    string `mapstructure:"notification_script_dir"`
	LogStorageDurationString string `mapstructure:"log_storage_duration"`
	LogStorageDuration       time.Duration
	CleanupIntervalString    string `mapstructure:"cleanup_interval"`
	CleanupInterval          time.Duration
}

type PushoverConfig

type PushoverConfig struct {
	APIToken string `mapstructure:"api_token"`
	UserKey  string `mapstructure:"user_key"`
}

func (*PushoverConfig) Validate

func (c *PushoverConfig) Validate() error

type SMTPConfig

type SMTPConfig struct {
	Server       string `mapstructure:"server"`
	AuthUsername string `mapstructure:"auth_username"`
	AuthPassword string `mapstructure:"auth_password"`
	SenderEmail  string `mapstructure:"sender_email"`
	Secure       bool   `mapstructure:"secure"`
}

func (*SMTPConfig) Validate

func (c *SMTPConfig) Validate() error

type ServerConfig

type ServerConfig struct {
	ListenAddress                        string                                 `mapstructure:"address"`
	URL                                  []string                               `mapstructure:"url"`
	PairingURL                           string                                 `mapstructure:"pairing_url"`
	KeySeed                              string                                 `mapstructure:"key_seed"`
	Auth                                 string                                 `mapstructure:"auth"`
	AuthFile                             string                                 `mapstructure:"auth_file"`
	AuthTable                            string                                 `mapstructure:"auth_table"`
	Proxy                                string                                 `mapstructure:"proxy"`
	UsedPortsRaw                         []string                               `mapstructure:"used_ports"`
	ExcludedPortsRaw                     []string                               `mapstructure:"excluded_ports"`
	DataDir                              string                                 `mapstructure:"data_dir"`
	SqliteWAL                            bool                                   `mapstructure:"sqlite_wal"`
	MaxConcurrentSSHConnectionHandshakes int                                    `mapstructure:"max_concurrent_ssh_handshakes"`
	PurgeDisconnectedClients             bool                                   `mapstructure:"purge_disconnected_clients"`
	CleanupLostClients                   bool                                   `mapstructure:"cleanup_lost_clients" replaced_by:"PurgeDisconnectedClients"`
	KeepLostClients                      time.Duration                          `mapstructure:"keep_lost_clients" replaced_by:"KeepDisconnectedClients"`
	KeepDisconnectedClients              time.Duration                          `mapstructure:"keep_disconnected_clients"`
	CleanupClientsInterval               time.Duration                          `mapstructure:"cleanup_clients_interval" replaced_by:"PurgeDisconnectedClientsInterval"`
	PurgeDisconnectedClientsInterval     time.Duration                          `mapstructure:"purge_disconnected_clients_interval"`
	CheckClientsConnectionInterval       time.Duration                          `mapstructure:"check_clients_connection_interval"`
	CheckClientsConnectionTimeout        time.Duration                          `mapstructure:"check_clients_connection_timeout"`
	MaxRequestBytesClient                int64                                  `mapstructure:"max_request_bytes_client"`
	CheckPortTimeout                     time.Duration                          `mapstructure:"check_port_timeout"`
	RunRemoteCmdTimeoutSec               int                                    `mapstructure:"run_remote_cmd_timeout_sec"`
	AuthWrite                            bool                                   `mapstructure:"auth_write"`
	AuthMultiuseCreds                    bool                                   `mapstructure:"auth_multiuse_creds"`
	EquateClientauthidClientid           bool                                   `mapstructure:"equate_clientauthid_clientid"`
	AllowRoot                            bool                                   `mapstructure:"allow_root"`
	ClientLoginWait                      float32                                `mapstructure:"client_login_wait"`
	MaxFailedLogin                       int                                    `mapstructure:"max_failed_login"`
	BanTime                              int                                    `mapstructure:"ban_time"`
	InternalTunnelProxyConfig            clienttunnel.InternalTunnelProxyConfig `mapstructure:",squash"`
	JobsMaxResults                       int                                    `mapstructure:"jobs_max_results"`
	AcmeHTTPPort                         int                                    `mapstructure:"acme_http_port"`

	// DEPRECATED, only here for backwards compatibility
	MaxRequestBytes       int64 `mapstructure:"max_request_bytes"`
	MaxFilePushSize       int64 `mapstructure:"max_filepush_size"`
	EnableWsTestEndpoints bool  `mapstructure:"enable_ws_test_endpoints"`

	AuthID       string
	AuthPassword string
	// contains filtered or unexported fields
}

func (*ServerConfig) GetSQLiteDataSourceOptions

func (s *ServerConfig) GetSQLiteDataSourceOptions() sqlite.DataSourceOptions

Jump to

Keyboard shortcuts

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