That will immediately prompt for your LUKS password and unlock the encrypted device to /dev/mapper/[NAME]. [NAME] can be whatever you'd like. You'll then need to mount the unlocked filesystem using something like sudo mount /dev/mapper/[NAME] /mnt.
My assumption is that you would be able to script something where you grab the password from some UI tool (rofi/dmenu/etc), then echo "$PASS_FROM_GUI" | sudo cryptsetup luksOpen /dev/[ENCRYPTED_DEVICE] [NAME]. (Note echoing passwords is probably not the most secure, but 🤷♂️ if it's your personal laptop/desktop.
Also, if you want to unmount and lock properly, just work in reverse:
sudo umount /mnt
sudo cryptSetup luksClose [NAME]
Hope this helps!
Edit: Not sure of your DE/WM, but I'm pretty positive that there are friendly Gnome GUIs that will unlock and mount automatically. (Probably tied to GVFS.)
Edit 2: Obviously, place your UI script in your DE's session startup or .xinitrc.
Not the proper answer, but if you want an easy bulletproof, leak-free setup:
install the AUR package stubby
edit /etc/stubby/stubby.yml to use proper resolvers (I chose cloudflare); I set my listener to 127.0.0.153:53, but you can use whatever loopback ip/port you want (eg 127.0.0.1:53)
echo "nameserver 127.0.0.153" | sudo tee /etc/resolv.conf
to prevent random resolvconf/openresolv/dnsmasq/systemd-resolved/NetworkManager/etc from molesting my /etc/resolve.conf, I lock it using sudo chattr +i /etc/resolv.conf
This setup always encrypts all DNS traffic via DNS-over-TLS whether in a trusted or VPN environment. Personally, my benchmarks show that when I use cloudflare's resolvers, it's incredibly fast. (Your experience might differ depending on your location and networks.) And unless you have a horrible internet connection, the use of a local caching resolver is horseshit and just gets in the way (let the remote caching resolver do the dirty work).
And if you ever need to change your DNS temporarily (for captive portals and whatnot), you can temporarily unlock your resolv.conf file with chattr -i. I even have a bash script that simply toggles 8.8.8.8 and 127.0.0.153 to get around Starbucks' captive portal.
That should be completely safe (especially if it's on your local machine). And honestly, you probably don't even need ControlPath at all (especially that it defaults to /tmp). I copied those options out of my ssh config where I specifically changed the path for debugging purposes.
Might be a good time to check out Alacritty?
It would be fairly easy to script into a GUI prompt, but the command is essentially:
sudo cryptsetup luksOpen /dev/[ENCRYPTED_DEVICE] [NAME]That will immediately prompt for your LUKS password and unlock the encrypted device to
/dev/mapper/[NAME].[NAME]can be whatever you'd like. You'll then need to mount the unlocked filesystem using something likesudo mount /dev/mapper/[NAME] /mnt.My assumption is that you would be able to script something where you grab the password from some UI tool (rofi/dmenu/etc), then
echo "$PASS_FROM_GUI" | sudo cryptsetup luksOpen /dev/[ENCRYPTED_DEVICE] [NAME]. (Noteechoing passwords is probably not the most secure, but 🤷♂️ if it's your personal laptop/desktop.Also, if you want to unmount and lock properly, just work in reverse:
Hope this helps!
Edit: Not sure of your DE/WM, but I'm pretty positive that there are friendly Gnome GUIs that will unlock and mount automatically. (Probably tied to GVFS.)
Edit 2: Obviously, place your UI script in your DE's session startup or
.xinitrc.Not the proper answer, but if you want an easy bulletproof, leak-free setup:
stubby127.0.0.153:53, but you can use whatever loopback ip/port you want (eg 127.0.0.1:53)sudo systemctl disable systemd-resolved; sudo systemctl stop systemd-resolvedsudo systemctl enable stubby; sudo systemctl start stubbyecho "nameserver 127.0.0.153" | sudo tee /etc/resolv.conf/etc/resolve.conf, I lock it usingsudo chattr +i /etc/resolv.confThis setup always encrypts all DNS traffic via DNS-over-TLS whether in a trusted or VPN environment. Personally, my benchmarks show that when I use cloudflare's resolvers, it's incredibly fast. (Your experience might differ depending on your location and networks.) And unless you have a horrible internet connection, the use of a local caching resolver is horseshit and just gets in the way (let the remote caching resolver do the dirty work).
And if you ever need to change your DNS temporarily (for captive portals and whatnot), you can temporarily unlock your resolv.conf file with
chattr -i. I even have a bash script that simply toggles8.8.8.8and127.0.0.153to get around Starbucks' captive portal.That should be completely safe (especially if it's on your local machine). And honestly, you probably don't even need ControlPath at all (especially that it defaults to /tmp). I copied those options out of my ssh config where I specifically changed the path for debugging purposes.
Thanks! I love this new view!