Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterIntegrityCheckFlag(flagset *pflag.FlagSet, dst *string)
- func RegisterIntegrityCheckPeriodFlag(flagset *pflag.FlagSet, dst *int)
- func RegisterWithIntegrityFlag(flagset *pflag.FlagSet, dst *string)
- type Data
- type DataCollector
- type DataCollectorFactory
- type DataPublisher
- type DataPublisherFactory
- type IntegrityCtx
- type Repository
- type Signer
Constants ¶
const HashesFileName = ""
HashesFileName is a name of a file containing file hashes that require checking.
Variables ¶
var ( // ErrNotConfigured is reported when integrity check is not configured // in the command context. ErrNotConfigured = errors.New("integrity check is not configured") )
Functions ¶
func RegisterIntegrityCheckFlag ¶
RegisterIntegrityCheckFlag is a noop function that is intended to add root flag enabling integrity checks.
func RegisterIntegrityCheckPeriodFlag ¶
RegisterIntegrityCheckPeriodFlag is a noop function that is intended to add flag specifying how often should integrity checks run in watchdog.
func RegisterWithIntegrityFlag ¶
RegisterWithIntegrityFlag is a noop function that is intended to add flags to `tt pack` command.
Types ¶
type Data ¶
type Data struct {
// Source is the origin of data, i.e. key in case of etcd or tarantool-based collectors.
Source string
// Value is data collected.
Value []byte
// Revision is data revision.
Revision int64
}
Data represents collected data with its source.
type DataCollector ¶
DataCollector interface must be implemented by a source collector.
type DataCollectorFactory ¶
type DataCollectorFactory interface {
// NewFile creates a new data collector to collect configuration from a file.
NewFile(path string) (DataCollector, error)
// NewEtcd creates a new data collector to collect configuration from etcd.
NewEtcd(etcdcli *clientv3.Client,
prefix, key string, timeout time.Duration) (DataCollector, error)
// NewTarantool creates a new data collector to collect configuration from
// tarantool config storage.
NewTarantool(conn tarantool.Connector,
prefix, key string, timeout time.Duration) (DataCollector, error)
}
DataCollectorFactory creates new data collectors.
func NewDataCollectorFactory ¶
func NewDataCollectorFactory(ctx IntegrityCtx) (DataCollectorFactory, error)
NewDataCollectorFactory creates a new CollectorFactory with integrity checks in collectors. In the CE implementation it always returns ErrNotConfigured.
type DataPublisher ¶
type DataPublisher interface {
// Publish publishes the interface or returns an error.
Publish(revision int64, data []byte) error
}
DataPublisher interface must be implemented by a raw data publisher.
type DataPublisherFactory ¶
type DataPublisherFactory interface {
// NewFile creates a new DataPublisher to publish data into a file.
NewFile(path string) (DataPublisher, error)
// NewEtcd creates a new DataPublisher to publish data into etcd.
NewEtcd(etcdcli *clientv3.Client,
prefix, key string, timeout time.Duration) (DataPublisher, error)
// NewTarantool creates a new DataPublisher to publish data into tarantool
// config storage.
NewTarantool(conn tarantool.Connector,
prefix, key string, timeout time.Duration) (DataPublisher, error)
}
Data publisher factory creates new data publishers.
func NewDataPublisherFactory ¶
func NewDataPublisherFactory(path string) (DataPublisherFactory, error)
NewDataPublisherFactory create a new DataPublisherFactory with integrity algorithms in publishers. Should be never be called in the CE.
type IntegrityCtx ¶
type IntegrityCtx struct {
// Repository is a repository used to check integrity of files.
Repository Repository
}
IntegrityCtx is context required for integrity checks.
func InitializeIntegrityCheck ¶
func InitializeIntegrityCheck(publicKeyPath string, configDir string) (IntegrityCtx, error)
InitializeIntegrityCheck is a noop setup of integrity checking.
type Repository ¶
type Repository interface {
// Read makes sure the file is not modified and reads it.
Read(path string) (io.ReadCloser, error)
// ValidateAll checks that all the files stored in the repository
// were not modified.
ValidateAll() error
}
Repository provides utilities for working with files and ensuring that they were not compomised.