semanage

package
v0.0.0-...-4cc2d59 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHandleCreate is an error when getting a handle to semanage
	ErrHandleCreate = errors.New("could not create handle")
	// ErrSELinuxDBConnect is an error to connect to the SELinux database
	ErrSELinuxDBConnect = errors.New("could not connect to the SELinux DB")
	// ErrNilHandle would happen if you initialized the Handler without
	// the using the `NewSemanageHandler` function or without initializing
	// the underlying semanage handler
	ErrNilHandle = errors.New("nil semanage handle")
	// ErrList is an error listing the SELinux modules
	ErrList = errors.New("cannot list")
	// ErrCannotRemoveModule is an error removing a SELinux module
	ErrCannotRemoveModule = errors.New("cannot remove module")
	// ErrCannotInstallModule is an error installing a SELinux module
	ErrCannotInstallModule = errors.New("cannot install module")
	// ErrCommit is an error when commiting the changes to the SELinux policy
	ErrCommit = errors.New("cannot commit changes to policy")
)

errors

Functions

func LogWrapper

func LogWrapper(cmsg *C.char, level C.int)

func NewErrCannotInstallModule

func NewErrCannotInstallModule(mName string) error

func NewErrCannotRemoveModule

func NewErrCannotRemoveModule(mName string) error

func NewErrCommit

func NewErrCommit(origErrVal int, msg string) error

func NewSemanageHandler

func NewSemanageHandler(autoCommit bool, logger logr.Logger) (semodule.Handler, error)

NewSemanageHandler creates a new instance of a semodule.Handler that handles SELinux module interactions through the semanage interface

`autoCommit` tells the handler to always issue a commit when installing/removing policies. If this is set to `off` You would need to commit explicitly.

Types

type SeHandler

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

func (*SeHandler) Close

func (sm *SeHandler) Close() error

Close disconnects the Semanage handler's connection. It implements the Closer interface [1]

[1] https://golang.org/pkg/io/#Closer

func (*SeHandler) Commit

func (sm *SeHandler) Commit() error

func (*SeHandler) Install

func (sm *SeHandler) Install(moduleFile string) error

func (*SeHandler) List

func (sm *SeHandler) List() ([]string, error)

func (*SeHandler) Remove

func (sm *SeHandler) Remove(moduleName string) error

func (*SeHandler) SetAutoCommit

func (sm *SeHandler) SetAutoCommit(autoCommit bool)

SetAutoCommit set's the `autoCommit` property in the handler

Jump to

Keyboard shortcuts

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