cryptmapper

package
v2.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package cryptmapper provides a wrapper around libcryptsetup to manage dm-crypt volumes for CSI drivers.

Index

Constants

View Source
const (
	// LUKSHeaderSize is the amount of bytes taken up by the header of a LUKS2 partition.
	// The header is 16MiB (1048576 Bytes * 16).
	LUKSHeaderSize = 16777216
)

Variables

This section is empty.

Functions

func IsIntegrityFS

func IsIntegrityFS(fstype string) (string, bool)

IsIntegrityFS checks if the fstype string contains an integrity suffix. If yes, returns the trimmed fstype and true, fstype and false otherwise.

Types

type CryptMapper

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

CryptMapper manages dm-crypt volumes.

func New

func New(kms keyCreator) *CryptMapper

New initializes a new CryptMapper with the given kms client and key-encryption-key ID. kms is used to fetch data encryption keys for the dm-crypt volumes.

func (*CryptMapper) CloseCryptDevice

func (c *CryptMapper) CloseCryptDevice(volumeID string) error

CloseCryptDevice closes the crypt device mapped for volumeID. Returns nil if the volume does not exist.

func (*CryptMapper) GetDevicePath

func (c *CryptMapper) GetDevicePath(volumeID string) (string, error)

GetDevicePath returns the device path of a mapped crypt device.

func (*CryptMapper) OpenCryptDevice

func (c *CryptMapper) OpenCryptDevice(ctx context.Context, source, volumeID string, integrity bool) (string, error)

OpenCryptDevice maps the volume at source to the crypt device identified by volumeID. The key used to encrypt the volume is fetched using CryptMapper's kms client.

func (*CryptMapper) ResizeCryptDevice

func (c *CryptMapper) ResizeCryptDevice(ctx context.Context, volumeID string) (string, error)

ResizeCryptDevice resizes the underlying crypt device and returns the mapped device path.

Jump to

Keyboard shortcuts

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