Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: GnuPG::Interface Problem

by mattr (Curate)
on Sep 21, 2006 at 04:40 UTC ( [id://574050]=note: print w/replies, xml ) Need Help??


in reply to GnuPG::Interface Problem

google: gpg cron google: gpg cron tty

Looks like this error, not uncommon. As above poster mentioned. Also maybe path in cron environment is different too (path to gpg, or to keys/files may be different)... Many people are posting about problems running gpg programs under crontab not due to Perl.

Try adding --no-tty as well as --batch

gpg: cannot open `/dev/tty': No such device or address

You would think the batch(1) would fix it but maybe not.. perhaps you can insert some print statements in the module, run under cron and check the messages emailed to you.

> I was getting the same problem and I included --batch in my commands and it
> worked for me.
>
> cat /root/.gnupg/pass | $GPG --batch --passphrase-fd 0 --quiet \
> --output $SIGNED --clearsign $REPORT

Apparently the cron environment also may have a different locale which can mess up the signature but that is not your problem. The fh is short for filehandle and refers to the pipe the module opens to the gpg program.

Another post notes:



You're running gpg as a batch job and from cron, ie no tty available. GPG can in some occasions still print warnings to the tty even though --batch is used as an option.

> And even when "--no-tty" and "--batch" are given on the > commandline, GPG may ask questions, if I remember correctly. No, there shall be no interactive input with --batch. If you noticed such a case, it is a bug and should be reported.

And even when "--no-tty" and "--batch" are given on the commandline, GPG may ask questions, if I remember correctly. For encrpytion it should work anyway, without questions.


Incidentally one thread recommends making a wrapper (your perl program I expect, if you are running with perl as interpreter not bash) to set up the necessary environment instead of changing the username under which the cron command runs with vixie-cron or su.

Finally it is possible a message is being generated as noted is possible above, if it finds an untrusted key and wants to ask you if it is okay to use it. Here is how that was solved:
gpg: WARNING: --honor-http-proxy is a deprecated option. gpg: please use "--keyserver-options honor-http-proxy" instead gpg: D61B227D: There is no indication that this key really belongs to +the owner gpg: cannot open /dev/tty: No such device or address the first one can be fixed by removing/commenting out the #honor-http-proxy option in the ~/.gnupg/options file the /dev/tty problem can be fixed by appending --always-trust to the command line, because gpg tries to ask for a passphrase or something to approve the use of an untusted key.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://574050]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-20 01:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found