Using GNUPG with php scripts and webserver

View: New views
3 Messages — Rating Filter:   Alert me  

Using GNUPG with php scripts and webserver

by womble :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi I cant get php scripts from Apache to execute GNUPG comands.

I figure its a USER problem.

If I run cmds or execute php scripts from the cmd line that works fine.

Im running Cpanel with PHP Version 5.2.0

Apache is running as nobody, and in /etc/passwd I have

nobody:x:99:99:Nobody:/:/sbin/nologin

I tried changing that to

nobody:x:99:99:Nobody:/home/nobody:/bin/bash

so that I could su to nobody and do gpg --import KEY and set the trust but even after that I still couldnt run any PHP scripts from the browser.

Anyone give me a step by step how to set up GNUPG with PHP in a browser.

Thanks

Re: Using GNUPG with php scripts and webserver

by Stef Caunter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Check error_log for the problem (if you can) - permissions on ~/.gnupg files
will cause things to not work and you must have environment exported for the
nobody user. I reset $ENV{'HOME'} in perl... there must be something
similar in php. If you can view the environment the server provides in the
browser you can see if you have what gpg requires. I assume the binary is in
$PATH for the webserver.
Keys must be readable and implicitly trusted for the webserver user and
this user must have somewhere to write if you are using temporary files.

Stef
http://caunter.ca/crypto.html

On Fri, 6 Apr 2007, womble wrote:

>
> Hi I cant get php scripts from Apache to execute GNUPG comands.
>
> If I run cmds or execute php scripts from the cmd line that works fine.
>

>
> nobody:x:99:99:Nobody:/home/nobody:/bin/bash
>

_______________________________________________
Gnupg-users mailing list
Gnupg-users@...
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Re: Using GNUPG with php scripts and webserver

by womble :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks I have this in the error log

gpg: fatal: can't create directory `//.gnupg': Permission denied
secmem usage: 0/0 bytes in 0/0 blocks of pool 0/32768
gpg: fatal: can't create directory `//.gnupg': Permission denied
secmem usage: 0/0 bytes in 0/0 blocks of pool 0/32768


----- Original Message -----
From: "Stef Caunter" <stef@...>
To: "womble" <chris@...>
Cc: <gnupg-users@...>
Sent: Saturday, April 07, 2007 3:53 AM
Subject: Re: Using GNUPG with php scripts and webserver


> Check error_log for the problem (if you can) - permissions on ~/.gnupg
> files will cause things to not work and you must have environment exported
> for the nobody user. I reset $ENV{'HOME'} in perl... there must be
> something similar in php. If you can view the environment the server
> provides in the browser you can see if you have what gpg requires. I
> assume the binary is in $PATH for the webserver. Keys must be readable and
> implicitly trusted for the webserver user and this user must have
> somewhere to write if you are using temporary files.
>
> Stef
> http://caunter.ca/crypto.html
>
> On Fri, 6 Apr 2007, womble wrote:
>
>>
>> Hi I cant get php scripts from Apache to execute GNUPG comands.
>>
>> If I run cmds or execute php scripts from the cmd line that works fine.
>>
>
>>
>> nobody:x:99:99:Nobody:/home/nobody:/bin/bash
>>
>
>


_______________________________________________
Gnupg-users mailing list
Gnupg-users@...
http://lists.gnupg.org/mailman/listinfo/gnupg-users