mirror of https://github.com/MISP/MISP
Merge pull request #1969 from devnull-/GPG_sign_option
Add a option to sign GPG emailspull/2883/head
commit
173496c305
|
@ -44,7 +44,8 @@ $config = array(
|
|||
'email' => '',
|
||||
'homedir' => '',
|
||||
'password' => '',
|
||||
'bodyonlyencrypted' => false,
|
||||
'bodyonlyencrypted' => false,
|
||||
'sign' => true,
|
||||
),
|
||||
'SMIME' =>
|
||||
array(
|
||||
|
|
|
@ -835,7 +835,15 @@ class Server extends AppModel {
|
|||
'errorMessage' => '',
|
||||
'test' => 'testBool',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
),
|
||||
'sign' => array(
|
||||
'level' => 2,
|
||||
'description' => 'Enable the signing of GPG emails. By default, GPG emails are signed',
|
||||
'value' => 'true',
|
||||
'errorMessage' => '',
|
||||
'test' => 'testBool',
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'email' => array(
|
||||
'level' => 0,
|
||||
'description' => 'The e-mail address that the instance\'s PGP key is tied to.',
|
||||
|
|
|
@ -724,8 +724,10 @@ class User extends AppModel {
|
|||
require_once 'Crypt/GPG.php';
|
||||
try {
|
||||
$gpg = new Crypt_GPG(array('homedir' => Configure::read('GnuPG.homedir'), 'binary' => (Configure::read('GnuPG.binary') ? Configure::read('GnuPG.binary') : '/usr/bin/gpg'), 'debug')); // , 'debug' => true
|
||||
$gpg->addSignKey(Configure::read('GnuPG.email'), Configure::read('GnuPG.password'));
|
||||
$body = $gpg->sign($body, Crypt_GPG::SIGN_MODE_CLEAR);
|
||||
if (Configure::read('GnuPG.sign')) {
|
||||
$gpg->addSignKey(Configure::read('GnuPG.email'), Configure::read('GnuPG.password'));
|
||||
$body = $gpg->sign($body, Crypt_GPG::SIGN_MODE_CLEAR);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$failureReason = " the message could not be signed. The following error message was returned by gpg: " . $e->getMessage();
|
||||
$this->log($e->getMessage());
|
||||
|
|
Loading…
Reference in New Issue