Пример #1
0
 def _read_config(self):
     try:
         serialized = self.core.config_manager.get(self.NAME)
         serialized['myfingerprint'] = self.FINGERPRINT
     except (ConfigError, KeyError):
         self.warning("Site-to-site VPN not configured, default values loaded")
         return Site2SiteCfg.defaultConf(myfingerprint=self.FINGERPRINT)
     else:
         return Site2SiteCfg.deserialize(serialized)
Пример #2
0
 def service_setConfig(self, context, serialized, message):
     """
     field 'myfingerprint' in serialized is ignored
     in order to update 'myfingerprint', create a new service which:
         - unlink self.FINGERPRINT_CREATED
         - call self.createFingerprint()
     """
     cfg = Site2SiteCfg.deserialize(serialized)
     ok, msg = cfg.isValidWithMsg()
     if ok:
         self.cfg = cfg
         self.save_config(message, context)
     else:
         raise InvalidConfError(msg)
Пример #3
0
    def fetchConfig(self):
        deserialized = self.mainwindow.init_call('site2site', 'getConfig')
        if deserialized is None:
            self.mainwindow.addToInfoArea(tr("Could not fetch a configuration for site to site VPN (IPsec)"), category=COLOR_WARNING)
            self.__disable(
                tr("Page disabled"),
                tr("Error while loading site to site VPN (IPsec) configuration.")
                )
            return

        try:
            self.config = Site2SiteCfg.deserialize(deserialized)
        except DatastructureIncompatible, error:
            if error.server_more_recent:
                message = tr("Client-server version mismatch, the appliance version is more recent than the client version.")
            else:
                message = tr("Client-server version mismatch, the client version is more recent than the appliance version.")
            self.__disable(
                tr("Page disabled"),
                message
                )
            raise