Ejemplo n.º 1
0
Archivo: config.py Proyecto: inkhey/mmc
    def readConf(self):
        """
        Read web section of the imaging plugin configuration file
        """
        PluginConfig.readConf(self)
        if not self.disabled:
            ImagingDatabaseConfig.setup(self, self.conffile)
            if self.has_section("web"):
                for option in self.options("web"):
                    # option variable is lowercase
                    setattr(self, option, self.get("web", option))

        setattr(self, "network", "resolv_order")
        if not type(self.resolv_order) == type([]):
            self.resolv_order = self.resolv_order.split(' ')

        if self.has_option("network", "preferred_network"):
            self.preferred_network = self.get("network", "preferred_network")
        else :
            self.preferred_network = ''

        try:
            self.purge_interval = self.get('main', 'purge_interval')
        except (NoOptionError, NoSectionError):
            self.purge_interval = '23 0 * * 0'
Ejemplo n.º 2
0
 def readConf(self):
     logger = logging.getLogger()
     PluginConfig.readConf(self)
     try: self.vDomainSupport = self.getboolean("main", "vDomainSupport")
     except: pass
     if self.vDomainSupport:
         self.vDomainDN = self.get("main", "vDomainDN")
     try: self.vAliasesSupport = self.getboolean("main", "vAliasesSupport")
     except: pass
     if self.vAliasesSupport:
         self.vAliasesDN = self.get("main", "vAliasesDN")
     try:
         self.zarafa = self.getboolean("main", "zarafa")
     except NoOptionError:
         pass
     try:
         self.attrs = dict(self.items("mapping"))
     except NoSectionError:
         self.attrs = {}
     attrs = ["mailalias", "maildrop", "mailenable", "mailbox", "mailuserquota", "mailhost"]
     # validate attribute mapping
     for attr, val in self.attrs.copy().items():
         if not attr in attrs:
             del self.attrs[attr]
             logger.error("Can't map attribute %s. Attribute not supported." % attr)
     # add all other attributes
     for attr in attrs:
         if not attr in self.attrs:
             self.attrs[attr] = attr
Ejemplo n.º 3
0
    def readConf(self):
        """
        Read web section of the imaging plugin configuration file
        """
        PluginConfig.readConf(self)
        if not self.disabled:
            ImagingDatabaseConfig.setup(self, self.conffile)
            if self.has_section("web"):
                for option in self.options("web"):
                    # option variable is lowercase
                    setattr(self, option, self.get("web", option))

        setattr(self, "network", "resolv_order")
        if not type(self.resolv_order) == type([]):
            self.resolv_order = self.resolv_order.split(' ')

        if self.has_option("network", "preferred_network"):
            self.preferred_network = self.get("network", "preferred_network")
        else:
            self.preferred_network = ''

        try:
            self.purge_interval = self.get('main', 'purge_interval')
        except (NoOptionError, NoSectionError):
            self.purge_interval = '23 0 * * 0'
Ejemplo n.º 4
0
 def readConf(self):
     PluginConfig.readConf(self)
     DatabaseConfig.setup(self, self.conffile)
     #update_command
     try:
         self.update_commands_cron = self.get(
             'main', 'update_commands_cron')
     except (NoOptionError, NoSectionError):
         self.update_commands_cron = '10 12 * * *'
     try:
         self.enable_update_commands = int(
             self.get('main', 'enable_update_commands'))
     except:
         self.enable_update_commands = 1
     #add_update_description
     try:
         self.add_update_description_cron = self.get(
             'main', 'add_update_description_cron')
     except (NoOptionError, NoSectionError):
         self.add_update_description_cron = '0 */1 * * *'
     try:
         self.enable_update_description = int(
             self.get('main', 'enable_update_description'))
     except:
         self.enable_update_description = 1
Ejemplo n.º 5
0
    def readConf(self):
        PluginConfig.readConf(self)

        try:
            self.samba_prefix = self.get("main", "sambaPrefix")
        except NoOptionError:
            pass

        try:
            self.conf_file = self.get("main", "sambaConfFile")
        except NoOptionError:
            pass

        try:
            self.db_dir = self.get("main", "sambaDBDir")
        except NoOptionError:
            pass

        self.defaultSharesPath = self.get("main", "defaultSharesPath")

        try:
            listSharePaths = self.get("main", "authorizedSharePaths")
            self.authorizedSharePaths = listSharePaths.replace(' ',
                                                               '').split(',')
        except NoOptionError:
            self.authorizedSharePaths = [self.defaultSharesPath]
Ejemplo n.º 6
0
 def setDefault(self):
     PluginConfig.setDefault(self)
     self.authmethod = "baseldap"
     self.provmethod = None
     self.computersmethod = "none"
     self.passwordscheme = "ssha"
     self.auditmethod = "none"
Ejemplo n.º 7
0
    def readConf(self):
        PluginConfig.readConf(self)

        try:
            self.samba_prefix = self.get("main", "sambaPrefix")
        except NoOptionError:
            pass

        try:
            self.conf_file = self.get("main", "sambaConfFile")
        except NoOptionError:
            pass

        try:
            self.db_dir = self.get("main", "sambaDBDir")
        except NoOptionError:
            pass

        self.defaultSharesPath = self.get("main", "defaultSharesPath")

        try:
            listSharePaths = self.get("main", "authorizedSharePaths")
            self.authorizedSharePaths = listSharePaths.replace(' ',
                                                               '').split(',')
        except NoOptionError:
            self.authorizedSharePaths = [self.defaultSharesPath]
Ejemplo n.º 8
0
 def readConf(self):
     PluginConfig.readConf(self)
     DatabaseConfig.setup(self, self.conffile)
     #update_command
     try:
         self.update_commands_cron = self.get('main',
                                              'update_commands_cron')
     except (NoOptionError, NoSectionError):
         self.update_commands_cron = '10 12 * * *'
     try:
         self.enable_update_commands = int(
             self.get('main', 'enable_update_commands'))
     except:
         self.enable_update_commands = 1
     #add_update_description
     try:
         self.add_update_description_cron = self.get(
             'main', 'add_update_description_cron')
     except (NoOptionError, NoSectionError):
         self.add_update_description_cron = '0 */1 * * *'
     try:
         self.enable_update_description = int(
             self.get('main', 'enable_update_description'))
     except:
         self.enable_update_description = 1
