cipherdyne.org

Michael Rash, Security Researcher



gpgdir - Recursive directory encryption with GnuPG

gpgdir is a perl script that uses the CPAN GnuPG::Interface module to encrypt and decrypt directories using a gpg key specified in ~/.gpgdirrc.

gpgdir supports recursively descending through a directory in order to make sure it encrypts or decrypts every file in a directory and all of its subdirectories. In addition, gpgdir is careful to not encrypt hidden files and directories. Other features include the ability to interface with the wipe program for secure file deletion, and the ability to obfuscate the original filenames within encrypted directories. It should be noted that gpgdir is not intended as a replacement or competitor to good filesystem encryption solutions such as encfs - it is merely an effort to apply GnuPG recursively to files since GnuPG itself doesn't offer this capability.

As an example of gpgdir operations, here is the output for recursively encrypting the GnuPG-Interface directory in the gpgdir sources (note that the "t" directory is excluded from the command line): [mbr@minastirith ~/src/gpgdir]$ gpgdir --Exclude "GnuPG-Interface/t" --encrypt GnuPG-Interface
[+] Executing: gpgdir --Exclude GnuPG-Interface/t --encrypt GnuPG-Interface
Using GnuPG key: A742839F
Enter password (for initial encrypt/decrypt test)
Password:

[+] Encrypting directory: /home/mbr/src/gpgdir/GnuPG-Interface
[+] Building file list...
[-] Skipping encrypted file: /home/mbr/src/gpgdir/GnuPG-Interface/test/pubring.gpg
[-] Skipping encrypted file: /home/mbr/src/gpgdir/GnuPG-Interface/test/encrypted.1.gpg
[-] Skipping encrypted file: /home/mbr/src/gpgdir/GnuPG-Interface/test/secring.gpg
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/PublicKey.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/Options.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/Makefile.PL
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/MANIFEST
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/README
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/NEWS
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/Signature.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/Handles.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/PrimaryKey.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/THANKS
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/Fingerprint.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/ChangeLog
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/SecretKey.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/SubKey.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/Key.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/VERSION
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/COPYING
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/UserId.pm
[+] Encrypting: /home/mbr/src/gpgdir/GnuPG-Interface/lib/GnuPG/Interface.pm

[+] Total number of files encrypted: 19