Documentation
¶
Overview ¶
Package config ...
Package config ...
Package config ...
Package config ...
Index ¶
- Constants
- Variables
- func CheckRootServiceuuid(uid string) error
- func CollectCLArgs(wl *WarningList)
- func SetDefaultTLSConf()
- func SetPreferredCipherSuites(cipherList []string) error
- func SetTLSMaxVersion(version string, wl *WarningList) error
- func SetTLSMinVersion(version string, wl *WarningList) error
- func SetUpMockConfig(t *testing.T) error
- func SetVerifyPeer(val bool)
- func ValidateConfiguredTLSVersions(wl *WarningList) error
- type APIGatewayConf
- type AddComputeSkipResources
- type AuthConf
- type ConnectionMethodConf
- type DBConf
- type EventConf
- type ExecPriorityDelayConf
- type HTTPConfig
- type Host
- type KeyCertConf
- type MessageBusConf
- type PasswordRules
- type PluginStatusPolling
- type PluginTasksConf
- type TLSConf
- type TaskQueueConf
- type URLTranslation
- type WarningList
Constants ¶
const ( // DefaultFirmwareVersion - default FirmwareVersion value DefaultFirmwareVersion = "2.0" // DefaultSessionTimeOutInMins - default SessionTimeOutInMins value DefaultSessionTimeOutInMins = 30 // DefaultExpiredSessionCleanUpTimeInMins - default ExpiredSessionCleanUpTimeInMins value DefaultExpiredSessionCleanUpTimeInMins = 15 // DefaultDBProtocol - default Protocol value DefaultDBProtocol = "tcp" // DefaultDBMaxActiveConns - default MaxActiveConns value DefaultDBMaxActiveConns = 120 // DefaultDBMaxIdleConns - default MaxIdleConns value DefaultDBMaxIdleConns = 10 // DefaultAuthFailureLoggingThreshold - default AuthFailureLoggingThreshold value DefaultAuthFailureLoggingThreshold = 3 // DefaultAccountLockoutThreshold - default AccountLockoutThreshold value DefaultAccountLockoutThreshold = 5 // DefaultAccountLockoutDuration - default AccountLockoutDuration value DefaultAccountLockoutDuration = 30 // DefaultAccountLockoutCounterResetAfter - default AccountLockoutCounterResetAfter value DefaultAccountLockoutCounterResetAfter = 30 // DefaultMinPasswordLength - default MinPasswordLengt value DefaultMinPasswordLength = 12 // DefaultMaxPasswordLength - default MaxPasswordLength value DefaultMaxPasswordLength = 16 // DefaultAllowedSpecialCharcters - default AllowedSpecialCharcters value DefaultAllowedSpecialCharcters = "~!@#$%^&*-+_|(){}:;<>,.?/" // DefaultPollingFrequencyInMins - default PollingFrequencyInMins value DefaultPollingFrequencyInMins = 30 // DefaultMaxRetryAttempt - default MaxRetryAttempt value DefaultMaxRetryAttempt = 3 // DefaultRetryIntervalInMins - default RetryIntervalInMins value DefaultRetryIntervalInMins = 3 // DefaultResponseTimeoutInSecs - default ResponseTimeoutInSecs value DefaultResponseTimeoutInSecs = 3 // DefaultStartUpResourceBatchSize - default StartUpResourceBatchSize value DefaultStartUpResourceBatchSize = 10 // DefaultMinResetPriority - default MinResetPriority value DefaultMinResetPriority = 1 // DefaultMaxResetDelay - maximum delay in seconds a reset action can wait DefaultMaxResetDelay = 36000 // DefaultHTTPConnTimeout - default HTTPConnTimeout value DefaultHTTPConnTimeout = 10 // DefaultHTTPMaxIdleConns - default HTTPMaxIdleConns value DefaultHTTPMaxIdleConns = 100 // DefaultHTTPIdleConnTimeout - default HTTPIdleConnTimeout value DefaultHTTPIdleConnTimeout = 90 // DefaultHTTPUseKeepAlive - default HTTPUseKeepAlive value DefaultHTTPUseKeepAlive = false // DefaultHTTPMaxIdleConnPerHost - default HTTPMaxIdleConnPerHost value DefaultHTTPMaxIdleConnPerHost = -1 // DefaultHTTPExpectContinueTimeout - default HTTPExpectContinueTimeout value DefaultHTTPExpectContinueTimeout = 1 // DefaultTLSHandShakeTimeout - default TLSHandShakeTimeout value DefaultTLSHandShakeTimeout = 10 // DefaultTLSMinVersion - default minimum TLS version supported DefaultTLSMinVersion = tls.VersionTLS12 // DefaultTLSMaxVersion - default maximum TLS version supported DefaultTLSMaxVersion = tls.VersionTLS12 // DefaultTLSServerVerify - indicator for performing server validation DefaultTLSServerVerify = true // DefaultDeliveryRetryAttempts - default DeliveryRetryAttempts value DefaultDeliveryRetryAttempts = 3 // DefaultDeliveryRetryIntervalSeconds - default DeliveryRetryIntervalSeconds value DefaultDeliveryRetryIntervalSeconds = 60 // DefaultEventForwardingWorkerPoolCount - default EventForwardingWorkerPoolCount value DefaultEventForwardingWorkerPoolCount = 1000 //DefaultEventSaveWorkerPoolCount - default EventSaveWorkerPoolCount value DefaultEventSaveWorkerPoolCount = 10 )
Variables ¶
var ( // DefaultSkipListUnderSystem - holds the default list of resources which needs to be ignored for storing in DB under system resource DefaultSkipListUnderSystem = []string{"Chassis", "LogServices", "Managers"} // DefaultSkipListUnderManager - holds the default list of resources which needs to be ignored for storing in DB under manager resource DefaultSkipListUnderManager = []string{"Chassis", "LogServices", "Systems"} // DefaultSkipListUnderChassis - holds the default list of resources which needs to be ignored for storing in DB under chassis resource DefaultSkipListUnderChassis = []string{"Managers", "Systems", "Devices"} // DefaultSkipListUnderOthers - holds the default list of resources which needs to be ignored for storing in DB under any other resource DefaultSkipListUnderOthers = []string{"Power", "Thermal", "SmartStorage"} // DefaultCipherSuiteList - default cipher suite list DefaultCipherSuiteList = []uint16{ tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, } // SupportedCipherSuitesList - list of cipher suites supported by GO // TODO : list needs to be updated, everytime GO adds a new cipher suite SupportedCipherSuitesList = map[string]uint16{ "TLS_RSA_WITH_3DES_EDE_CBC_SHA": tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_RSA_WITH_AES_128_CBC_SHA": tls.TLS_RSA_WITH_AES_128_CBC_SHA, "TLS_RSA_WITH_AES_256_CBC_SHA": tls.TLS_RSA_WITH_AES_256_CBC_SHA, "TLS_RSA_WITH_AES_128_GCM_SHA256": tls.TLS_RSA_WITH_AES_128_GCM_SHA256, "TLS_RSA_WITH_AES_256_GCM_SHA384": tls.TLS_RSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA": tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384": tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256": tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256": tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, } // SupportedTLSVersions - list of TLS versions supported by GO // TODO : list needs to be updated, everytime GO adds a new TLS version SupportedTLSVersions = map[string]uint16{ "TLS_1.0": tls.VersionTLS10, "TLS_1.1": tls.VersionTLS11, "TLS_1.2": tls.VersionTLS12, } )
var ( // TLSConfMutex is used for avoiding race conditions TLSConfMutex = &sync.RWMutex{} // DefaultHTTPClient is the global reusable client instance for contacting a server DefaultHTTPClient = &http.Client{ Timeout: time.Duration(DefaultHTTPConnTimeout) * time.Second, } // DefaultHTTPTransport is the global resuable tranport instance for contacting a server DefaultHTTPTransport = &http.Transport{ MaxIdleConns: DefaultHTTPMaxIdleConns, IdleConnTimeout: time.Duration(DefaultHTTPIdleConnTimeout) * time.Second, TLSHandshakeTimeout: time.Duration(DefaultTLSHandShakeTimeout) * time.Second, DisableKeepAlives: !DefaultHTTPUseKeepAlive, MaxIdleConnsPerHost: DefaultHTTPMaxIdleConnPerHost, ExpectContinueTimeout: time.Duration(DefaultHTTPExpectContinueTimeout) * time.Second, } )
var AllowedMessageBusTypes = map[string]bool{ "Kafka": true, "RedisStreams": true, }
AllowedMessageBusTypes is for checking for message types are allowed
var CLArgs clModel
CLArgs is for accessing the data passed as the command line argument
var Data configModel
Data will have the configuration data from config file
Functions ¶
func CheckRootServiceuuid ¶
CheckRootServiceuuid function is used to validate format of Root Service UUID. The same function is used in plugin-redfish config.go
func CollectCLArgs ¶
func CollectCLArgs(wl *WarningList)
CollectCLArgs will collect the command line arguments and fill CLArgs variable of type clModel
func SetDefaultTLSConf ¶
func SetDefaultTLSConf()
SetDefaultTLSConf is for updating TLS conf with default values
func SetPreferredCipherSuites ¶
SetPreferredCipherSuites is for setting configuredCipherSuiteList
func SetTLSMaxVersion ¶
func SetTLSMaxVersion(version string, wl *WarningList) error
SetTLSMaxVersion is for setting configuredTLSMaxVersion
func SetTLSMinVersion ¶
func SetTLSMinVersion(version string, wl *WarningList) error
SetTLSMinVersion is for setting configuredTLSMinVersion
func SetUpMockConfig ¶
SetUpMockConfig set ups a mock ration for unit testing
func ValidateConfiguredTLSVersions ¶
func ValidateConfiguredTLSVersions(wl *WarningList) error
ValidateConfiguredTLSVersions is for valdiating TLS versions configured
Types ¶
type APIGatewayConf ¶
type APIGatewayConf struct { Host string `json:"Host"` Port string `json:"Port"` PrivateKeyPath string `json:"PrivateKeyPath"` CertificatePath string `json:"CertificatePath"` PrivateKey []byte Certificate []byte }
APIGatewayConf holds API gateway related configurations
type AddComputeSkipResources ¶
type AddComputeSkipResources struct { SkipResourceListUnderSystem []string `json:"SkipResourceListUnderSystem"` // holds the list of resources which needs to be ignored for storing in DB under system resource SkipResourceListUnderManager []string `json:"SkipResourceListUnderManager"` // holds the list of resources which needs to be ignored for storing in DB under manager resource SkipResourceListUnderChassis []string `json:"SkipResourceListUnderChassis"` // holds the list of resources which needs to be ignored for storing in DB under chassis resource SkipResourceListUnderOthers []string `json:"SkipResourceListUnderOthers"` // holds the list of resources which needs to be ignored for storing in DB under a generic resource apart from system,manager and chassis }
AddComputeSkipResources stores list of resources which need to ignored while inserting the contents to DB while adding Computer System
type AuthConf ¶
type AuthConf struct { SessionTimeOutInMins float64 `json:"SessionTimeOutInMins"` ExpiredSessionCleanUpTimeInMins float64 `json:"ExpiredSessionCleanUpTimeInMins"` PasswordRules *PasswordRules `json:"PasswordRules"` }
AuthConf holds all authentication related configurations
type ConnectionMethodConf ¶
type ConnectionMethodConf struct { ConnectionMethodType string `json:"ConnectionMethodType"` ConnectionMethodVariant string `json:"ConnectionMethodVariant"` }
ConnectionMethodConf is for connection method type and variant
type DBConf ¶
type DBConf struct { Protocol string `json:"Protocol"` InMemoryHost string `json:"InMemoryHost"` InMemoryPort string `json:"InMemoryPort"` OnDiskHost string `json:"OnDiskHost"` OnDiskPort string `json:"OnDiskPort"` MaxIdleConns int `json:"MaxIdleConns"` MaxActiveConns int `json:"MaxActiveConns"` RedisHAEnabled bool `json:"RedisHAEnabled"` InMemorySentinelHost string `json:"InMemorySentinelHost"` InMemorySentinelPort string `json:"InMemorySentinelPort"` OnDiskSentinelHost string `json:"OnDiskSentinelHost"` OnDiskSentinelPort string `json:"OnDiskSentinelPort"` InMemoryPrimarySet string `json:"InMemoryPrimarySet"` OnDiskPrimarySet string `json:"OnDiskPrimarySet"` RedisInMemoryPasswordFilePath string `json:"RedisInMemoryPasswordFilePath"` RedisOnDiskPasswordFilePath string `json:"RedisOnDiskPasswordFilePath"` RedisInMemoryPassword []byte RedisOnDiskPassword []byte }
DBConf holds all DB related configurations
type EventConf ¶
type EventConf struct { DeliveryRetryAttempts int `json:"DeliveryRetryAttempts"` // holds value of retrying event posting to destination DeliveryRetryIntervalSeconds int `json:"DeliveryRetryIntervalSeconds"` // holds value of retrying events posting in interval }
EventConf stores all information related to event delivery configurations
type ExecPriorityDelayConf ¶
type ExecPriorityDelayConf struct { MinResetPriority int `json:"MinResetPriority"` MaxResetPriority int `json:"MaxResetPriority"` MaxResetDelayInSecs int `json:"MaxResetDelayInSecs"` }
ExecPriorityDelayConf holds priority and delay configurations for exec actions
type HTTPConfig ¶
type HTTPConfig struct { // Certificate contains the certifcate data to be loaded Certificate *[]byte // PrivateKey contains the private key data to be loaded PrivateKey *[]byte // CACertificate contains the CA certificate data to be loaded CACertificate *[]byte // ServerAddress contains the IP/FQDN address of the server ServerAddress string // ServerPort contains the port of the server ServerPort string // contains filtered or unexported fields }
HTTPConfig is for passing required info to create a http.Server object
func (*HTTPConfig) GetHTTPClientObj ¶
func (config *HTTPConfig) GetHTTPClientObj() (*http.Client, error)
GetHTTPClientObj is for obtaining a client instance for making http(s) queries
func (*HTTPConfig) GetHTTPServerObj ¶
func (config *HTTPConfig) GetHTTPServerObj() (*http.Server, error)
GetHTTPServerObj is for obtaining a server instance to start a service using iris helper
func (*HTTPConfig) LoadCertificates ¶
func (config *HTTPConfig) LoadCertificates(tlsConfig *tls.Config) error
LoadCertificates is for including passed certificates in tls.Config
type Host ¶
type Host int8
Host defines if the application is Server or client
func (Host) SetTLSConfig ¶
SetTLSConfig is for setting updating common fields of tls.Config
type KeyCertConf ¶
type KeyCertConf struct { RootCACertificatePath string `json:"RootCACertificatePath"` RPCPrivateKeyPath string `json:"RPCPrivateKeyPath"` // location where the Private key is stored RPCCertificatePath string `json:"RPCCertificatePath"` // location where the CA signed certificate is stored RSAPublicKeyPath string `json:"RSAPublicKeyPath"` RSAPrivateKeyPath string `json:"RSAPrivateKeyPath"` RootCACertificate []byte RPCPrivateKey []byte RPCCertificate []byte RSAPublicKey []byte RSAPrivateKey []byte }
KeyCertConf is for holding all security oriented configuration
type MessageBusConf ¶
type MessageBusConf struct { MessageBusConfigFilePath string `json:"MessageBusConfigFilePath"` MessageBusType string `json:"MessageBusType"` OdimControlMessageQueue string `json:"OdimControlMessageQueue"` OdimTaskEventsQueue string `json:"OdimTaskEventsQueue"` }
MessageBusConf holds all message bus configurations
type PasswordRules ¶
type PasswordRules struct { MinPasswordLength int `json:"MinPasswordLength"` // holds the value of min password length MaxPasswordLength int `json:"MaxPasswordLength"` // holds the value of max password length AllowedSpecialCharcters string `json:"AllowedSpecialCharcters"` // holds all value of all sppecial charcters }
PasswordRules defines rules for password complexity
type PluginStatusPolling ¶
type PluginStatusPolling struct { PollingFrequencyInMins int `json:"PollingFrequencyInMins"` // holds value of duration in which status polling to be initiated ,value will be in minutes MaxRetryAttempt int `json:"MaxRetryAttempt"` // holds value number retry attempts RetryIntervalInMins int `json:"RetryIntervalInMins"` // holds value of duration in which retry of status polling to be initiated,value will be in minutes ResponseTimeoutInSecs int `json:"ResponseTimeoutInSecs"` // holds value of duration in which it need wait for response ,value will be in seconds StartUpResourceBatchSize int `json:"StartUpResourceBatchSize"` }
PluginStatusPolling stores all information related to status polling
type PluginTasksConf ¶
type PluginTasksConf struct { // holds value of duration in which polling to be initiated for monitoring plugin tasks, value will be in minutes MonitorPluginTasksFrequencyInMins int `json:"MonitorPluginTasksFrequencyInMins"` }
PluginTasksConf stores the information related to plugin tasks and queueing and prioritization of requests to plugin
type TLSConf ¶
type TLSConf struct { VerifyPeer bool `json:"VerifyPeer"` MinVersion string `json:"MinVersion"` MaxVersion string `json:"MaxVersion"` PreferredCipherSuites []string `json:"PreferredCipherSuites"` }
TLSConf holds TLS configurations used in https queries
type TaskQueueConf ¶
type TaskQueueConf struct { QueueSize int `json:"QueueSize"` DBCommitInterval int `json:"DBCommitInterval"` RetryInterval int `json:"RetryInterval"` }
TaskQueueConf holds configuration for the queue in task service
type URLTranslation ¶
type URLTranslation struct { NorthBoundURL map[string]string `json:"NorthBoundURL"` // holds value of NorthBound Translation SouthBoundURL map[string]string `json:"SouthBoundURL"` // holds value of SouthBound Translation }
URLTranslation ...
type WarningList ¶
type WarningList []string
WarningList will have the warning logs during the config validation
func SetConfiguration ¶
func SetConfiguration() (WarningList, error)
SetConfiguration will extract the config data from file
func ValidateConfiguration ¶
func ValidateConfiguration() (WarningList, error)
ValidateConfiguration will validate configurations read and assign default values, where required