Ejemplo n.º 9
0
    def readConf(self):
        PluginConfig.readConf(self)
        self.baseComputersDN = self.get("main", "baseComputersDN")
        # Handle deprecated config option and correct the NoOptionError exception to the new option
        try:
            if self.has_option("main", "defaultSharesPath"):
                self.defaultSharesPath = self.get("main", "defaultSharesPath")
            else:
                self.defaultSharesPath = self.get("main", "sharespath")
        except ConfigParser.NoOptionError:
            raise ConfigParser.NoOptionError("defaultSharesPath", "main")

        try:
            self.samba_conf_file = self.get("main", "sambaConfFile")
        except:
            pass
        try:
            self.samba_init_script = self.get("main", "sambaInitScript")
        except:
            pass
        try:
            self.av_so = self.get("main", "sambaAvSo")
        except:
            pass

        try:
            listSharePaths = self.get("main", "authorizedSharePaths")
            self.authorizedSharePaths = listSharePaths.replace(' ',
                                                               '').split(',')
        except:
            self.authorizedSharePaths = [self.defaultSharesPath]
Ejemplo n.º 10
0
 def readConf(self):
     logger = logging.getLogger()
     PluginConfig.readConf(self)
     try: self.vDomainSupport = self.getboolean("main", "vDomainSupport")
     except: pass
     if self.vDomainSupport:
         self.vDomainDN = self.get("main", "vDomainDN")
     try: self.vAliasesSupport = self.getboolean("main", "vAliasesSupport")
     except: pass
     if self.vAliasesSupport:
         self.vAliasesDN = self.get("main", "vAliasesDN")
     try:
         self.zarafa = self.getboolean("main", "zarafa")
     except NoOptionError:
         pass
     try:
         self.attrs = dict(self.items("mapping"))
     except NoSectionError:
         self.attrs = {}
     attrs = ["mailalias", "maildrop", "mailenable", "mailbox", "mailuserquota", "mailhost", "mailproxy"]
     # validate attribute mapping
     for attr, val in self.attrs.copy().items():
         if not attr in attrs:
             del self.attrs[attr]
             logger.error("Can't map attribute %s. Attribute not supported." % attr)
     # add all other attributes
     for attr in attrs:
         if not attr in self.attrs:
             self.attrs[attr] = attr
Ejemplo n.º 11
0
 def setDefault(self):
     PluginConfig.setDefault(self)
     self.squidReload = "/etc/init.d/squid reload"
     self.squidUser = "******"
     self.squidGroup = "proxy"
     self.sgBinary = "/usr/bin/squidGuard"
     self.sgBlacklist = "/var/lib/squidguard/db/bad.destdomainlist"
Ejemplo n.º 12
0
 def setDefault(self):
     PluginConfig.setDefault(self)
     self.authmethod = "baseldap"
     self.provmethod = None
     self.computersmethod = "none"
     self.passwordscheme = "ssha"
     self.auditmethod = "none"
Ejemplo n.º 13
0
 def setDefault(self):
     PluginConfig.setDefault(self)
     self.squidReload = "/etc/init.d/squid reload"
     self.squidUser = "******"
     self.squidGroup = "proxy"
     self.sgBinary = "/usr/bin/squidGuard"
     self.sgBlacklist = "/var/lib/squidguard/db/bad.destdomainlist"
Ejemplo n.º 14
0
 def setDefault(self):
     """
     Set default values
     """
     PluginConfig.setDefault(self)
     self.dbsslenable = False
     self.dbpoolrecycle = 60
     self.dbpoolsize = 5
Ejemplo n.º 15
0
 def __init__(self, name="samba4"):
     # Default values
     self.samba_prefix = "/usr"
     self.conf_file = "/etc/samba/smb.conf"
     self.db_dir = "/var/lib/samba"
     self.defaultSharesPath = "/home/samba"
     self.authorizedSharePaths = [self.defaultSharesPath]
     PluginConfig.__init__(self, name)
Ejemplo n.º 16
0
 def readConf(self):
     """
     Read the configuration file using the ConfigParser API.
     The PluginConfig.readConf reads the "disable" option of the
     "main" section.
     """
     PluginConfig.readConf(self)
     self.disable = self.getboolean("main", "disable")
Ejemplo n.º 17
0
 def setDefault(self):
     """
     Set default values
     """
     PluginConfig.setDefault(self)
     self.dbsslenable = False
     self.dbpoolrecycle = 60
     self.dbpoolsize = 5
Ejemplo n.º 18
0
 def setDefault(self):
     """
     Set good default for the module if a parameter is missing the
     configuration file.
     This function is called in the class constructor, so what you
     set here will be overwritten by the readConf method.
     """
     PluginConfig.setDefault(self)
Ejemplo n.º 19
0
 def setDefault(self):
     """
     Set good default for the module if a parameter is missing the
     configuration file.
     This function is called in the class constructor, so what you
     set here will be overwritten by the readConf method.
     """
     PluginConfig.setDefault(self)
Ejemplo n.º 20
0
 def __init__(self, name="samba4"):
     # Default values
     self.samba_prefix = "/usr"
     self.conf_file = "/etc/samba/smb.conf"
     self.db_dir = "/var/lib/samba"
     self.defaultSharesPath = "/home/samba"
     self.authorizedSharePaths = [self.defaultSharesPath]
     PluginConfig.__init__(self, name)
