Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

GnuPG not working when in BATCH

 
Highlighted
Frequent Advisor

GnuPG not working when in BATCH

A client has a command procedure to pull encrypted files from an ftp site and then decrypt them  They now want to do this on a nightly basis and tried putting their procedure in a resubmitting BATCH job.

 

Interactively, their command procedure works to decrypt the files with this line doing the PGP decryption:

 

$ PIPE gpg -v  --no-tty --passphrase-fd 0 --output "file.csv" --decrypt "file^.csv.pgp" < PASSPHRASE.TXT

 

However, in BATCH, the 'gpg' command seem to go into an infinite loop.

 

I thinking something is confusing the'gpg --passphrase-fd 0..." in batch mode.

 

 

Please, no lectures about the PASSPHRASE in a file...

21 REPLIES 21
Highlighted
Frequent Advisor

Re: GnuPG not working when in BATCH

FWIW,  I founf that just trying to use GPG in batch is the problem:

 

$ SET PROCESS/PARSE_STYLE=EXTENDED
$ @SYS$COMMON:[GnuPG]GnuPG_SETUP.COM
$ GPG   == "$SYS$COMMON:[GNUPG.GNUPG-1_4_11A_VMS.G10.ALPHAL]GPG.EXE
$ GPGV  == "$SYS$COMMON:[GNUPG.GNUPG-1_4_11A_VMS.G10.ALPHAL]GPGV.EXE
$ gpg -?

Infinite loop! 

 

$ gpg --version
gpg (GnuPG) 1.4.11a
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

 

Highlighted
Honored Contributor

Re: GnuPG not working when in BATCH

Are you running your the HP GnuPG port, Mr Schweda's port, your own port, or some other port?  

 

If you're not running Mr Schweda's port, start there.  Failing that, maybe try your own port?

Highlighted
Frequent Advisor

Re: GnuPG not working when in BATCH

The GnuPG on the HP site.

 

Highlighted
Honored Contributor

Re: GnuPG not working when in BATCH

Then definitely try Steven's GnuPG port.
Highlighted
Frequent Advisor

Re: GnuPG not working when in BATCH

I stand corrected:

 

$SYS$COMMON:[GNUPG.GNUPG-1_4_11A_VMS.G10.ALPHAL]GPG.EXE

-------------------------------------------------^^^^^^^^

 

I looked at the HP site and that version is 1.4.7.

Highlighted
Frequent Advisor

Re: GnuPG not working when in BATCH

Definitely  Steven M. Schweda's build... as per SYS$COMMON:[GNUPG.GNUPG-1_4_11A_VMS.VMS]VMS_NOTES.TXT...

 

   When reporting problems, especially build problems, with GnuPG for
VMS, it is often useful to reveal precise compiler, run-time library,
and VMS version information.  The program DECC_VER.C (included in the
kit) is intended to make that easier.

------------------------------------------------------------------------

   Steven M. Schweda               sms@antinode.info
   382 South Warwick Street        (+1) 651-699-9818
   Saint Paul  MN  55105-2547

Highlighted
Honored Contributor

Re: GnuPG not working when in BATCH

>    When reporting problems, [...]

 

   While it's always gratifying to see one's advice quoted, it can be
even more satisfying when it's followed.

> However, in BATCH, the 'gpg' command seem to go into an infinite loop.

 

   Apparently something does.  I'd never tried:
      pipe gpg --passphrase-fd 0 ... < pp.txt
but it does seem to loop.  What did work for me were things like:
       pp_symb = "Pass Phrase"
       pipe write sys$output pp_symb | gpg --passphrase-fd 0 ...
and:
       pipe type pp.txt | gpg --passphrase-fd 0 ...

Both seem satisfactory in and out of batch mode.

 

   When I get bored enough, I might look into what's happening in the
"pipe gpg --passphrase-fd 0 ... < file" case.  I should be able to add a
usage note on the Web page, if nothing else.

Highlighted
Honored Contributor

Re: GnuPG not working when in BATCH

Brian,

   Maybe instead of using PIPE input redirection, try DEFINE/USER. For example:

 

$ DEFINE/USER SYS$INPUT PASSPHRASE.TXT

$ gpg ....

 

or possibly:

 

$ DEFINE/USER SYS$COMMAND PASSPHRASE.TXT

$ gpg ....

 

With Unix utilities I've sometimes found it necessary to redirect SYS$COMMAND when running in batch mode:

 

$ DEFINE/USER SYS$COMMAND NL:

$ PIPE gpg... < PASSPHRASE.TXT

 

Never quite understood why. It may have something to do with the assumptions about input streams and the differences between Unix and VMS.

A crucible of informative mistakes
Highlighted
Honored Contributor

Re: GnuPG not working when in BATCH

Brian,  

 

this works for us.

 

$ pipe ty <Passphrase_File> | GPG --output 'Decr_File' --decrypt 'Encr_File'

 

Dave.