Documentation ¶
Overview ¶
Package common provides functionality that is used in more than one internal library.
Index ¶
- Constants
- func EnsureFlushDirectory() error
- func GetLastRead() (timestampUnix uint64, err error)
- func GetMachineID() (string, error)
- func GetNodeName() (string, error)
- func IsNamedPipe(filePath string) error
- type GenericSyncMap
- func (m *GenericSyncMap[K, V]) Delete(key K)
- func (m *GenericSyncMap[K, V]) DeleteUnsafe(key K)
- func (m *GenericSyncMap[K, V]) Has(key K) bool
- func (m *GenericSyncMap[K, V]) Iterate(cb func(key K, value V) bool)
- func (m *GenericSyncMap[K, V]) Len() int
- func (m *GenericSyncMap[K, V]) Load(key K) (V, bool)
- func (m *GenericSyncMap[K, V]) Store(key K, value V)
- func (m *GenericSyncMap[K, V]) WithLockedValueDo(key K, cb func(value V) error) error
- type RemoteUserLogin
- type RemoteUserLoginValidateError
Constants ¶
const ( ActionLoginIdentifier = "UserLogin" ActionUserAction = "UserAction" ActionSystemAction = "SystemAction" )
const ( UnknownUser = "unknown" UnknownAddr = "unknown" )
const (
// MachineIDPath is the path to the machine-id file.
MachineIDPath = "/etc/machine-id"
)
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 ¶
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 GetNodeName ¶
GetNodeName returns the node name. It reads it from the NODE_NAME environment variable.
func IsNamedPipe ¶ added in v0.5.0
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 ¶
func (o RemoteUserLoginValidateError) Error() string