Ejemplo n.º 21
0
    def readConf(self):
        """
        Read the module configuration
        """
        PluginConfig.readConf(self)

        # API Package
        if self.has_option("user_package_api", "server"):
            self.upaa_server = self.get("user_package_api", "server")
        if self.has_option("user_package_api", "port"):
            self.upaa_port = self.get("user_package_api", "port")
        if self.has_option("user_package_api", "mountpoint"):
            self.upaa_mountpoint = self.get("user_package_api", "mountpoint")

        if self.has_option("user_package_api", "username"):
            if not isTwistedEnoughForLoginPass():
                logging.getLogger().warning(
                    "your version of twisted is not high enough to use login (user_package_api/username)"
                )
                self.upaa_username = ""
            else:
                self.upaa_username = self.get("user_package_api", "username")
        if self.has_option("user_package_api", "password"):
            if not isTwistedEnoughForLoginPass():
                logging.getLogger().warning(
                    "your version of twisted is not high enough to use password (user_package_api/password)"
                )
                self.upaa_password = ""
            else:
                self.upaa_password = self.get("user_package_api", "password")
        if self.has_option("user_package_api", "tmp_dir"):
            self.tmp_dir = self.get("user_package_api", "tmp_dir")
        if self.has_option("user_package_api", "enablessl"):
            self.upaa_enablessl = self.getboolean("user_package_api",
                                                  "enablessl")

        if self.upaa_enablessl:
            if self.has_option("user_package_api", "verifypeer"):
                self.upaa_verifypeer = self.getboolean("user_package_api",
                                                       "verifypeer")
            if self.upaa_verifypeer:  # we need twisted.internet.ssl.Certificate to activate certs
                if self.has_option("user_package_api", "cacert"):
                    self.upaa_cacert = self.get("user_package_api", "cacert")
                if self.has_option("user_package_api", "localcert"):
                    self.upaa_localcert = self.get("user_package_api",
                                                   "localcert")
                if not os.path.isfile(self.upaa_localcert):
                    raise Exception('can\'t read SSL key "%s"' %
                                    (self.upaa_localcert))
                if not os.path.isfile(self.upaa_cacert):
                    raise Exception('can\'t read SSL certificate "%s"' %
                                    (self.upaa_cacert))
                import twisted.internet.ssl
                if not hasattr(twisted.internet.ssl, "Certificate"):
                    raise Exception(
                        'I need at least Python Twisted 2.5 to handle peer checking'
                    )
Ejemplo n.º 22
0
    def readConf(self):
        PluginConfig.readConf(self)

        self.pid_path = self.safe_get("main",
                                       "pid_path",
                                       self.pid_path)
        self.ssh_path = self.safe_get("main",
                                       "ssh_path",
                                       self.ssh_path)
        self.support_url = self.safe_get("main",
                                         "support_url",
                                          self.support_url)
        self.support_user = self.safe_get("main",
                                          "support_user",
                                           self.support_user)
        self.identify_file = self.safe_get("main",
                                           "identify_file",
                                           self.identify_file)

        if not os.path.exists(self.identify_file):
            logging.getLogger().warn("File %s don't exists!" % self.identify_file)

        self.url = "%s@%s" % (self.support_user, self.support_url)

        self.check_pid_delay = int(self.safe_get("main",
                                                 "check_pid_delay",
                                                  self.check_pid_delay))
        self.session_timeout = int(self.safe_get("main",
                                                 "session_timeout",
                                                  self.session_timeout))

        if not os.path.exists(self.install_id_path):
            logging.getLogger().warn("File %s don't exists!" % self.install_id_path)
        else:
            with open(self.install_id_path, "r") as f:
                content = f.readlines()
                if len(content) > 0:
                    self.install_uuid = content[0].strip()


        self.license_server_url = self.safe_get("main",
                                                "license_server_url",
                                                self.license_server_url)

        self.cron_search_for_updates = self.safe_get("main",
                                                     "cron_search_for_updates",
                                                     self.cron_search_for_updates)
        self._cron_randomize()

        self.license_tmp_file = self.safe_get("main",
                                              "license_tmp_file",
                                              self.license_tmp_file)

        self.country = self.safe_get("main",
                                     "country",
                                      self.country)
Ejemplo n.º 23
0
    def readConf(self):
        """
        Read the module configuration
        """
        PluginConfig.readConf(self)
        self.disable = self.getboolean("main", "disable")
        Pulse2DatabaseConfig.setup(self, self.conffile)

        if self.has_option("main", "location"):
            self.location = self.get("main", "location")
Ejemplo n.º 24
0
    def readConf(self):
        """
        Read the module configuration
        """
        PluginConfig.readConf(self)
        self.disable = self.getboolean("main", "disable")
        Pulse2DatabaseConfig.setup(self, self.conffile)

        if self.has_option("main", "location"):
            self.location = self.get("main", "location")
Ejemplo n.º 25
0
 def readConf(self):
     """
     Read the configuration file using the ConfigParser API.
     The PluginConfig.readConf reads the "disable" option of the
     "main" section.
     """
     PluginConfig.readConf(self)
     BackuppcDatabaseConfig.setup(self, self.conffile)
     self.disable = self.getboolean("main", "disable")
     self.tempdir = self.get("main", "tempdir")
Ejemplo n.º 26
0
 def readConf(self):
     """
     Read the configuration file using the ConfigParser API.
     The PluginConfig.readConf reads the "disable" option of the
     "main" section.
     """
     PluginConfig.readConf(self)
     BackuppcDatabaseConfig.setup(self, self.conffile)
     self.disable = self.getboolean("main", "disable")
     self.tempdir = self.get("main", "tempdir")
Ejemplo n.º 27
0
 def readConf(self):
     PluginConfig.readConf(self)
     self.journalctl_path = self.get('main', 'journalctl_path')
     self.services = {}
     for plugin, services in self.items('plugins'):
         self.services[plugin] = services.split(",")
     try:
         self.blacklist = self.get('main', 'blacklist').split(',')
     except:
         self.blacklist = []
Ejemplo n.º 28
0
 def readConf(self):
     PluginConfig.readConf(self)
     self.journalctl_path = self.get('main', 'journalctl_path')
     self.services = {}
     for plugin, services in self.items('plugins'):
         self.services[plugin] = services.split(",")
     try:
         self.blacklist = self.get('main', 'blacklist').split(',')
     except:
         self.blacklist = []
Ejemplo n.º 29
0
 def readConf(self):
     """
     Read web section of the imaging plugin configuration file
     """
     PluginConfig.readConf(self)
     if not self.disabled:
         ImagingDatabaseConfig.setup(self, self.conffile)
         if self.has_section("web"):
             for option in self.options("web"):
                 # option variable is lowercase
                 setattr(self, option, self.get("web", option))
