prelude-correlator/master: Make it possible to disable plugin

[email protected] Thu, 18 Jun 2009 15:33:17 +0200 (CEST)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit abb33fa2dcbbd4163dccd1f7bf74d34a9db0c387
Author: Yoann Vandoorselaere <[email protected]>
Date:   Thu Jun 18 15:31:36 2009 +0200

    Make it possible to disable plugin
    
    It is now possible to add the following setting in prelude-correlator.conf:
    [PluginClassName]
    disable = true
    
    This fixes #354.


========================================

 PreludeCorrelator/pluginmanager.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

========================================

diff --git a/PreludeCorrelator/pluginmanager.py b/PreludeCorrelator/pluginmanager.py
index 4bd24eb..1582f29 100644
--- a/PreludeCorrelator/pluginmanager.py
+++ b/PreludeCorrelator/pluginmanager.py
@@ -47,6 +47,16 @@ class Plugin(object):
 
 
 class PluginManager:
+    def _parseBoolean(self, b):
+        if type(b) is bool:
+                return b
+
+        b = b.strip().lower()
+        if b == "true" or b == "yes":
+                return True
+
+        return False
+
     def __init__(self, env):
         self._count = 0
         self.__instances = []
@@ -60,6 +70,10 @@ class PluginManager:
                 env.logger.warning("Exception occurred while loading %s: %s" % (plugin_class.__name__, e))
                 continue
 
+            if self._parseBoolean(pi.getConfigValue("disable", False)) is True:
+                env.logger.info("%s disabled on user request" % (plugin_class.__name__))
+                continue
+
             self.__instances.append(pi)
             self._count += 1
 
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog