Documentation ¶
Overview ¶
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func GetConfDirPath() string
- func GetDataDirPath() string
- func GetStateDirPath() string
- func SaveConfigFile(config *MenderConfigFromFile, filename string) error
- func ShowVersion() string
- func VersionString() string
- type Connectivity
- type DBusConfig
- type DualRootfsDeviceConfig
- type HttpConfig
- type HttpsClient
- type MenderConfig
- func (c *MenderConfig) GetDeploymentLogLocation() string
- func (c *MenderConfig) GetDeviceConfig() DualRootfsDeviceConfig
- func (c *MenderConfig) GetHttpConfig() HttpConfig
- func (c *MenderConfig) GetTenantToken() []byte
- func (c *MenderConfig) GetVerificationKeys() []*VerificationKey
- func (c *MenderConfig) Validate() error
- type MenderConfigFromFile
- type MenderServer
- type Security
- type VerificationKey
Constants ¶
const ( DefaultUpdateControlMapBootExpirationTimeSeconds = 600 Pkcs11URIPrefix = "pkcs11:" )
const (
BrokenArtifactSuffix = "_INCONSISTENT"
)
Variables ¶
var ( // needed so that we can override it when testing or deploying on partially read-only systems DefaultPathConfDir = getenv("MENDER_CONF_DIR", "/etc/mender") DefaultPathDataDir = getenv("MENDER_DATA_DIR", "/usr/share/mender") DefaultDataStore = getenv("MENDER_DATASTORE_DIR", "/var/lib/mender") DefaultKeyFile = "mender-agent.pem" DefaultConfFile = path.Join(GetConfDirPath(), "mender.conf") DefaultFallbackConfFile = path.Join(GetStateDirPath(), "mender.conf") )
var ( // device specific paths DefaultArtScriptsPath = path.Join(GetStateDirPath(), "scripts") DefaultRootfsScriptsPath = path.Join(GetConfDirPath(), "scripts") DefaultModulesPath = path.Join(GetDataDirPath(), "modules", "v3") DefaultModulesWorkPath = path.Join(GetStateDirPath(), "modules", "v3") DefaultBootstrapArtifactFile = path.Join(GetStateDirPath(), "bootstrap.mender") // deprecated files DeprecatedArtifactInfoFile = path.Join(GetConfDirPath(), "artifact_info") )
var ( // Version information of current build Version string )
Functions ¶
func GetConfDirPath ¶
func GetConfDirPath() string
func GetDataDirPath ¶
func GetDataDirPath() string
func GetStateDirPath ¶
func GetStateDirPath() string
func SaveConfigFile ¶
func SaveConfigFile(config *MenderConfigFromFile, filename string) error
func ShowVersion ¶
func ShowVersion() string
func VersionString ¶
func VersionString() string
Types ¶
type Connectivity ¶
type Connectivity struct { // If set to true, there will be no persistent connections, and every // HTTP transaction will try to establish a new connection DisableKeepAlive bool `json:",omitempty"` // A number of seconds after which a connection is considered idle and closed. // The longer this is the longer connections are up after the first call over HTTP IdleConnTimeoutSeconds int `json:",omitempty"` }
Connectivity instructs the client how we want to treat the keep alive connections and when a connection is considered idle and therefore closed NOTE: Careful when changing this, the struct is exposed directly in the 'mender.conf' file.
type DBusConfig ¶
type DBusConfig struct {
Enabled bool
}
type DualRootfsDeviceConfig ¶
type HttpConfig ¶
type HttpConfig struct { ServerCert string *HttpsClient *Connectivity NoVerify bool }
type HttpsClient ¶
type HttpsClient struct { Certificate string `json:",omitempty"` Key string `json:",omitempty"` SSLEngine string `json:",omitempty"` }
HttpsClient holds the configuration for the client side mTLS configuration NOTE: Careful when changing this, the struct is exposed directly in the 'mender.conf' file.
func (*HttpsClient) Validate ¶
func (h *HttpsClient) Validate()
type MenderConfig ¶
type MenderConfig struct { MenderConfigFromFile // Additional fields that are in our config struct for convenience, but // not actually configurable via the config file. ModulesPath string ModulesWorkPath string ArtifactScriptsPath string RootfsScriptsPath string BootstrapArtifactFile string }
func LoadConfig ¶
func LoadConfig(mainConfigFile string, fallbackConfigFile string) (*MenderConfig, error)
LoadConfig parses the mender configuration json-files (/etc/mender/mender.conf and /var/lib/mender/mender.conf) and loads the values into the MenderConfig structure defining high level client configurations.
func NewMenderConfig ¶
func NewMenderConfig() *MenderConfig
func (*MenderConfig) GetDeploymentLogLocation ¶
func (c *MenderConfig) GetDeploymentLogLocation() string
func (*MenderConfig) GetDeviceConfig ¶
func (c *MenderConfig) GetDeviceConfig() DualRootfsDeviceConfig
func (*MenderConfig) GetHttpConfig ¶
func (c *MenderConfig) GetHttpConfig() HttpConfig
func (*MenderConfig) GetTenantToken ¶
func (c *MenderConfig) GetTenantToken() []byte
GetTenantToken returns a default tenant-token if no custom token is set in local.conf
func (*MenderConfig) GetVerificationKeys ¶
func (c *MenderConfig) GetVerificationKeys() []*VerificationKey
GetVerificationKeys reads all verification keys.
func (*MenderConfig) Validate ¶
func (c *MenderConfig) Validate() error
Validate verifies the Servers fields in the configuration
type MenderConfigFromFile ¶
type MenderConfigFromFile struct { // Path to the public key used to verify signed updates. // Only one of ArtifactVerifyKey/ArtifactVerifyKeys can be specified. ArtifactVerifyKey string `json:",omitempty"` // List of verification keys for verifying signed updates. // Starting in order from the first key in the list, // each key will try to verify the artifact until one succeeds. // Only one of ArtifactVerifyKey/ArtifactVerifyKeys can be specified. ArtifactVerifyKeys []string `json:",omitempty"` // HTTPS client parameters HttpsClient HttpsClient `json:",omitempty"` // Security parameters Security Security `json:",omitempty"` // Connectivity connection handling and transfer parameters Connectivity Connectivity `json:",omitempty"` // Rootfs device path RootfsPartA string `json:",omitempty"` RootfsPartB string `json:",omitempty"` // Command to set active partition. BootUtilitiesSetActivePart string `json:",omitempty"` // Command to get the partition which will boot next. BootUtilitiesGetNextActivePart string `json:",omitempty"` // Path to the device type file DeviceTypeFile string `json:",omitempty"` // DBus configuration DBus DBusConfig `json:",omitempty"` // Expiration timeout for the control map UpdateControlMapExpirationTimeSeconds int `json:",omitempty"` // Expiration timeout for the control map when just booted UpdateControlMapBootExpirationTimeSeconds int `json:",omitempty"` // Poll interval for checking for new updates UpdatePollIntervalSeconds int `json:",omitempty"` // Poll interval for periodically sending inventory data InventoryPollIntervalSeconds int `json:",omitempty"` // Skip CA certificate validation SkipVerify bool `json:",omitempty"` // Global retry polling max interval for fetching update, authorize wait and update status RetryPollIntervalSeconds int `json:",omitempty"` // Global max retry poll count RetryPollCount int `json:",omitempty"` // State script parameters StateScriptTimeoutSeconds int `json:",omitempty"` StateScriptRetryTimeoutSeconds int `json:",omitempty"` // Poll interval for checking for update (check-update) StateScriptRetryIntervalSeconds int `json:",omitempty"` // The timeout for the execution of the update module, after which it // will be killed. ModuleTimeoutSeconds int `json:",omitempty"` // Path to server SSL certificate ServerCertificate string `json:",omitempty"` // Server URL (For single server conf) ServerURL string `json:",omitempty"` // Path to deployment log file UpdateLogPath string `json:",omitempty"` // Server JWT TenantToken TenantToken string `json:",omitempty"` // List of available servers, to which client can fall over Servers []MenderServer `json:",omitempty"` // Log level which takes effect right before daemon startup DaemonLogLevel string `json:",omitempty"` }
func (*MenderConfigFromFile) GetUpdateControlMapBootExpirationTimeSeconds ¶
func (c *MenderConfigFromFile) GetUpdateControlMapBootExpirationTimeSeconds() int
func (*MenderConfigFromFile) GetUpdateControlMapExpirationTimeSeconds ¶
func (c *MenderConfigFromFile) GetUpdateControlMapExpirationTimeSeconds() int
type MenderServer ¶
type MenderServer struct {
ServerURL string
}
MenderServer is a placeholder for a full server definition used when multiple servers are given. The fields corresponds to the definitions given in MenderConfig.
type Security ¶
type Security struct { AuthPrivateKey string `json:",omitempty"` SSLEngine string `json:",omitempty"` }
Security structure holds the configuration for the client Added for MEN-3924 in order to provide a way to specify PKI params outside HttpsClient. NOTE: Careful when changing this, the struct is exposed directly in the 'mender.conf' file.