Ejemplo n.º 30
0
 def setDefault(self):
     """
     Set default for the module if a parameter is missing from the
     configuration file.
     This function is called in the class constructor, so what you
     set here will be overwritten by the readConf method.
     """
     PluginConfig.setDefault(self)
     self.showinfomaster = False
     self.showplugins = False
     self.debugmode = "NOTSET"
     self.ordreallagent = False
Ejemplo n.º 31
0
 def readConf(self):
     PluginConfig.readConf(self)
     try: self.sgBinary = self.get("squidguard", "path")
     except (NoSectionError, NoOptionError): pass
     try: self.sgBlacklist = self.get("squidguard", "blacklist")
     except (NoSectionError, NoOptionError): pass
     try: self.squidReload = self.get("squidguard", "scriptReload")
     except (NoSectionError, NoOptionError): pass
     try: self.squidUser = self.get("squidguard", "user")
     except (NoSectionError, NoOptionError): pass
     try: self.squidGroup = self.get("squidguard", "group")
     except (NoSectionError, NoOptionError): pass
Ejemplo n.º 32
0
 def readConf(self):
     PluginConfig.readConf(self)
     try: self.sgBinary = self.get("squidguard", "path")
     except (NoSectionError, NoOptionError): pass
     try: self.sgBlacklist = self.get("squidguard", "blacklist")
     except (NoSectionError, NoOptionError): pass
     try: self.squidReload = self.get("squidguard", "scriptReload")
     except (NoSectionError, NoOptionError): pass
     try: self.squidUser = self.get("squidguard", "user")
     except (NoSectionError, NoOptionError): pass
     try: self.squidGroup = self.get("squidguard", "group")
     except (NoSectionError, NoOptionError): pass
Ejemplo n.º 33
0
 def readConf(self):
     PluginConfig.readConf(self)
     try: self.diskquotaenable = self.getboolean("diskquota", "enable")
     except: pass
     try: self.networkquotaenable = self.getboolean("networkquota", "enable")
     except: pass
     self.devicemap = self.get("diskquota", "devicemap").split(',')
     self.inodesperblock = self.getfloat("diskquota", "inodesperblock")
     self.softquotablocks = self.getfloat("diskquota", "softquotablocks")
     self.softquotainodes = self.getfloat("diskquota", "softquotainodes")
     self.setquotascript = self.get("diskquota", "setquotascript")
     self.delquotascript = self.get("diskquota", "delquotascript")
     self.runquotascript = self.get("diskquota", "runquotascript")
     self.networkmap = self.get("networkquota", "networkmap").split(',')
Ejemplo n.º 34
0
    def readConf(self):
        PluginConfig.readConf(self)
        LDAPConnectionConfig.readLDAPConf(self, "ldap")
        AuditConfig.readAuditConf(self, "audit")
        # Selected authentication method
        try:
            self.authmethod = self.get("authentication", "method")
        except:
            pass
        # Selected provisioning method
        try:
            self.provmethod = self.get("provisioning", "method")
        except:
            pass
        # Selected computer management method
        try:
            self.computersmethod = self.get("computers", "method")
        except:
            pass
        # User password scheme
        try:
            self.passwordscheme = self.get("ldap", "passwordscheme")
        except:
            pass

        self.baseDN = self.getdn('ldap', 'baseDN')
        self.baseUsersDN = self.getdn('ldap', 'baseUsersDN')

        # Where LDAP computer objects are stored
        # For now we ignore if the option does not exist, because it breaks
        # all existing intallations
        try:
            self.baseComputersDN = self.get('ldap', 'baseComputersDN')
        except:
            pass
        self.backuptools = self.get("backup-tools", "path")
        self.backupdir = self.get("backup-tools", "destpath")
        self.username = self.getdn("ldap", "rootName")
        self.password = self.getpassword("ldap", "password")
        #########################################################

        self.leak_memorytime = 3600
        if self.has_option("memoryinfo", "time"):
            self.leak_memorytime = self.getint("memoryinfo", "time")
        self.fileoutresult = "/tmp/leak_memory.data"
        if self.has_option("memoryinfo", "outfile"):
            self.fileoutresult = self.get("memoryinfo", "outfile")
        self.leak_memory_disable = True
        if self.has_option("memoryinfo", "disable"):
            self.leak_memory_disable = self.getboolean("memoryinfo", "disable")
Ejemplo n.º 35
0
	def readConf(self):
		PluginConfig.readConf(self)
		try: self.host = self.get("ldap", "host")
		except (NoSectionError, NoOptionError): self.host = "127.0.0.1"
		try: self.root = self.get("ldap", "rootName")
		except (NoSectionError, NoOptionError): self.root = "uid=LDAP Admin, ou=System Accounts, dc=localdomain"

		self.passw = self.get("ldap", "password")

		try: self.userdn = self.get("ldap", "baseUsersDN")
		except (NoSectionError, NoOptionError): self.userdn = "ou=People, dc=localdomain"

		try: self.groupdn = self.get("ldap", "baseGroupsDN")
		except (NoSectionError, NoOptionError): self.groupdn = "ou=Group, dc=localdomain"
Ejemplo n.º 36
0
    def readConf(self):
        """
        Read the module configuration
        """
        PluginConfig.readConf(self)

        # API Package
        if self.has_option("user_package_api", "server"):
            self.upaa_server = self.get("user_package_api", "server")
        if self.has_option("user_package_api", "port"):
            self.upaa_port = self.get("user_package_api", "port")
        if self.has_option("user_package_api", "mountpoint"):
            self.upaa_mountpoint = self.get("user_package_api", "mountpoint")

        if self.has_option("user_package_api", "username"):
            if not isTwistedEnoughForLoginPass():
                logging.getLogger().warning("your version of twisted is not high enough to use login (user_package_api/username)")
                self.upaa_username = ""
            else:
                self.upaa_username = self.get("user_package_api", "username")
        if self.has_option("user_package_api", "password"):
            if not isTwistedEnoughForLoginPass():
                logging.getLogger().warning("your version of twisted is not high enough to use password (user_package_api/password)")
                self.upaa_password = ""
            else:
                self.upaa_password = self.get("user_package_api", "password")
        if self.has_option("user_package_api", "tmp_dir"):
            self.tmp_dir = self.get("user_package_api", "tmp_dir")
        if self.has_option("user_package_api", "enablessl"):
            self.upaa_enablessl = self.getboolean("user_package_api", "enablessl")

        if self.upaa_enablessl:
            if self.has_option("user_package_api", "verifypeer"):
                self.upaa_verifypeer = self.getboolean("user_package_api", "verifypeer")
            if self.upaa_verifypeer: # we need twisted.internet.ssl.Certificate to activate certs
                if self.has_option("user_package_api", "cacert"):
                    self.upaa_cacert = self.get("user_package_api", "cacert")
                if self.has_option("user_package_api", "localcert"):
                    self.upaa_localcert = self.get("user_package_api", "localcert")
                if not os.path.isfile(self.upaa_localcert):
                    raise Exception('can\'t read SSL key "%s"' % (self.upaa_localcert))
                if not os.path.isfile(self.upaa_cacert):
                    raise Exception('can\'t read SSL certificate "%s"' % (self.upaa_cacert))
                import twisted.internet.ssl
                if not hasattr(twisted.internet.ssl, "Certificate"):
                    raise Exception('I need at least Python Twisted 2.5 to handle peer checking')
        
        # Appstream settings
        if self.has_option("appstream", "url"):
            self.appstream_url = self.get("appstream", "url")
