Documentation
¶
Overview ¶
Package systemd handles authd's socket activation and descriptor store.
Index ¶
- Constants
- Variables
- func Listeners() ([]net.Listener, error)
- type DescriptorStore
- type TestDescriptorStore
- func (s *TestDescriptorStore) Close() error
- func (s *TestDescriptorStore) Load() map[string][]*os.File
- func (s *TestDescriptorStore) Put(name string, files ...*os.File) error
- func (s *TestDescriptorStore) Remove(names ...string) error
- func (s *TestDescriptorStore) Serve(tb testing.TB, socket string)
- func (s *TestDescriptorStore) SetFailRemove(fail bool)
Constants ¶
const StorePrefix = "pa-"
StorePrefix distinguishes reservation descriptors from listening sockets.
Variables ¶
var ErrDescriptorNameExists = errors.New("descriptor store name already exists")
ErrDescriptorNameExists means Put rejected a name before changing the store.
Functions ¶
Types ¶
type DescriptorStore ¶
type DescriptorStore interface {
Load() map[string][]*os.File
Put(name string, files ...*os.File) error
Remove(names ...string) error
Close() error
}
DescriptorStore preserves descriptors outside the authd process.
func NewDescriptorStore ¶
func NewDescriptorStore() (DescriptorStore, error)
NewDescriptorStore returns nil when authd is not running under a configured systemd service. Such instances must not expose first-time SSH reservations.
func Z_ForTests_DescriptorStoreClient ¶
func Z_ForTests_DescriptorStoreClient(socket string) DescriptorStore
Z_ForTests_DescriptorStoreClient connects integration-test daemons to the descriptors retained by their parent test process.
type TestDescriptorStore ¶
type TestDescriptorStore struct {
FailPut bool
FailRemove bool
// contains filtered or unexported fields
}
TestDescriptorStore holds descriptors outside a simulated daemon instance.
func Z_ForTests_NewDescriptorStore ¶
func Z_ForTests_NewDescriptorStore(tb testing.TB) *TestDescriptorStore
Z_ForTests_NewDescriptorStore supplies the same ownership semantics as systemd, without changing the host's service manager.
func (*TestDescriptorStore) Close ¶
func (s *TestDescriptorStore) Close() error
Close represents daemon exit, not service-manager exit.
func (*TestDescriptorStore) Load ¶
func (s *TestDescriptorStore) Load() map[string][]*os.File
Load duplicates systemd's references for a new daemon instance.
func (*TestDescriptorStore) Put ¶
func (s *TestDescriptorStore) Put(name string, files ...*os.File) error
Put keeps copies after the sender closes its descriptors.
func (*TestDescriptorStore) Remove ¶
func (s *TestDescriptorStore) Remove(names ...string) error
Remove releases the service manager's copies.
func (*TestDescriptorStore) Serve ¶
func (s *TestDescriptorStore) Serve(tb testing.TB, socket string)
Serve retains subprocess descriptors until the test ends, including across daemon restarts. The socket must be in a private test directory.
func (*TestDescriptorStore) SetFailRemove ¶
func (s *TestDescriptorStore) SetFailRemove(fail bool)
SetFailRemove changes removal failures while a daemon worker is running.