|
|
10 months ago | |
|---|---|---|
| .gitignore | 10 months ago | |
| automount_luks.py | 10 months ago | |
| crypt_tools.py | 10 months ago | |
| luks_mount.conf | 10 months ago | |
| master_passkey | 10 months ago | |
| private_key.pem | 10 months ago | |
| public_key.pem | 10 months ago | |
| random_pass.py | 10 months ago | |
| readme.md | 10 months ago |
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.
argparse librarycryptography librarysubprocess libraryThe 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==
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
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).
cryptsetup and mount commands are installed and available on the system.sudo command to run the umount and cryptsetup commands with elevated privileges.