Ejemplo n.º 37
0
    def readConf(self):
        PluginConfig.readConf(self)

        self.pid_path = self.safe_get("main", "pid_path", self.pid_path)
        self.ssh_path = self.safe_get("main", "ssh_path", self.ssh_path)
        self.support_url = self.safe_get("main", "support_url",
                                         self.support_url)
        self.support_user = self.safe_get("main", "support_user",
                                          self.support_user)
        self.identify_file = self.safe_get("main", "identify_file",
                                           self.identify_file)

        if not os.path.exists(self.identify_file):
            logging.getLogger().warn("File %s don't exists!" %
                                     self.identify_file)

        self.url = "%s@%s" % (self.support_user, self.support_url)

        self.check_pid_delay = int(
            self.safe_get("main", "check_pid_delay", self.check_pid_delay))
        self.session_timeout = int(
            self.safe_get("main", "session_timeout", self.session_timeout))

        if not os.path.exists(self.install_id_path):
            logging.getLogger().warn("File %s don't exists!" %
                                     self.install_id_path)
        else:
            with open(self.install_id_path, "r") as f:
                content = f.readlines()
                if len(content) > 0:
                    self.install_uuid = content[0].strip()

        self.license_server_url = self.safe_get("main", "license_server_url",
                                                self.license_server_url)

        self.cron_search_for_updates = self.safe_get(
            "main", "cron_search_for_updates", self.cron_search_for_updates)
        self._cron_randomize()

        self.license_tmp_file = self.safe_get("main", "license_tmp_file",
                                              self.license_tmp_file)

        self.country = self.safe_get("main", "country", self.country)

        self.collector_script_path = self.safe_get("main",
                                                   "collector_script_path",
                                                   self.collector_script_path)
        self.collector_archive_path = self.safe_get(
            "main", "collector_archive_path", self.collector_archive_path)
Ejemplo n.º 38
0
 def readConf(self):
     PluginConfig.readConf(self)
     DatabaseConfig.setup(self, self.conffile)
     try:
         self.historization = self.get('data', 'historization')
     except (NoOptionError, NoSectionError):
         self.historization = '15 2 * * *'
     try:
         self.indicators = self.get('data', 'indicators')
     except (NoOptionError, NoSectionError):
         self.indicators = 'indicators.xml'
     try:
         self.updateTemplate = self.get('data', 'updateTemplate')
     except (NoOptionError, NoSectionError):
         self.updateTemplate = 'default.xml'
Ejemplo n.º 39
0
 def readConf(self):
     PluginConfig.readConf(self)
     # DHCP conf
     try:
         self.dhcpEnable = self.getboolean("dhcp", "enable")
     except:
         self.dhcpEnable = True
     self.dhcpDN = self.getdn("dhcp", "dn")
     self.dhcpPidFile = self.get("dhcp", "pidfile")
     self.dhcpInit = self.get("dhcp", "init")
     self.dhcpLogFile = self.get("dhcp", "logfile")
     self.dhcpLeases = self.get("dhcp", "leases")
     try:
         self.dhcpHostname = self.get("dhcp", "hostname")
     except NoOptionError:
         self.dhcpHostname = socket.gethostname()
     # DNS conf
     try:
         self.dnsEnable = self.getboolean("dns", "enable")
     except:
         self.dnsEnable = True
     try:
         self.dnsType = self.get("dns", "type")
     except NoOptionError:
         self.dnsType = "bind"
     self.dnsDN = self.getdn("dns", "dn")
     self.dnsPidFile = self.get("dns", "pidfile")
     self.dnsInit = self.get("dns", "init")
     self.dnsLogFile = self.get("dns", "logfile")
     if self.dnsType == "bind":
         self.bindRootPath = self.get("dns", "bindroot")
         self.bindGroup = self.get("dns", "bindgroup")
         self.bindLdap = os.path.join(self.bindRootPath, "named.conf.ldap")
         self.bindLdapDir = os.path.join(self.bindRootPath, "named.ldap")
         try:
             self.bindLdapChrootConfPath = os.path.join(
                 self.get("dns", "bindchrootconfpath"), "named.ldap")
         except NoOptionError:
             self.bindLdapChrootConfPath = self.bindLdapDir
     try:
         self.dnsReader = self.getdn("dns", "dnsreader")
     except NoOptionError:
         pass
     try:
         self.dnsReaderPassword = self.getpassword("dns",
                                                   "dnsreaderpassword")
     except NoOptionError:
         pass
Ejemplo n.º 40
0
 def readConf(self):
     PluginConfig.readConf(self)
     self.external_zones_names = self.get('main', 'external_zones_names').split(" ")
     self.internal_zones_names = self.get('main', 'internal_zones_names').split(" ")
     try:
         self.path = self.get('main', 'path')
     except NoOptionError:
         self.path = '/etc/shorewall'
     try:
         self.macros_path = self.get('main', 'macros_path')
     except NoOptionError:
         self.macros_path = '/usr/share/shorewall'
     try:
         self.macros_list = self.get('main', 'macros_list').replace(' ', '').split(',')
     except NoOptionError:
         self.macros_list = []
