common

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package common provides functionality that is used in more than one internal library.

Index

Constants

View Source
const (
	ActionLoginIdentifier = "UserLogin"
	ActionUserAction      = "UserAction"
	ActionSystemAction    = "SystemAction"
)
View Source
const (
	UnknownUser = "unknown"
	UnknownAddr = "unknown"
)
View Source
const (
	// MachineIDPath is the path to the machine-id file.
	MachineIDPath = "/etc/machine-id"
)
View Source
const (
	// TimeFlushPath is a file that contains the timestamp
	// of the last-read journal entry.
	//
	// Refer to the RealtimeTimestamp field in the
	// sdjournal.JournalEntry struct for details.
	TimeFlushPath = "/var/run/audito-maldito/flush_time"
)

Variables

This section is empty.

Functions

func EnsureFlushDirectory

func EnsureFlushDirectory() error

EnsureFlushDirectory ensures that the directory where we store the last-read timestamp file exists.

func GetLastRead

func GetLastRead() (timestampUnix uint64, err error)

GetLastRead attempts to read the last-read journal timestamp saved by this application. This allows the application to start reading from wherever it left off previously.

func GetMachineID

func GetMachineID() (string, error)

GetMachineID returns the machine ID.

func GetNodeName

func GetNodeName() (string, error)

GetNodeName returns the node name. It reads it from the NODE_NAME environment variable.

func IsNamedPipe added in v0.5.0

func IsNamedPipe(filePath string) error

IsNamedPipe returns a non-nil error if filePath cannot be stat'ed or if it is not a named pipe.

Types

type GenericSyncMap added in v0.2.0

type GenericSyncMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

GenericSyncMap is a generic sync.Map.

func NewGenericSyncMap added in v0.2.0

func NewGenericSyncMap[K comparable, V any]() *GenericSyncMap[K, V]

NewGenericSyncMap returns a new GenericSyncMap.

func (*GenericSyncMap[K, V]) Delete added in v0.2.0

func (m *GenericSyncMap[K, V]) Delete(key K)

Delete deletes the value for a key.

func (*GenericSyncMap[K, V]) DeleteUnsafe added in v0.2.0

func (m *GenericSyncMap[K, V]) DeleteUnsafe(key K)

DeleteUnsafe deletes the value for a key without locking.

func (*GenericSyncMap[K, V]) Has added in v0.2.0

func (m *GenericSyncMap[K, V]) Has(key K) bool

Has returns true if the key is present in the map.

func (*GenericSyncMap[K, V]) Iterate added in v0.2.0

func (m *GenericSyncMap[K, V]) Iterate(cb func(key K, value V) bool)

Iterate iterates over the map and calls the callback for each key/value pair. If the callback returns false, the iteration stops. Note that the callback is called while the map is locked, so it should not call any methods on the map.

func (*GenericSyncMap[K, V]) Len added in v0.2.0

func (m *GenericSyncMap[K, V]) Len() int

Len returns the number of items in the map.

func (*GenericSyncMap[K, V]) Load added in v0.2.0

func (m *GenericSyncMap[K, V]) Load(key K) (V, bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*GenericSyncMap[K, V]) Store added in v0.2.0

func (m *GenericSyncMap[K, V]) Store(key K, value V)

Store sets the value for a key.

func (*GenericSyncMap[K, V]) WithLockedValueDo added in v0.2.0

func (m *GenericSyncMap[K, V]) WithLockedValueDo(key K, cb func(value V) error) error

WithLockedValueDo calls the callback with the value for the given key, if it exists. The callback is called while the map is locked, so modifying values in the map should be safe. Calling locking methods on the map from the callback will cause a deadlock.

type RemoteUserLogin

type RemoteUserLogin struct {
	Source     *auditevent.AuditEvent
	PID        int
	CredUserID string
}

func (RemoteUserLogin) Validate

func (o RemoteUserLogin) Validate() error

type RemoteUserLoginValidateError

type RemoteUserLoginValidateError struct {
	// contains filtered or unexported fields
}

func (RemoteUserLoginValidateError) Error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL