Mounting encrypted disk images via Keyboard Maestro


#1

I’m new to Keyboard Maestro and have been trying to build a macro that will move sensitive client files into a encrypted 2018-12 - g image that I’ve created with disktool

The macro checks to see of the container is mounted. If, it moves files and detaches the container.

If the container is not mounted, it mounts, asks for pw, waits until avaliable for the os and moves the files. It finally detaches the container via a simple shell script tha calls hdiutil on macos (hdiutil detach /Volumes/Gringotts/)

So far I have the macro working, but it seems that macOS os not asking for the passcode every time I open the dmg file. Hence, I suspect it is stored somewhere in memory.

Anyone knows for to force a passcode or to flush the passcode when the dmg file is detached ?

I’m sure there are smarter ways of doing this and would appreciate some input:


#2

Instead of .dmg files I use encrypted sparsebundles, see https://blog.fosketts.net/2015/07/22/how-to-use-mac-os-x-sparse-bundle-disk-images/

Then I also use macros to check whether the drive is mounted or not, probably similar to the ones you’re using: https://forum.keyboardmaestro.com/t/macros-mount-drive-unmount-drive-check-if-drive-is-mounted/5713

Then, in my Keychain, I made a new password entry that I call in the macro and save into a variable. (This variable gets nulled again at the end of the macro so the pw doesn’t hang around.)

This combination never fails to ask for a password, running OSX High Sierra…


#3

Thank’s Christian - I try that out :smile:


#4

Something must have happened to the passphrase enroute to mojave (10.14.3b2) Also using sparsebundle is freely attach, detach and eject with not passcode prompts. I am sure it’s not in my keychain.

But thank’s for pointing out the sparsebundle instead dmg files :slight_smile:

-mic