Ejemplo n.º 41
0
 def readConf(self):
     PluginConfig.readConf(self)
     # DHCP conf
     try:
         self.dhcpEnable = self.getboolean("dhcp", "enable")
     except:
         self.dhcpEnable = True
     self.dhcpDN = self.getdn("dhcp", "dn")
     self.dhcpPidFile = self.get("dhcp", "pidfile")
     self.dhcpInit = self.get("dhcp", "init")
     self.dhcpLogFile = self.get("dhcp", "logfile")
     self.dhcpLeases = self.get("dhcp", "leases")
     try:
         self.dhcpHostname = self.get("dhcp", "hostname")
     except NoOptionError:
         self.dhcpHostname = socket.gethostname()
     # DNS conf
     try:
         self.dnsEnable = self.getboolean("dns", "enable")
     except:
         self.dnsEnable = True
     try:
         self.dnsType = self.get("dns", "type")
     except NoOptionError:
         self.dnsType = "bind"
     self.dnsDN = self.getdn("dns", "dn")
     self.dnsPidFile = self.get("dns", "pidfile")
     self.dnsInit = self.get("dns", "init")
     self.dnsLogFile = self.get("dns", "logfile")
     if self.dnsType == "bind":
         self.bindRootPath = self.get("dns", "bindroot")
         self.bindGroup = self.get("dns", "bindgroup")
         self.bindLdap = os.path.join(self.bindRootPath, "named.conf.ldap")
         self.bindLdapDir = os.path.join(self.bindRootPath, "named.ldap")
         try:
             self.bindLdapChrootConfPath = os.path.join(self.get("dns", "bindchrootconfpath"), "named.ldap")
         except NoOptionError:
             self.bindLdapChrootConfPath = self.bindLdapDir
     try:
         self.dnsReader = self.getdn("dns", "dnsreader")
     except NoOptionError:
         pass
     try:
         self.dnsReaderPassword = self.getpassword("dns", "dnsreaderpassword")
     except NoOptionError:
         pass
Ejemplo n.º 42
0
 def readConf(self):
     """
     Read the configuration file using the ConfigParser API.
     """
     PluginConfig.readConf(self)
     # Read LDAP Password Policy configuration
     self.ppolicyAttributes = {}
     self.ppolicydn = self.get('ppolicy', 'ppolicyDN')
     self.ppolicydefault = self.get('ppolicy', 'ppolicyDefault')
     self.ppolicydefaultdn = "cn=" + self.ppolicydefault + "," + self.ppolicydn
     for attribute in self.items('ppolicyattributes'):
         if attribute[1] == 'True':
             self.ppolicyAttributes[attribute[0]] = True
         elif attribute[1] == 'False':
             self.ppolicyAttributes[attribute[0]] = False
         else:
             self.ppolicyAttributes[attribute[0]] = attribute[1]
Ejemplo n.º 43
0
 def readConf(self):
     """
     Read the configuration file using the ConfigParser API.
     """
     PluginConfig.readConf(self)
     # Read LDAP Password Policy configuration
     self.ppolicyAttributes = {}
     self.ppolicydn = self.get("ppolicy", "ppolicyDN")
     self.ppolicydefault = self.get("ppolicy", "ppolicyDefault")
     self.ppolicydefaultdn = "cn=" + self.ppolicydefault + "," + self.ppolicydn
     for attribute in self.items("ppolicyattributes"):
         if attribute[1] == "True":
             self.ppolicyAttributes[attribute[0]] = True
         elif attribute[1] == "False":
             self.ppolicyAttributes[attribute[0]] = False
         else:
             self.ppolicyAttributes[attribute[0]] = attribute[1]
Ejemplo n.º 44
0
Archivo: config.py Proyecto: allgi/mmc
 def readConf(self):
     PluginConfig.readConf(self)
     self.external_zones_names = self.get('main', 'external_zones_names')
     self.internal_zones_names = self.get('main', 'internal_zones_names')
     try:
         self.path = self.get('main', 'path')
     except NoOptionError:
         self.path = '/etc/shorewall'
     try:
         self.macros_path = self.get('main', 'macros_path')
     except NoOptionError:
         self.macros_path = '/usr/share/shorewall'
     try:
         self.macros_list = self.get('main',
                                     'macros_list').replace(' ',
                                                            '').split(',')
     except NoOptionError:
         self.macros_list = []
Ejemplo n.º 45
0
 def readConf(self):
     PluginConfig.readConf(self)
     try:
         self.diskquotaenable = self.getboolean("diskquota", "enable")
     except:
         pass
     try:
         self.networkquotaenable = self.getboolean("networkquota", "enable")
     except:
         pass
     self.devicemap = self.get("diskquota", "devicemap").split(',')
     self.inodesperblock = self.getfloat("diskquota", "inodesperblock")
     self.softquotablocks = self.getfloat("diskquota", "softquotablocks")
     self.softquotainodes = self.getfloat("diskquota", "softquotainodes")
     self.setquotascript = self.get("diskquota", "setquotascript")
     self.delquotascript = self.get("diskquota", "delquotascript")
     self.runquotascript = self.get("diskquota", "runquotascript")
     self.networkmap = self.get("networkquota", "networkmap").split(',')
Ejemplo n.º 46
0
 def readConf(self):
     """
     Read web section of the imaging plugin configuration file
     """
     PluginConfig.readConf(self)
     if not self.disabled:
         ImagingDatabaseConfig.setup(self, self.conffile)
         if self.has_section("web"):
             for i in (
                 "date_fmt",
                 "default_protocol",
                 "default_menu_name",
                 "default_timeout",
                 "default_background_uri",
                 "default_message",
             ):
                 full_name = "web_def_%s" % i
                 if self.has_option("web", full_name):
                     setattr(self, full_name, self.get("web", full_name))
Ejemplo n.º 47
0
    def readConf(self):
        PluginConfig.readConf(self)

        try: self.samba_prefix = self.get("main", "sambaPrefix")
        except: pass

        try: self.conf_file = self.get("main", "sambaConfFile")
        except: pass

        try: self.init_script = self.get("main", "sambaInitScript")
        except: pass

        self.defaultSharesPath = self.get("main", "defaultSharesPath")

        try:
            listSharePaths = self.get("main", "authorizedSharePaths")
            self.authorizedSharePaths = listSharePaths.replace(' ','').split(',')
        except:
            self.authorizedSharePaths = [self.defaultSharesPath]
