###################################################################################################################### # See: kissitconsulting.com/blog/post/a-slick-option-for-dynamically-mounting-luks-encrypted-external-hard-drives # For an overview of this script ###################################################################################################################### ############################################ ## This is our base configuration block [base] # mounts= Comma separated list of mounts to process from the configuration below. mounts=test1,test12,test2 # key_file= File configured as the encryption key for all drives key_file=/root/.lukskey # error_log= File to use for errors during the processing. error_log=/root/.error_log # set_user= User to set directories to after being mounted set_user=brian # set_group= Group to set directories to after being mounted set_group=brian # device_refresh_wait= Number of seconds to wait after running a partprobe to ensure that the devices are refreshed device_refresh_wait=5 # A comma separated list of pre tasks to run before beginning to unmount the mounts (optional, leave empty for none) unmount_tasks=/etc/init.d/nfs stop # A comma separated list of post tasks to run after mounting the mounts (optional, leave empty for none) mount_tasks=/etc/init.d/nfs start ############################################ ## This is our email configuration block [mail] # from_address= Email address to send notifications from. Leave empty for none. from_address= # status_email= Email address to send all notifications to, status and error. Leave empty for none. status_email= # error_email= Email address that should only receive error notifications, say a ticketing system. Leave empty for none. error_email= # email_subject= The base subject of the email notifications email_subject=Encrypted drive mounter ############################################################################# ## This is an example of mounting an unencrypted ext4 partition using this script [test1] # luks= yes for LUKS partitions, no otherwise (required) luks=no # type= Filesystem type. Use ext4 for any ext partition, use zfs for a Zpool (required) type=ext4 # mount= Mount point for the device (required) mount=/backups/test1 # mount_option= Mount options to pass to the mount command. Enclose in double quotes. Not used for type=zfs. Leave empty for none. mount_options="-o rw,noatime,barrier=0" # check= A location that once mounted can be used as a functional check that the mount is working (required) check=/backups/test1/backup # device= The device to mount for luks=no. For luks=yes this is the device to use to determine the partition to open (required) device=/dev/disk/by-label/test1 # clean= Comma separated list of items to cleanup when mounting a device. Leave empty for none. clean=/backups/test1/backup # nagios_check= File to be touched after mounting to use for Nagios checks. Leave empty for none. nagios_check=/backups/test1/backup/.check ############################################################################# ## This is an example of mounting a LUKS encrypted ext4 partition using this script [test12] luks=yes type=ext4 mount=/backups/test12 mount_options="-o rw,noatime,barrier=0" check=/backups/test12/backup device=/dev/disk/by-label/test1 map=test12 clean=/backups/test12/backup nagios_check=/backups/test12/backup/.check ################################################################################################### ## This is an example of mounting a LUKS encrypted ZFS partition (actually zpool) using this script #[test2] #luks=yes #type=zfs #mount=/backups/test2 #check=/backups/test2/backup #device=/dev/disk/by-label/test2 #map=zfs_test2 #clean= #nagios_check=/backups/test2/backup/.check