Documentation ¶
Overview ¶
Package config ...
Package config ...
Package config ...
Package config ...
Index ¶
- Constants
- Variables
- func CheckRootServiceuuid(uid string) error
- func SetConfiguration() error
- func SetDefaultTLSConf()
- func SetPreferredCipherSuites(cipherList []string) error
- func SetTLSMaxVersion(version string) error
- func SetTLSMinVersion(version string) error
- func SetUpMockConfig(t *testing.T) error
- func SetVerifyPeer(val bool)
- func ValidateConfiguration() error
- func ValidateConfiguredTLSVersions() error
- type APIGatewayConf
- type AddComputeSkipResources
- type AuthConf
- type DBConf
- type ExecPriorityDelayConf
- type HTTPConfig
- type Host
- type KeyCertConf
- type PasswordRules
- type PluginStatusPolling
- type TLSConf
- type URLTranslation
Constants ¶
const ( // DefaultFirmwareVersion - default FirmwareVersion value DefaultFirmwareVersion = "1.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 // DefaultStartUpResouceBatchSize - default StartUpResouceBatchSize value DefaultStartUpResouceBatchSize = 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 )
Variables ¶
var ( // DefaultSystemCollection - default SystemCollection value DefaultSystemCollection = []string{"Chassis", "LogServices"} // DefaultChassisCollection - default ChassisCollection value DefaultChassisCollection = []string{"Managers", "Systems", "Devices"} // DefaultOtherCollection - default OtherCollection value DefaultOtherCollection = []string{"Power", "Thermal", "SmartStorage"} // DefaultCipherSuiteList - default cipher suite list DefaultCipherSuiteList = []uint16{ tls.TLS_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_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_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, } // 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_RC4_128_SHA": tls.TLS_RSA_WITH_RC4_128_SHA, "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_CBC_SHA256": tls.TLS_RSA_WITH_AES_128_CBC_SHA256, "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_RC4_128_SHA": tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, "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_RC4_128_SHA": tls.TLS_ECDHE_RSA_WITH_RC4_128_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_ECDSA_WITH_AES_128_CBC_SHA256": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256": tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, "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, } // 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 = &sync.Mutex{} // 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 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 SetConfiguration ¶
func SetConfiguration() error
SetConfiguration will extract the config data from file
func SetDefaultTLSConf ¶
func SetDefaultTLSConf()
SetDefaultTLSConf is for updating TLS conf with default values
func SetPreferredCipherSuites ¶
SetPreferredCipherSuites is for setting configuredCipherSuiteList
func SetTLSMaxVersion ¶
SetTLSMaxVersion is for setting configuredTLSMaxVersion
func SetTLSMinVersion ¶
SetTLSMinVersion is for setting configuredTLSMinVersion
func SetUpMockConfig ¶
SetUpMockConfig set ups a mock ration for unit testing
func ValidateConfiguration ¶
func ValidateConfiguration() error
ValidateConfiguration will validate configurations read and assign default values, where required
func ValidateConfiguredTLSVersions ¶
func ValidateConfiguredTLSVersions() 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 { SystemCollection []string `json:"SystemCollection"` // holds the value of system resource which need to be ignored ChassisCollection []string `json:"ChassisCollection"` // holds the value of chassis resource which need to be ignored OtherCollection []string `json:"OtherCollection"` // holds the value resource name for which next level retrieval to be ignored }
AddComputeSkipResources stores all resource which need to igonered 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 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"` }
DBConf holds all DB related 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 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 intiated ,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 intiated,value will be in minutes ResponseTimeoutInSecs int `json:"ResponseTimeoutInSecs"` // holds value of duation in which it need wait for resposne ,value will be in seconds StartUpResouceBatchSize int `json:"StartUpResouceBatchSize"` }
PluginStatusPolling stores all inforamtion related to status polling