Ejemplo n.º 48
0
    def setDefault(self):

        PluginConfig.setDefault(self)

        self.pid_path = "/var/run/pulse2/ssh_support"
        self.ssh_path = "/usr/bin/ssh"
        self.support_url = "rssh.mandriva.com"
        self.support_user = "******"
        self.identify_file = "/etc/mmc/plugins/support/id_rsa"
        self.check_pid_delay = 2
        self.session_timeout = 7200

        self.license_server_url = "https://serviceplace.mandriva.com/api/v1/support"
        self.install_id_path = "/etc/pulse-licensing/installation_id"
        self.install_uuid = None

        self.cron_search_for_updates = "0 6 * * *"
        self.license_tmp_file = "/var/lib/mmc/pulse_license_info"
        self.country = "FR"
Ejemplo n.º 49
0
    def readConf(self):

        PluginConfig.readConf(self)

        try: self.squidBinary = self.get("squid", "squidBinary")
        except (NoSectionError, NoOptionError): self.squidBinary = "/usr/sbin/squid"

        try: self.squidRules = self.get("squid", "squidRules")
        except (NoSectionError, NoOptionError): self.squidRules = "/etc/squid/rules"

        try: self.blacklist = self.get("squid", "blacklist")
        except (NoSectionError, NoOptionError): self.blacklist = os.path.join(self.squidRules, "blacklist.txt")

        try: self.whitelist = self.get("squid", "whitelist")
        except (NoSectionError, NoOptionError): self.whitelist = os.path.join(self.squidRules, "whitelist.txt")

        try: self.blacklist_ext = self.get("squid", "blacklist_ext")
        except (NoSectionError, NoOptionError): self.blacklist_ext = os.path.join(self.squidRules, "blacklist_ext.txt")

        try: self.timeranges = self.get("squid", "timeranges")
        except (NoSectionError, NoOptionError): self.timeranges = os.path.join(self.squidRules, "timeranges.txt")

        try: self.machines = self.get("squid", "machines")
        except (NoSectionError, NoOptionError): self.machines = os.path.join(self.squidRules, "machines.txt")

        try: self.sargBinary = self.get("squid", "sargBinary")
        except (NoSectionError, NoOptionError): self.sargBinary = "/usr/sbin/sarg"

        try: self.squidInit = self.get("squid", "squidInit")
        except (NoSectionError, NoOptionError): self.squidInit = "/etc/init.d/squid"

        try: self.squidPid = self.get("squid", "squidPid")
        except (NoSectionError, NoOptionError): self.squidPid = "/var/run/squid.pid"

        try: self.groupMaster = self.get("squid", "groupMaster")
        except (NoSectionError, NoOptionError): self.groupMaster = "InternetMaster"
        self.groupMasterDesc = "Full Internet access"

        try: self.groupFiltered = self.get("squid", "groupFiltered")
        except (NoSectionError, NoOptionError): self.groupFiltered = "InternetFiltered"
        self.groupFilteredDesc = "Filtered Internet access"
Ejemplo n.º 50
0
Archivo: config.py Proyecto: allgi/mmc
    def readConf(self):
        """
        Read web section of the imaging plugin configuration file
        """
        PluginConfig.readConf(self)
        if not self.disabled:
            ImagingDatabaseConfig.setup(self, self.conffile)
            if self.has_section("web"):
                for option in self.options("web"):
                    # option variable is lowercase
                    setattr(self, option, self.get("web", option))

        setattr(self, "network", "resolv_order")
        if not type(self.resolv_order) == type([]):
            self.resolv_order = self.resolv_order.split(' ')

        pnp = PreferredNetworkParser(None, None)
        if self.has_option("network", "preferred_network"):
            self.preferred_network = pnp.parse(self.get("network", "preferred_network"))
        else :
            self.preferred_network = pnp.get_default()
Ejemplo n.º 51
0
    def readConf(self):
        PluginConfig.readConf(self)
        LDAPConnectionConfig.readLDAPConf(self, "ldap")
        AuditConfig.readAuditConf(self, "audit")
        # Selected authentication method
        try:
            self.authmethod = self.get("authentication", "method")
        except:
            pass
        # Selected provisioning method
        try:
            self.provmethod = self.get("provisioning", "method")
        except:
            pass
        # Selected computer management method
        try:
            self.computersmethod = self.get("computers", "method")
        except:
            pass
        # User password scheme
        try:
            self.passwordscheme = self.get("ldap", "passwordscheme")
        except:
            pass

        self.baseDN = self.getdn('ldap', 'baseDN')
        self.baseUsersDN = self.getdn('ldap', 'baseUsersDN')

        # Where LDAP computer objects are stored
        # For now we ignore if the option does not exist, because it breaks
        # all existing intallations
        try:
            self.baseComputersDN = self.get('ldap', 'baseComputersDN')
        except:
            pass
        self.backuptools = self.get("backup-tools", "path")
        self.backupdir = self.get("backup-tools", "destpath")
        self.username = self.getdn("ldap", "rootName")
        self.password = self.getpassword("ldap", "password")
Ejemplo n.º 52
0
    def readConf(self):
        PluginConfig.readConf(self)
        LDAPConnectionConfig.readLDAPConf(self, "ldap")
        AuditConfig.readAuditConf(self, "audit")
        # Selected authentication method
        try:
            self.authmethod = self.get("authentication", "method")
        except:
            pass
        # Selected provisioning method
        try:
            self.provmethod = self.get("provisioning", "method")
        except:
            pass
        # Selected computer management method
        try:
            self.computersmethod = self.get("computers", "method")
        except:
            pass
        # User password scheme
        try:
            self.passwordscheme = self.get("ldap", "passwordscheme")
        except:
            pass

        self.baseDN = self.getdn('ldap', 'baseDN')
        self.baseUsersDN = self.getdn('ldap', 'baseUsersDN')

        # Where LDAP computer objects are stored
        # For now we ignore if the option does not exist, because it breaks
        # all existing intallations
        try:
            self.baseComputersDN = self.get('ldap', 'baseComputersDN')
        except:
            pass
        self.backuptools = self.get("backup-tools", "path")
        self.backupdir = self.get("backup-tools", "destpath")
        self.username = self.getdn("ldap", "rootName")
        self.password = self.getpassword("ldap", "password")
