Documentation ¶
Overview ¶
Package cryptmapper provides a wrapper around libcryptsetup to manage dm-crypt volumes for CSI drivers.
Index ¶
- Constants
- func IsIntegrityFS(fstype string) (string, bool)
- type CryptMapper
- func (c *CryptMapper) CloseCryptDevice(volumeID string) error
- func (c *CryptMapper) GetDevicePath(volumeID string) (string, error)
- func (c *CryptMapper) OpenCryptDevice(ctx context.Context, source, volumeID string, integrity bool) (string, error)
- func (c *CryptMapper) ResizeCryptDevice(ctx context.Context, volumeID string) (string, error)
Constants ¶
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 ¶
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 ¶
ResizeCryptDevice resizes the underlying crypt device and returns the mapped device path.