CMTAB(5) | User commands | CMTAB(5) |
cmtab - static information about filesystems managed by cryptmount
Information about the encrypted filesystems managed by cryptmount is contained in the file /etc/cryptmount/cmtab. Each filesystem is labelled by a target name which can be used as an argument to cryptmount and which appears in /etc/cryptmount/cmtab in front of a list of parameters describing where that filesystem is stored, and how it is encrypted.
The format of the cmtab is flexible, with the description of each target being delimited by braces, parameters being specified by KEY=VALUE pairs, and white-space being freely usable. Comments are prefixed by a '#' character, and can start at any point in a line, lasting to the end of the line. The backslash character '\' can be used to ignore any special significance of the following character, for example to include a space in a filename.
/etc/cryptmount/cmtab contains entries of the following form:
TARGET_NAME {
dev=DEVICE # REQUIRED
flags=FLAG,FLAG,...
startsector=STARTSECTOR
numsectors=NUMSECTORS
loop=LOOPDEV
dir=MOUNT_POINT # REQUIRED
fstype=TYPE # REQUIRED
mountoptions=MOPT,MOPT,...
fsckoptions=FOPT;FOPT;...
supath=SUPATH
bootaction=BOOTACTION
cipher=CIPHER
ivoffset=IVOFFSET
keyformat=KEYMANAGER
keyfile=KEYFILE # REQUIRED
keyhash=KEYHASH
keycipher=KEYCIPHER
keymaxlen=KEYMAXLEN
passwdretries=NUMATTEMPTS
}
Some fields, such as 'dev' and 'fstype' are mandatory, although many fields have sensible default values. Depending on the choice of KEYMANAGER, fields such as 'keyhash', 'keycipher', 'keymaxlen' may need to be set explicitly.
Any field which contains non-numerical values (e.g. not 'startsector', 'ivoffset' etc.) can contain references to environmental variables of the form $(HOME). The following variables are recognized, all based on the characteristics of the user currently running cryptmount :
$(HOME) # the home directory, as obtained from /etc/passwd
$(UID) # the numerical identifier of the user
$(USERNAME) # the printable name of the user
$(GID) # the numerical identifier of the user's current group
$(GROUPNAME) # the printable name of the user's current group
The components in each target definition have the following meaning:
cryptmount supports a variety of different ways of protecting the access key associated with each encrypted filesystem. For most users, the default “builtin” keymanager will provide a good level of security and flexibility. Alternative keymanagers offer a wider choice of different password-hashing schemes and compatibility with other encryption tools. The strengths and weaknesses of the different keymanagers are discussed below.
builtin
This keymanager is supported by cryptmount-2.0 or later, and uses a separate key-file. A password-based key derivation function (PBKDF) using the SHA1 hashing algorithm, together with blowfish-cbc encryption is used to protect the filesystem key. That key-derivation function was changed in cryptmount-4.0 to improve the security of new keyfiles, while preserving compatibility with existing keyfiles. If you need to write keyfiles in the previous format, you can specify “keyformat=builtin:0”. The KEYHASH and KEYCIPHER parameters are ignored.
libgcrypt
This keymanager is supported by cryptmount-1.1 or later, and uses a separate key-file. A password-based key derivation function (PBKDF) is used to protect the filesystem key, with any hashing or cipher algorithm supported by the installed version of the libgcrypt library being available.
luks
This keymanager is supported by cryptmount-3.1 or later, and provided compatibility with the Linux Unified Key Setup (LUKS) disk-format. Instead of a separate keyfile, LUKS uses a header within the encrypted filesystem itself. It is advisable to choose the same value for both the 'dev' and 'keyfile' parameters, or leave 'keyfile' unspecified. As with all cryptmount filesystems, the 'dev' parameter may point to either a raw disk partition or an ordinary file. However, because of the filesystem structure assumed by LUKS, it is strongly recommended that you do not use either the 'startsector' or 'numsector' parameters.
openssl/openssl-compat
This keymanager has been supported since the earliest release of cryptmount, and uses a separate keyfile which is compatible with the format used by the 'openssl' command-line encryption tool. Since cryptmount-3.0 this file-format has been provided via the libgcrypt library, and is preferably specified by “keyformat=openssl-compat”. A password-based key derivation function (PBKDF) is used to protect the filesystem key, with a choice of hashing or cipher algorithms being available. Most algorithms supported by the 'openssl' command-line tool should be available, provided the underlying algorithms are available within libgcrypt.
password
This keymanager is supported by cryptmount-4.0 or later, and does not require any separate keyfile, but instead derives the filesystem key directly from the user's password. This means that it is not possible to change the access password without re-encrypting the entire filesystem. The 'keyhash' and 'keycipher' parameters are ignored.
raw
This keymanager is supported by cryptmount-1.1 or later, and uses a separate keyfile where the access key is stored directly and without any encryption. This keymanager is most useful for managing encrypted swap partitions, where the keyfile can be chosen as /dev/random, and hence where the access key will be different every time it is read. If the keyfile is an ordinary file, it offers minimal security, and should preferably be stored separately from the disk containing the encrypted filesystem, e.g. on a USB flash disk.
Because cryptmount needs to operate with setuid privileges, it is very important that its configuration file is kept secure. Ideally /etc/cryptmount/cmtab should be managed only by the system administrator, and all key-files should be readable only by their owner.
cryptmount makes basic checks on the security of
/etc/cryptmount/cmtab each time it runs, and will refuse to operate unless
the following conditions are met:
* cmtab must be owned by root
* cmtab must be a regular file
* cmtab must not be globally writable
* the directory containing cmtab must be owned by root
* the directory containing cmtab must not be globally writable
In addition, for each target within /etc/cryptmount/cmtab, all paths must be
absolute (i.e. starting with '/').
When using unencrypted keyfiles (i.e. when KEYMANAGER is "raw"), it is recommended that the KEYFILE is stored with access permissions no less restrictive than 0600, or on a removable device such as a USB flash-disk. (With recent versions of cryptmount the "builtin" key-format should be portable between different installations and vastly more secure than "raw" keyfiles.)
It is very important that you do not lose or damage the KEYFILE as this file is essential to providing access to your encrypted filesystem. You are strongly advised to consider keeping a backup of your KEYFILE in some form.
When the 'mkswap' option is selected for a particular target within /etc/cryptmount/cmtab, cryptmount will attempt to automatically format an encrypted swap partition whenever you run "cryptmount --swapon <target>". This is often useful when there is no need to preserve swap data between reboots, such as when not using the kernel's hibernation features.
Because reformatting will destroy any existing data on the chosen swap partition, cryptmount will do some basic checking on the first megabyte of the partition, based on the degree of randomness (entropy) in the current contents. If the partition looks like it contains pure noise, or has been zeroed, then the partition will be formatted automatically. If cryptmount determines that the partition may contain non-random data, then it will ask you to run 'mkswap' manually.
As there is no fool-proof way of determining whether a partition (especially after encryption) contains valuable data, you should be very careful about the raw device chosen for any target on which you select the 'mkswap' option.
The following example of /etc/cryptmount/cmtab consists of five targets, using a variety of encryption algorithms and storing their filesystems in different ways, including a target representing an encrypted swap partition:
# /etc/cryptmount/cmtab
# example file - please modify before use
_DEFAULTS_ {
passwdretries=3 # allow 3 password attempts by default
}
luks { # partition created by cryptsetup-luks
dev=/dev/sdb63
dir=/mnt/luks-partition-$(USERNAME)
keyformat=luks
fstype=ext3
}
basic {
dev=/home/secretiveuser/crypt.fs
dir=/home/secretiveuser/crypt # where to mount
loop=auto # find free loop-device
fstype=ext3 mountoptions=default
cipher=aes-cbc-plain # filesystem encryption
keyfile=/home/secretiveuser/crypt.key
# use default sha1/blowfish key-encryption:
keyformat=builtin
}
partition {
dev=/dev/sdb62 # use whole disk partition
dir=/mnt/crypt62
fstype=ext3 mountoptions=nosuid,noexec
cipher=serpent-cbc-plain
# information about file used to store decryption key:
keyfile=/etc/cryptmount/crypt_sdb62.key
keyformat=openssl # use OpenSSL key-encryption
keyhash=md5 keycipher=bf-cbc # encryption of key file
}
subset {
dev=/dev/sdb63
startsector=512 numsectors=16384 # use subset of partition
dir=/mnt/encrypted\ subset\ of\ sdb
fstype=reiserfs mountoptions=defaults
cipher=twofish-cbc-plain # filesystem encryption
# information about file used to store decryption key:
keyfile=/etc/cryptmount/crypt_sdb63.key
keyformat=libgcrypt
keyhash=md5 keycipher=blowfish-cbc # encryption of key file
}
encswap { # encrypted swap partition
bootaction=swap
dev=/dev/disk/by-id/scsi-SATA_ST500_ABCDEFG-part37
startsector=16896 numsectors=1024 # use subset of partition
fstype=swap flags=mkswap cipher=twofish-cbc-plain
# read fresh 16-byte key from /dev/random whenever used:
keyfile=/dev/random keymaxlen=16 keyformat=raw
}
# end of cmtab
The 'basic' target uses an ordinary file "/home/secretiveuser/crypt.fs" to store the encrypted filesystem, perhaps within a normal user's home directory. A loopback device will be automatically allocated (because of the "loop=auto") by cryptmount to turn this into a block-special device, before mounting. The decryption key for the filesystem is also stored in this user's home directory, making it easier for them to change the password protecting the key.
The 'partition' target uses a whole disk partition to store the encrypted filesystem, with the decryption key stored in the main cryptmount configuration directory.
The 'subset' target is similar to the 'partition' target except that it does not use a whole disk partition. This would allow other groups of blocks within that partition to be used for other filesystems managed via cryptmount or dmsetup.
The 'encswap' target uses a subset of blocks within a disk partition to form an encrypted swap device. A new encryption key is read from the system random-number generator /dev/random every time the target is used.
The 'luks' target provides access to an encrypted partition created by the 'cryptsetup-luks' utility. By using the environmental variable $(USERNAME), the filesystem's mount-point will vary depending on which user invokes cryptmount. For example, user 'joe' would find the filesystem mounted below /mnt/luks-partition-joe. cryptmount will be able to mount and unmount the partition, but various advanced LUKS features must be accessed through cryptsetup
/etc/cryptmount/cmtab - main configuration file
cryptmount(8), cryptmount-setup(8), cryptsetup(8), dmsetup(8), openssl(1)
cryptmount is Copyright 2005-2023, RW Penney
and is supplied with NO WARRANTY. Licencing terms are as described in the file
"COPYING" within the cryptmount source distribution.
2022-09-03 | 6.2.0 |