Marius Cramer
2013-11-14 b1a6a5a3991cec5cd08873b01376e45d0b247f18
server/plugins-available/mail_plugin_dkim.inc.php
@@ -32,6 +32,7 @@
@copyrighth Florian Schaal, info@schaal-24.de
*/
class mail_plugin_dkim {
   var $plugin_name = 'mail_plugin_dkim';
@@ -39,6 +40,7 @@
   // private variables
   var $action = '';
   /** 
   * This function is called during ispconfig installation to determine
@@ -55,6 +57,7 @@
   }
   /**
   * This function is called when the plugin is loaded
   */
@@ -67,6 +70,7 @@
      $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
@@ -87,6 +91,7 @@
                }
      return $amavis_configfile;
   }
   /**
   * This function checks the relevant configs and disables dkim for the domain 
@@ -117,6 +122,10 @@
      return $check;
   }
        
   /**
   * This function restarts amavis
   */
@@ -127,6 +136,7 @@
      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)
@@ -153,6 +163,7 @@
      return $success;
   }
   /**
   * This function removes the keyfiles
   * @param string $key_file full path to the key-file
@@ -170,6 +181,7 @@
      } 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
@@ -184,6 +196,7 @@
         $this->restart_amavis();
      }
   }
   /**
   * This function removes the entry from the amavisd-config
@@ -207,6 +220,7 @@
      } 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
@@ -228,6 +242,7 @@
      }
   }
   /**
   * This function controlls the removement of keyfiles (public and private)
   * and the entry in the amavisd-config
@@ -242,6 +257,7 @@
                  $this->remove_from_amavis($_data['domain']);
   }
   /**
   * Function called by onLoad
   * deletes dkim-keys
@@ -249,6 +265,7 @@
   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
@@ -259,6 +276,7 @@
         $this->add_dkim($data);
      }
   }
   /**
   * Function called by onLoad
@@ -292,5 +310,7 @@
      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']);
   }
}
?>