Marius Cramer
2014-08-11 3f6ee66f65e910f741425078921bc804f91f8246
Merge branch 'master' into 'master'

Master

See merge request !115
3 files modified
26 ■■■■ changed files
docs/Remote_API_docs.txt 2 ●●● patch | view | raw | blame | history
interface/web/mail/mail_domain_dkim_create.php 6 ●●●● patch | view | raw | blame | history
server/plugins-available/mail_plugin_dkim.inc.php 18 ●●●● patch | view | raw | blame | history
docs/Remote_API_docs.txt
@@ -1,3 +1,3 @@
The remote API documentation is in the remote_client/API-docs subfolder.
The remote API documentation is in the remoting_client/API-docs subfolder.
interface/web/mail/mail_domain_dkim_create.php
@@ -80,7 +80,7 @@
    require_once('../../lib/classes/validate_dkim.inc.php');
    $validate_dkim=new validate_dkim ();
    if($validate_dkim->validate_post('private',$private_key)) { /* validate the $_POST-value */
        exec('echo '.escapeshellarg($private_key).'|openssl rsa -pubout -outform PEM',$pubkey,$result);
        exec('echo '.escapeshellarg($private_key).'|openssl rsa -pubout -outform PEM 2> /dev/null',$pubkey,$result);
        $public_key=pub_key($pubkey);
    } else {
        $public_key='invalid key';
@@ -92,8 +92,8 @@
switch ($_POST['action']) {
    case 'create': /* create DKIM Private-key */
        exec('openssl rand -out /usr/local/ispconfig/server/temp/random-data.bin 4096', $output, $result);
        exec('openssl genrsa -rand /usr/local/ispconfig/server/temp/random-data.bin 1024', $privkey, $result);
        exec('openssl rand -out /usr/local/ispconfig/server/temp/random-data.bin 4096 2> /dev/null', $output, $result);
        exec('openssl genrsa -rand /usr/local/ispconfig/server/temp/random-data.bin 1024 2> /dev/null', $privkey, $result);
        unlink("/usr/local/ispconfig/server/temp/random-data.bin");
        foreach($privkey as $values) $private_key=$private_key.$values."\n";
    break;
server/plugins-available/mail_plugin_dkim.inc.php
@@ -123,7 +123,21 @@
            if (!is_dir($mail_config['dkim_path'])) {
                $app->log('DKIM Path '.$mail_config['dkim_path'].' not found - (re)created.', LOGLEVEL_DEBUG);
                mkdir($mail_config['dkim_path'], 0750, true);
                if($app->system->is_user('amavis')) {
                    $amavis_user='amavis';
                } elseif ($app->system->is_user('vscan')) {
                    $amavis_user='vscan';
                }
                else {
                    $amavis_user='';
                }
                if(!empty($amavis_user)) {
                    mkdir($mail_config['dkim_path'], 0750, true);
                    exec('chown '.$amavis_user.' /var/lib/amavis/dkim');
                    unset($amavis_user);
                } else {
                    mkdir($mail_config['dkim_path'], 0755, true);
                }
            }
            if (!is_writeable($mail_config['dkim_path'])) {
@@ -173,7 +187,7 @@
            $app->log('Saved DKIM Private-key to '.$key_file.'.private', LOGLEVEL_DEBUG);
            $success=true;
            /* now we get the DKIM Public-key */
            exec('cat '.escapeshellarg($key_file.'.private').'|openssl rsa -pubout', $pubkey, $result);
            exec('cat '.escapeshellarg($key_file.'.private').'|openssl rsa -pubout 2> /dev/null', $pubkey, $result);
            $public_key='';
            foreach($pubkey as $values) $public_key=$public_key.$values."\n";
            /* save the DKIM Public-key in dkim-dir */