cannot open /dev/tty: No such device or address

Asier Urrutia asier at alphyra.ie
Wed Oct 29 23:22:54 CET 2003


Hi Steve,

	thanks for your reply. This is a perl script (not shell), so 
where/how can I set the "--no-tty"?

On Wed, 29 Oct 2003, Steve Butler wrote:

> There is a similar error message when driving gpg from cron.  Try the
> --no-tty option.
> 
> -----Original Message-----
> From: Asier Urrutia [mailto:asier at alphyra.ie]
> Sent: Wednesday, October 29, 2003 1:00 PM
> To: gnupg-users at gnupg.org
> Subject: gpg:cannot open /dev/tty: No such device or address
> 
> 
> Hi all,
> 
> 	I've built a perl script in order to parse a mailbox, save
> attachments from emails and decrypt them. If I run the perl script from a
> shell...
> 
> bash$ cat mailbox | mbox-parser.pl
> Reading passphrase from file descriptor 11
> 
> You need a passphrase to unlock the secret key for
> user: "GPG user (GPG user's key) <gpg-user at domain.com>"
> 1024-bit ELG-E key, ID D49D1DBC, created 2003-10-28 (main key ID 7724AA8E)
> bash$
> 	
> 	...it works fine. However, I am unable to get rid of the gpg
> passphrase output. I tried to redirect STDOUT to a log file, but doesn't
> make any difference.
> 
> 	The main problem is when I pipe mail to this perl script from
> procmail:
> 
> bash$ cat .procmailrc
> LOGFILE=/home/user/maillog
> :0 HB : user.procmail.lock
> * ^To:.*user at localhost.localdomain
> | /home/user/bin/mbox-parser.pl
> bash$
> 
> 	then, the script doesn't work due to the following error msg:
> 
> gpg: Warning: using insecure memory!
> gpg: cannot open /dev/tty: No such device or address
> 
> 	which looks to me that the gpg passphrase output is being sent to 
> a terminal, but can't be found any and it fails. I'll enclose here the 
> subroutine I'm using on the decryption, just in case somebody wants to 
> know what I'm doing...
> 
> begin-------------------------------------------
> sub decrypting
> {
> 
>   my $attachment  = $_[0];
> 
>   my $gnupg = GnuPG::Interface->new();
> 
>   $gnupg->options->hash_init( armor    => 1,
>                               recipients => [ 'tj-cl-testing at alphyra.ie' ]
>                             );
> 
>   my ( $input, $output, $error, $passphrase_fh, $status_fh )
>     = ( IO::Handle->new(),
>         IO::Handle->new(),
>         IO::Handle->new(),
>         IO::Handle->new(),
>         IO::Handle->new(),
>       );
> 
>   my $handles = GnuPG::Handles->new( stdin      => $input,
>                                      stdout     => $output,
>                                      stderr     => $error,
>                                      passphrase => $passphrase_fh,
>                                      status     => $status_fh,
>                                    );
> 
>   my $cipher_file = IO::File->new( "$attachment" );
>   my $pid = $gnupg->decrypt( handles => $handles );
> 
>   print $passphrase_fh $passphrase;
>   close $passphrase_fh;
>   print $input $_ while <$cipher_file>;
>   close $input;
>   close $cipher_file;
> 
>   my @plaintext    = <$output>;   # reading the output
>   my @error_output = <$error>;    # reading the error
>   my @status_info  = <$status_fh>; # read the status info
> 
>   open(LOGFILE,">>$DECRLOG");
>   my $date = `date`;
>   chomp($date);
>   print LOGFILE "\n$date -- $attachment decryption 
> logging...\n=============================\n";
>   print LOGFILE @error_output;
>   print LOGFILE @status_info;
>   close(LOGFILE);
> 
> open (SAVE,">$ATTACHLOC/$ATTACHMENT.decrypted");
> print SAVE @plaintext;
> close(SAVE);
>   # clean up...
>   close $output;
>   close $error;
>   close $status_fh;
> 
>   waitpid $pid, 0;  # clean up the finished GnuPG process
> 
> }
> end------------------------------------------------------
> 
> 
> 	Anybody came across something like this?
> 
> Thanks a million,
> Asier
> 	
> 
> 
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users at gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-users
> 
> 
> CONFIDENTIALITY NOTICE:  This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
> 

-- 
Asier Urrutia					Phone:  +34  94 677 4372
Systems Administration Team
Alphyra Ireland, Heather Road,			Mobile: +34  690 632 839 
Sandyford Ind. Est., Dublin 18			Email:   asier at alphyra.ie





More information about the Gnupg-users mailing list