Searchable Archives

Howard Lowndes lannet at lannet.com.au
Fri Jan 2 12:44:07 CET 2004


Are their any searchable archives for this list?

Can anyone advise on using GPG in a PHP script under Apache?

I keep getting the following error in /var/log/httpd/error_log:

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

even though Apache is not running as root and /usr/bin/gpg is not setuid

The PHP script element is:

function gpg_encrypt($keyring_location, $public_key_id, $plain_text) {
       $key_id = EscapeShellArg($public_key_id);
       putenv("PGPPATH=$keyring_location");
       $cmd="gpg --options /var/www/.gnupg/options --keyring $keyring_location --armor --encrypt --recipient $public_key_id";
       $pipe = popen($cmd, "r");
       fwrite($pipe, $plain_text);
       $encrypted_text = '';
       while($s = fgets($pipe, 1024)) {
               // read from the pipe
               $encrypted_text .= $s;
       }
       pclose($pipe);
       return $encrypted_text;
}


$cmd expands to:

gpg --options /var/www/.gnupg/options --keyring /var/www/.gnupg/pubring.gpg --armor --encrypt --recipient mechu

/var/www/.gnupg and its files are rw to apache

-- 
Howard.
LANNet Computing Associates - Your Linux people <http://www.lannetlinux.com>
------------------------------------------
Flatter government, not fatter government - Get rid of the Australian states.
------------------------------------------
To mess up a Linux box, you need to work at it; to mess up your Windows 
box, you just need to work on it. - Scott Granneman, SecurityFocus





More information about the Gnupg-users mailing list