[ale] FD 3 on gpg?

Neal Rhodes neal at mnopltd.com
Sun Nov 17 23:56:53 EST 2013


Here is a boiled down script buried in the bowels of a system which
uploads data from pharmacies: 


        CMD="gpg --homedir $HOME_DIR/.gnupg --batch --passphrase-fd 3
        --decrypt $HOLD 2> /tmp/gpg.err.$$ | /usr/local/bin/$PARSER  2>>
        $LOG_FILE"
        eval "$CMD"


Which actually works.    I cannot fathom how.    The FM says it will
read the passphrase from file descriptor 3.  Uh...Stdin, Stdout, Stderr,
There goes 0, 1, 2.    uh, that would be a file defined within gpg? 

Well, it sorta works.   If you wiggle it, or jiggle it, modify it
various ways, it stops working and typically says "Bad passphrase". 

This:

        CMD="cat something-something-icanttellyou/k_file.asc | gpg
        --homedir $HOME_DIR/.gnupg --batch --passphrase-fd 0 --decrypt
        $HOLD 2> /tmp/gpg.err.$$ | /usr/local/bin/$PARSER 2>> $LOG_FILE"
        eval "$CMD"


Does work reliably under various combinations. 

Maybe there is some magic about FD 3 here, but I'm not finding it.
Something about gpg-agent? 

Neal Rhodes
MNOP Ltd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20131117/820fdfc6/attachment.html>


More information about the Ale mailing list