Ejemplo n.º 53
0
    def setDefault(self):

        PluginConfig.setDefault(self)

        self.pid_path = "/var/run/pulse2/ssh_support"
        self.ssh_path = "/usr/bin/ssh"
        self.support_url = ""
        self.support_user = "******"
        self.identify_file = "/etc/mmc/plugins/support/id_rsa"
        self.check_pid_delay = 2
        self.session_timeout = 7200

        self.license_server_url = ""
        self.install_id_path = "/etc/pulse-licensing/installation_id"
        self.install_uuid = None

        self.cron_search_for_updates = "0 6 * * *"
        self.license_tmp_file = "/var/lib/mmc/pulse_license_info"
        self.country = "FR"

        self.collector_script_path = "/usr/sbin/pulse2-collect-info"
        self.collector_archive_path = "/tmp/pulse2-collect-info.7z"
Ejemplo n.º 54
0
    def setDefault(self):

        PluginConfig.setDefault(self)

        self.pid_path = "/var/run/pulse2/ssh_support"
        self.ssh_path = "/usr/bin/ssh"
        self.support_url = "rssh.mandriva.com"
        self.support_user = "******"
        self.identify_file = "/etc/mmc/plugins/support/id_rsa"
        self.check_pid_delay = 2
        self.session_timeout = 7200

        self.license_server_url = "https://serviceplace.mandriva.com/api/v1/support"
        self.install_id_path = "/etc/pulse-licensing/installation_id"
        self.install_uuid = None

        self.cron_search_for_updates = "0 6 * * *"
        self.license_tmp_file = "/var/lib/mmc/pulse_license_info"
        self.country = "FR"

        self.collector_script_path = "/usr/sbin/pulse2-collect-info"
        self.collector_archive_path = "/tmp/pulse2-collect-info.7z"
Ejemplo n.º 55
0
Archivo: config.py Proyecto: allgi/mmc
    def readConf(self):
        """
        Read web section of the imaging plugin configuration file
        """
        PluginConfig.readConf(self)
        if not self.disabled:
            ImagingDatabaseConfig.setup(self, self.conffile)
            if self.has_section("web"):
                for option in self.options("web"):
                    # option variable is lowercase
                    setattr(self, option, self.get("web", option))

        setattr(self, "network", "resolv_order")
        if not type(self.resolv_order) == type([]):
            self.resolv_order = self.resolv_order.split(' ')

        pnp = PreferredNetworkParser(None, None)
        if self.has_option("network", "preferred_network"):
            self.preferred_network = pnp.parse(
                self.get("network", "preferred_network"))
        else:
            self.preferred_network = pnp.get_default()
Ejemplo n.º 56
0
    def readConf(self):
        """
        Read the configuration file using the ConfigParser API.
        The PluginConfig.readConf reads the "disable" option of the
        "main" section.
        """
        PluginConfig.readConf(self)
	MonitoringDatabaseConfig.setup(self, self.conffile)

        try:
            self.monitoring_uri = self.get("webservices", "monitoring_url")
        except:
            self.monitoring_uri = "" # http://localhost/zabbix/

        try:
            self.monitoring_username = self.get("webservices", "monitoring_username")
        except:
            self.monitoring_username = "" # Admin

        try:
            self.monitoring_password = self.get("webservices", "monitoring_password")
        except:
            self.monitoring_password = "" # zabbix

        try:
            self.nmap_enable = self.get("data", "nmap_enable")
        except:
            self.nmap_enable = "" # 0

        try:
            self.nmap_task_time = self.get("data", "nmap_task_time")
        except:
            self.nmap_task_time = "" # 15 22 * * *

        try:
            self.nmap_network = self.get("data", "nmap_network")
        except:
            self.nmap_task_time = "" # "192.168.0.0/24"
Ejemplo n.º 57
0
 def readConf(self):
     PluginConfig.readConf(self)
     DatabaseConfig.setup(self, self.conffile)
     report_img_path = 'file:///etc/mmc/plugins/report/img/'
     try:
         self.historization = self.get('data', 'historization')
     except (NoOptionError, NoSectionError):
         self.historization = '15 22 * * *'
     try:
         self.indicators = self.get('data', 'indicators')
     except (NoOptionError, NoSectionError):
         self.indicators = 'indicators.xml'
     try:
         self.reportTemplate = self.get('data', 'reportTemplate')
     except (NoOptionError, NoSectionError):
         self.reportTemplate = 'default.xml'
     try:
         self.reportCSS = os.path.join(reportconfdir, 'css', self.get('data', 'reportCSS'))
     except (NoOptionError, NoSectionError, OSError):
         self.reportCSS = os.path.join(reportconfdir, 'css', 'style.css')
     try:
         self.graphCSS = [os.path.join(reportconfdir, 'css', f) for f in self.get('data', 'graphCSS').replace(' ', '').split(',')]
     except (NoOptionError, NoSectionError, OSError):
         self.graphCSS = []
     try:
         self.company = self.get('pdfvars', 'company')
     except (NoOptionError, NoSectionError):
         self.company = 'Company'
     try:
         self.company_logo_path = report_img_path + self.get('pdfvars', 'company_logo_path')
     except (NoOptionError, NoSectionError):
         self.company_logo_path = report_img_path + 'mandriva.png'
     try:
         self.pulse_logo_path = report_img_path + self.get('pdfvars', 'pulse_logo_path')
     except (NoOptionError, NoSectionError):
         self.pulse_logo_path = report_img_path + 'pulse.png'
Ejemplo n.º 58
0
 def setDefault(self):
     PluginConfig.setDefault(self)
     self.diskquotaenable = True
     self.networkquotaenable = False
Ejemplo n.º 59
0
 def __init__(self, name='report', conffile=None):
     if not hasattr(self, 'initdone'):
         PluginConfig.__init__(self, name, conffile)
         DatabaseConfig.__init__(self)
         self.initdone = True