| | |
| | | @copyrighth Florian Schaal, info@schaal-24.de |
| | | */ |
| | | |
| | | |
| | | class mail_plugin_dkim { |
| | | |
| | | var $plugin_name = 'mail_plugin_dkim'; |
| | |
| | | |
| | | // private variables |
| | | var $action = ''; |
| | | |
| | | |
| | | /** |
| | | * This function is called during ispconfig installation to determine |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This function is called when the plugin is loaded |
| | | */ |
| | |
| | | $app->plugins->registerEvent('mail_domain_insert',$this->plugin_name,'domain_dkim_insert'); |
| | | $app->plugins->registerEvent('mail_domain_update',$this->plugin_name,'domain_dkim_update'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This function gets the amavisd-config file |
| | |
| | | } |
| | | return $amavis_configfile; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This function checks the relevant configs and disables dkim for the domain |
| | |
| | | return $check; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * This function restarts amavis |
| | | */ |
| | |
| | | exec(escapeshellarg($conf['init_scripts']).escapeshellarg('/amavis').' restart',$output); |
| | | foreach($output as $logline) $app->log($logline,LOGLEVEL_DEBUG); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This function writes the keyfiles (public and private) |
| | |
| | | return $success; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This function removes the keyfiles |
| | | * @param string $key_file full path to the key-file |
| | |
| | | } else $app->log('Unable to delete the DKIM Public-key for '.$key_domain.' (not found).',LOGLEVEL_DEBUG); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This function adds the entry to the amavisd-config |
| | | * @param string $key_domain mail-domain |
| | |
| | | $this->restart_amavis(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This function removes the entry from the amavisd-config |
| | |
| | | } else $app->log('Unable to delete the DKIM settings from amavis-config for '.$key_domain.'.',LOGLEVEL_ERROR); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This function controlls new key-files and amavisd-entries |
| | | * @param array $data mail-settings |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This function controlls the removement of keyfiles (public and private) |
| | | * and the entry in the amavisd-config |
| | |
| | | $this->remove_from_amavis($_data['domain']); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Function called by onLoad |
| | | * deletes dkim-keys |
| | |
| | | function domain_dkim_delete($event_name,$data) { |
| | | if (isset($data['old']['dkim']) && $data['old']['dkim'] == 'y') $this->remove_dkim($data['old']); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Function called by onLoad |
| | |
| | | $this->add_dkim($data); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Function called by onLoad |
| | |
| | | if (isset($data['new']['dkim']) && $data['old']['dkim'] != $data['new']['dkim']) |
| | | if ($this->check_system($data) && $data['new']['dkim'] == 'n') $this->remove_dkim($data['new']); |
| | | } |
| | | |
| | | } |
| | | |
| | | ?> |