Mailing List Archive

gpg/cgi
So I'm not the only one having trouble getting a cgi to work with GPG?

Since I am running the web server as Nobody, I am setting the userid
and home dir.

The error I am geeting is "invalid home directory"

I am using Linux 6.2, Perl 5.004, GnuPG.pm, and my code looks like this:

(I've left out some chunks)

#!/usr/bin/perl

use strict;
use GnuPG;
use CGI::Carp qw(fatalsToBrowser);
use CGI;

my $in = new CGI;
my $userid = "xxxx";

## Read in variables from form-
$color = $in->param('color');
$name = $in->param('name');
$ship_address = $in->param('Shipping Address');
$ship_city = $in->param('Shipping City');
$ship_state = $in->param('Shipping State');
$ship_zip = $in->param('Shipping Zip');
$bill_name = $in->param('Billing Name');
$bill_address = $in->param('Billing Address');
$bill_city = $in->param('Billing City');
$bill_state = $in->param('Billing State');
$bill_zip = $in->param('Billing Zip');

my $gpg = new GnuPG( homedir => "/home/xxxx/", trace => 1 );

my $gpg->encrypt( recipient => "xxxx",
plaintext =>
"/home/httpd/html/pacific_cycle/orders/ordfile.txt",
output => "$filename" . ".gpg"
);

Any help would be appreciated!!!

Sean

-----------------
Sean Abel
Software Developer
Clotho Advanced Media, Inc.

"Research is what I am doing when I don't know what I am doing." --
Wernher von Braun

--
Archive is at http://lists.gnupg.org - Unsubscribe by sending mail
with a subject of "unsubscribe" to gnupg-users-request@gnupg.org
Re: gpg/cgi [ In reply to ]
The solution which finally worked for me was to set the HOME
environment variable in my script:

$ENV{'HOME'} = '/path/to/nobodys/directory';

It apparently doesn't matter what user you run the script under if
this variable is not set, it will fail. It wasn't set by default on
my server, which is a pretty run-of-the-mill apache 1.3.12 . Hope
this helps.




>So I'm not the only one having trouble getting a cgi to work with GPG?
>
>Since I am running the web server as Nobody, I am setting the userid
>and home dir.
>
>The error I am geeting is "invalid home directory"
>
>I am using Linux 6.2, Perl 5.004, GnuPG.pm, and my code looks like this:
>
>(I've left out some chunks)
>
>#!/usr/bin/perl
>
>use strict;
>use GnuPG;
>use CGI::Carp qw(fatalsToBrowser);
>use CGI;
>
>my $in = new CGI;
>my $userid = "xxxx";
>
>## Read in variables from form-
>$color = $in->param('color');
>$name = $in->param('name');
>$ship_address = $in->param('Shipping Address');
>$ship_city = $in->param('Shipping City');
>$ship_state = $in->param('Shipping State');
>$ship_zip = $in->param('Shipping Zip');
>$bill_name = $in->param('Billing Name');
>$bill_address = $in->param('Billing Address');
>$bill_city = $in->param('Billing City');
>$bill_state = $in->param('Billing State');
>$bill_zip = $in->param('Billing Zip');
>
>my $gpg = new GnuPG( homedir => "/home/xxxx/", trace => 1 );
>
>my $gpg->encrypt( recipient => "xxxx",
> plaintext =>
>"/home/httpd/html/pacific_cycle/orders/ordfile.txt",
> output => "$filename" . ".gpg"
> );
>
>Any help would be appreciated!!!
>
>Sean
>
>-----------------
>Sean Abel
>Software Developer
>Clotho Advanced Media, Inc.
>
>"Research is what I am doing when I don't know what I am doing." --
>Wernher von Braun
>--
>Archive is at http://lists.gnupg.org - Unsubscribe by sending mail
>with a subject of "unsubscribe" to gnupg-users-request@gnupg.org


Erik Wessel
STREET | CANCE
MARKETING COMMUNICATIONS
233 North Water Street
Milwaukee WI 53202
ph 414 | 765 | 0333
fax 414 | 765 | 1207

--
Archive is at http://lists.gnupg.org - Unsubscribe by sending mail
with a subject of "unsubscribe" to gnupg-users-request@gnupg.org
re: gpg/cgi [ In reply to ]
my $gpg = new GnuPG(gnupg_path=>'/usr/local/bin/gpg',
homedir=>'/home/dturley/.gnupg');

Try using the whole path to where the .gnupg file is.

Works for me.

--
Archive is at http://lists.gnupg.org - Unsubscribe by sending mail
with a subject of "unsubscribe" to gnupg-users-request@gnupg.org