Open Spitfireap opened 3 years ago
Okay here is why I don't have any key generated : `[gpgmailer] Warning: gpg --batch --gen-key foo: Array ( [0] => gpg: Warning: using insecure memory! [1] => gpg: foo:4: missing argument )
This took 0seconds.`
Seems to be due to Name-Comment.
By deleting it I get a new error (yess) key generation failed: Unknown elliptic curve
. After looking at here https://askubuntu.com/questions/861978/unattended-gnupg-key-generation-for-ecc/861985 I've just added Key-Curve: nistp256
and Subkey-Curve: nistp256
in foo.
And then key generation seems to work :
`[gpgmailer] Warning: gpg --batch --gen-key foo:
Array
(
[0] => gpg: Warning: using insecure memory!
[1] => gpg: key 91AB6DB08A49BFDF marked as ultimately trusted
[2] => gpg: revocation certificate stored as '/mnt/data/.gnupg/openpgp-revocs.d/C7FFDEA2B732DD6E4E6C1B0891AB6DB08A49BFDF.rev'
)
This took 0seconds.
POST /index.php/settings/apps/enable`
but again :
`[PHP] Error: Error: Invalid argument supplied for foreach() at /usr/local/www/nextcloud/apps/gpgmailer/lib/Service/Gpg.php#320 at <
POST /index.php/settings/apps/enable'
and [gpgmailer] Warning: No server GPG key found so no signed emails are possible
.
It seems that every foreach and sizeof raises an error...
Something is going wrong while gpg->keyinfo eg. in https://github.com/tacruc/gpgmailer/blob/7c3cbaea2d8722b84be9969478d4a6bc1893e7ef/lib/Service/Gpg.php#L230
You could use echo $gpg -> geterror();
afterwards to get the error message of php_gnupg.
The foreach fails because keyinfo returns for some reason false.
Okay, well only thing the geterror() returns is [gpgmailer]
Warning: could not init keylist`
And here is a more in-depth view of the debug of keyinfo(). I tried to activate the debug on nextcloud but I get so many RuntimeException that log for the PHP app is not saved... Tell me if you need these 9 more entries and I'll try to see if I can get them.
[PHP] Error: Error: gnupg::keyinfo(): could not init keylist at /usr/local/www/nextcloud/apps/gpgmailer/lib/Service/Gpg.php#329 at <
POST /index.php/settings/apps/enable
Could you try to get this small example running? It seems to be some problem with gnupg.
<?php
// make sure that this folder is NOT accesible as an URL
error_reporting(E_ALL);
$res = gnupg_init();
gnupg_seterrormode($res,GNUPG_ERROR_WARNING);
$info = gnupg_keyinfo($res, '');
echo geterror($res);
Sadly I only get AH01071: Got error 'PHP message: PHP Warning: gnupg_keyinfo(): could not init keylist in /usr/local/www/apache24/data/test.php on line 9' no matter if I set the GNUPGHOME or not :(. It's on a fresh new jail on freebsd but it does the exact same on my nextcloud jail.
And no error output from the gnupg_geterror($res);
Could you check the permissions of the .gnupg folder?
On data/.gnupg and data/user/.gnupg I've got
drwx------ 2 www www 5 May 17 17:04 .gnupg
so 700 by default. Changing them to 777 doesn't change anything.
and apache/php is running as www, www-data, wwwrun or php-fpm?
http://php.adamharvey.name/manual/en/function.gnupg-init.php#121851
apache and php-fm run both under www user.
It's driving me crazy. I tried all day yesterday and still can't at least introduce a new bug :p. I even changed php version to 8.0 but didn't improve anything. Do you think I should open an issue at https://github.com/php-gnupg/php-gnupg ? Thanks for your help !
If the basic example of php-gnupg is not working. They might know whats going wrong. I'm sorry but I have no idea left right now.
Hey ! This app seems really great, unfortunately I can't find a way to make it works on NC21. I've installed gnupg and>
php -i | grep -i gnupg
do returns :/usr/local/etc/php/ext-20-gnupg.ini, gnupg gnupg support => enabled
Unfortunately upon clicking on "Download server Key" I get redirected to mycloud.com/index.php/apps/gpgmailer/key/download/server but I get a file not found warning . And on the server there is no key folder under apps/gpgmailer/ GpgMailer do send a warning in the log[gpgmailer] Error: Creating server GPG key pair failed. Emails are not going to be signed, expect keys are server keys imported manually POST /index.php/settings/apps/enable from XX.XX.XX.XX by adrien at 2021-05-16T12:11:55+00:00
I also get two log entries : `[PHP] Error: Error: sizeof(): Parameter must be an array or an object that implements Countable at /usr/local/www/nextcloud/apps/gpgmailer/lib/Service/Gpg.php#231 at <GET /index.php/settings/user/security from XX.XX.XX.XX by adrien at 2021-05-16T09:45:25+00:00`
as well as `[PHP] Error: Error: Invalid argument supplied for foreach() at /usr/local/www/nextcloud/apps/gpgmailer/lib/Service/Gpg.php#232 at <>
GET /index.php/settings/user/security from XX.XX.XX.XX by adrien at 2021-05-16T09:45:25+00:00`
Also regarding importing my own public key, I try to copy it from thunderbird and pasting, but I get an "Error importing public key"...
`