Documentation ¶
Index ¶
- Variables
- func DeleteEmptyDirs(path string) error
- type App
- type AppConfig
- type CertRotationHandler
- type CertRotationState
- type CertRotationStep
- type ConfigCreateRequest
- type ConfigFile
- type ConfigFileReq
- type ConfigStruct
- type CryptoHandler
- type CurrentTarget
- type DeviceUpdate
- type DgEvent
- type DgEventSync
- type DgEventType
- type DgUpdateEvent
- type EciesCrypto
- type EventSync
- type NoOpEventSync
- type PrivateKeyPkcs11
Constants ¶
This section is empty.
Variables ¶
var Commit string
var DEF_CONFIG_ORDER = []string{
"/usr/lib/sota/conf.d",
"/var/sota/sota.toml",
"/etc/sota/conf.d/",
}
var ErrNoWritableFound = errors.New("no writable TOML file found")
var NotModifiedError = errors.New("Config unchanged on server")
Functions ¶
func DeleteEmptyDirs ¶
Types ¶
type App ¶
type App struct { StorageDir string EncryptedConfig string SecretsDir string // contains filtered or unexported fields }
func (*App) CallInitFunctions ¶
func (a *App) CallInitFunctions()
type AppConfig ¶
type AppConfig struct {
// contains filtered or unexported fields
}
func NewAppConfig ¶
NewAppConfig parses config files as per: https://docs.ota.here.com/ota-client/latest/aktualizr-config-options.html#_how_toml_files_are_processed
type CertRotationHandler ¶
type CertRotationHandler struct { State CertRotationState // contains filtered or unexported fields }
func NewCertRotationHandler ¶
func NewCertRotationHandler(app *App, stateFile, estServer string) *CertRotationHandler
NewCertRotationHandler constructs a new handler to initiate a rotation with
func RestoreCertRotationHandler ¶
func RestoreCertRotationHandler(app *App, stateFile string) *CertRotationHandler
RestoreCertRotationHandler will attempt to load a previous rotation attempt's state and return a handler that can process it. This function returns nil when `stateFile` does not exist
func (*CertRotationHandler) RestartServices ¶
func (h *CertRotationHandler) RestartServices()
func (*CertRotationHandler) ResumeRotation ¶
func (h *CertRotationHandler) ResumeRotation(online bool) error
ResumeRotation checks if we have an incomplete cert rotation. If so, it will attempt to complete this rotation. The main reason this would happen is if a power failure occurred during `.Rotate`
func (*CertRotationHandler) Rotate ¶
func (h *CertRotationHandler) Rotate() error
func (*CertRotationHandler) Save ¶
func (h *CertRotationHandler) Save() error
type CertRotationState ¶
type CertRotationState struct { EstServer string RotationId string // A unique ID to identify this rotation operation with StepIdx int PkeySlotIds []string // Available IDs we can use when generating a new key CertSlotIds []string // Available IDs we can use when saving the new cert // Used by estStep NewKey string // Path to key or HSM slot id NewCert string // Path to cert or HSM slot id // Used by fullCfgStep FullConfigEncrypted string // Used by deviceCfgStep DeviceConfigUpdated bool // Used by finalizeStep Finalized bool }
type CertRotationStep ¶
type CertRotationStep interface { Name() string Execute(handler *CertRotationHandler) error }
type ConfigCreateRequest ¶
type ConfigCreateRequest struct { Reason string `json:"reason"` Files []ConfigFileReq `json:"files"` PubKey string `json:"public-key"` }
type ConfigFile ¶
type ConfigFileReq ¶
type ConfigStruct ¶
type ConfigStruct = map[string]*ConfigFile
func UnmarshallBuffer ¶
func UnmarshallBuffer(c CryptoHandler, encContent []byte, decrypt bool) (ConfigStruct, error)
func UnmarshallFile ¶
func UnmarshallFile(c CryptoHandler, encFile string, decrypt bool) (ConfigStruct, error)
type CryptoHandler ¶
func NewEciesLocalHandler ¶
func NewEciesLocalHandler(privKey crypto.PrivateKey) CryptoHandler
func NewEciesPkcs11Handler ¶
func NewEciesPkcs11Handler(ctx *crypto11.Context, privKey crypto11.Signer) CryptoHandler
type CurrentTarget ¶
func LoadCurrentTarget ¶
func LoadCurrentTarget(currentTargeFile string) (CurrentTarget, error)
type DeviceUpdate ¶
type DeviceUpdate struct {
NextPubKey string `json:"next_pubkey"`
}
type DgEventSync ¶
type DgEventSync struct {
// contains filtered or unexported fields
}
func (*DgEventSync) NotifyCompleted ¶
func (s *DgEventSync) NotifyCompleted(err error)
func (*DgEventSync) NotifyStarted ¶
func (s *DgEventSync) NotifyStarted()
func (*DgEventSync) NotifyStep ¶
func (s *DgEventSync) NotifyStep(name string, err error)
func (*DgEventSync) SetCorrelationId ¶
func (s *DgEventSync) SetCorrelationId(corId string)
type DgEventType ¶
type DgUpdateEvent ¶
type DgUpdateEvent struct { Id string `json:"id"` DeviceTime string `json:"deviceTime"` Event DgEvent `json:"event"` EventType DgEventType `json:"eventType"` }
type EciesCrypto ¶
type EciesCrypto struct { PrivKey ecies.KeyProvider // contains filtered or unexported fields }
func (*EciesCrypto) Close ¶
func (ec *EciesCrypto) Close()
type EventSync ¶
type EventSync interface { NotifyStarted() NotifyStep(name string, err error) NotifyCompleted(err error) SetCorrelationId(corId string) }
EventSync in an interface for sending events to device-gateway. The abstraction makes it easier to write unit tests
type NoOpEventSync ¶
type NoOpEventSync struct{}
func (NoOpEventSync) NotifyCompleted ¶
func (s NoOpEventSync) NotifyCompleted(err error)
func (NoOpEventSync) NotifyStarted ¶
func (s NoOpEventSync) NotifyStarted()
func (NoOpEventSync) NotifyStep ¶
func (s NoOpEventSync) NotifyStep(name string, err error)
func (NoOpEventSync) SetCorrelationId ¶
func (s NoOpEventSync) SetCorrelationId(corId string)
type PrivateKeyPkcs11 ¶
func ImportPcks11 ¶
func ImportPcks11(ctx *crypto11.Context, privKey crypto.PrivateKey) *PrivateKeyPkcs11
func (*PrivateKeyPkcs11) GenerateShared ¶
func (prv *PrivateKeyPkcs11) GenerateShared(pub *ecies.PublicKey) (sk []byte, err error)
func (*PrivateKeyPkcs11) Public ¶
func (prv *PrivateKeyPkcs11) Public() *ecies.PublicKey