# Automount LUKS Filesystems ## Overview This script automates the process of mounting and unmounting LUKS-encrypted filesystems. It uses a configuration file to store the device UUIDs, mount points, and encrypted passphrases. ## Requirements * Python 3.x * `argparse` library * `cryptography` library * `subprocess` library ## Configuration File The configuration file is expected to be in the following format: ``` uuid mount_point encrypted_passphrase ``` For example: ``` f48bfd48-e478-4fd1-97b0-5bf66844b584 /media/yazoo/luks-f48bfd48-e478-4fd1-97b0-5bf66844b584 c6jvKUgjvNhImxO2OpndSHRMeO4N7+R2oN2i2eiqsXwSqMCD2juqSXRSUI8QrNOqR/SLRX5vkBZkwZ669Xv8nRXHpeWsSzr7t9qUjz48tIgTH/sfVDkxztyKre247M4hRAHUBevXTFRaa8H81w3x59Loix5/nlZ0EqYgyM/vSZzGv3hZIeIia2tWxE8b7Mbb/BwCj9fjxVgTD5v0TsfHQftf/BwWJcFqIleFDaD84hVfzAyOwNJhn56DanbUiwHnKwgr/HZ7/36UZ/rbB7zBaLt2hFaY3t6012bdkEzOe9/9b0UCXtoMeL9XmNQm5mWEtzOlcoUJUlpNkZSuaaJV+g== ``` ## Usage The script can be run with the following options: ``` $ python automount_luks.py -h usage: automount_luks.py [-h] [-m] [-c CLOSE] [-f CONFIG_FILE] optional arguments: -h, --help show this help message and exit -m, --mount Mount the specified device -c CLOSE, --close CLOSE Close the specified device -f CONFIG_FILE, --config CONFIG_FILE Specify a configuration file ``` ## Key Generation The script uses RSA keys to encrypt and decrypt the passphrases. The keys can be generated using the `crypt_tools.py` script: ``` $ python crypt_tools.py ``` This will generate a private key file (`private_key.pem`) and a public key file (`public_key.pem`). ## Notes * The script assumes that the `cryptsetup` and `mount` commands are installed and available on the system. * The script uses the `sudo` command to run the `umount` and `cryptsetup` commands with elevated privileges. * The script does not handle errors well, and may require additional error handling and logging in a production environment.