security

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package security manages:

  • Cache clearing (cache.go)
  • Keyring Operations (keyring.go)
  • Privilege manipulation (privileges.go)
  • Maintaining the link between the root and user keyrings.

Index

Constants

View Source
const KeyType = "logon"

KeyType is always logon as required by filesystem encryption.

Variables

View Source
var (
	ErrKeySearch         = errors.New("could not find key with descriptor")
	ErrKeyRemove         = util.SystemError("could not remove key from the keyring")
	ErrKeyInsert         = util.SystemError("could not insert key into the keyring")
	ErrSessionUserKeying = errors.New("user keyring not linked into session keyring")
	ErrAccessUserKeyring = errors.New("could not access user keyring")
	ErrLinkUserKeyring   = util.SystemError("could not link user keyring into root keyring")
)

Keyring related error values

Functions

func DropFilesystemCache added in v0.2.2

func DropFilesystemCache() error

DropFilesystemCache instructs the kernel to free the reclaimable inodes and dentries. This has the effect of making encrypted directories whose keys are not present no longer accessible. Requires root privileges.

func FindKey

func FindKey(description string, target *user.User) (int, error)

FindKey tries to locate a key in the kernel keyring with the provided description. The key ID is returned if we can find the key. An error is returned if the key does not exist.

func InsertKey

func InsertKey(data []byte, description string, target *user.User) error

InsertKey puts the provided data into the kernel keyring with the provided description.

func RemoveKey

func RemoveKey(description string, target *user.User) error

RemoveKey tries to remove a policy key from the kernel keyring with the provided description. An error is returned if the key does not exist.

func SetThreadPrivileges added in v0.2.1

func SetThreadPrivileges(target *user.User) error

SetThreadPrivileges temporarily drops the privileges of the current thread to have the effective uid/gid of the target user. The privileges can be changed again with another call to SetThreadPrivileges.

func UserKeyringID added in v0.2.1

func UserKeyringID(target *user.User, checkSession bool) (int, error)

UserKeyringID returns the key id of the target user's user keyring. We also ensure that the keyring will be accessible by linking it into the process keyring and linking it into the root user keyring (permissions allowing). If checkSession is true, an error is returned if a normal user requests their user keyring, but it is not in the current session keyring.

Types

This section is empty.

Jump to

Keyboard shortcuts

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