Exemple #1
0
    def initial_extra_setup(cls):
        global orig_settings, test_email_address, can_relay, can_syslog, syslog_server_host, web_app

        reportSettings = cls._app.getSettings()
        orig_settings = copy.deepcopy(reportSettings)

        if (uvmContext.appManager().isInstantiated(cls.webAppName())):
            raise Exception('app %s already instantiated' % cls.webAppName())
        web_app = uvmContext.appManager().instantiate(cls.webAppName(),
                                                      default_policy_id)
        # Skip checking relaying is possible if we have determined it as true on previous test.
        try:
            can_relay = global_functions.send_test_email()
        except Exception as e:
            can_relay = False

        if can_syslog == None:
            can_syslog = False
            wan_IP = uvmContext.networkManager().getFirstWanAddress()
            syslog_server_host = global_functions.find_syslog_server(wan_IP)
            if syslog_server_host:
                portResult = remote_control.run_command(
                    "sudo lsof -i :514", host=syslog_server_host)
                if portResult == 0:
                    can_syslog = True
Exemple #2
0
 def initial_setup(self):
     global app, appData, appSP, appDataSP, appSSL, appSSLData, canRelay
     if (uvmContext.appManager().isInstantiated(self.module_name())):
         raise unittest.SkipTest('app %s already instantiated' %
                                 self.module_name())
     app = uvmContext.appManager().instantiate(self.module_name(),
                                               default_policy_id)
     appData = app.getSettings()
     appSP = uvmContext.appManager().app(self.appNameSpamCase())
     appDataSP = appSP.getSmtpSettings()
     if uvmContext.appManager().isInstantiated(self.appNameSSLInspector()):
         raise Exception('app %s already instantiated' %
                         self.appNameSSLInspector())
     appSSL = uvmContext.appManager().instantiate(
         self.appNameSSLInspector(), default_policy_id)
     # appSSL.start() # leave app off. app doesn't auto-start
     appSSLData = appSSL.getSettings()
     try:
         canRelay = global_functions.send_test_email(
             mailhost=smtpServerHost)
     except Exception as e:
         canRelay = False
     self.canRelay = canRelay
     getLatestMailSender()
     # flush quarantine.
     curQuarantine = appSP.getQuarantineMaintenenceView()
     curQuarantineList = curQuarantine.listInboxes()
     for checkAddress in curQuarantineList['list']:
         if checkAddress['address']:
             curQuarantine.deleteInbox(checkAddress['address'])
Exemple #3
0
    def initial_extra_setup(cls):
        # FIXME: same as SpamBlockerBaseTests

        global appData, appSP, appDataSP, appSSL, canRelay

        appData = cls._app.getSettings()
        appSP = uvmContext.appManager().app(cls.appNameSpamCase())
        appDataSP = appSP.getSmtpSettings()
        if uvmContext.appManager().isInstantiated(cls.appNameSSLInspector()):
            raise Exception('app %s already instantiated' %
                            cls.appNameSSLInspector())
        appSSL = uvmContext.appManager().instantiate(cls.appNameSSLInspector(),
                                                     default_policy_id)
        # appSSL.start() # leave app off. app doesn't auto-start
        try:
            canRelay = global_functions.send_test_email(
                mailhost=smtpServerHost)
        except Exception as e:
            canRelay = False
        getLatestMailSender()

        # flush quarantine.
        curQuarantine = appSP.getQuarantineMaintenenceView()
        curQuarantineList = curQuarantine.listInboxes()
        for checkAddress in curQuarantineList['list']:
            if checkAddress['address']:
                curQuarantine.deleteInbox(checkAddress['address'])
    def initial_setup(self):
        global app,md5StdNum, appSSL, appSSLData, canRelay
        # download eicar and trojan files before installing virus blocker
        self.ftp_user_name, self.ftp_password = global_functions.get_live_account_info("ftp")
        remote_control.run_command("rm -f /tmp/eicar /tmp/std_022_ftpVirusBlocked_file /tmp/temp_022_ftpVirusPassSite_file")
        result = remote_control.run_command("wget --user="******" --password='******' -q -O /tmp/eicar http://test.untangle.com/virus/eicar.com")
        assert (result == 0)
        result = remote_control.run_command("wget --user="******" --password='******' -q -O /tmp/std_022_ftpVirusBlocked_file ftp://" + global_functions.ftp_server + "/virus/fedexvirus.zip")
        assert (result == 0)
        md5StdNum = remote_control.run_command("\"md5sum /tmp/std_022_ftpVirusBlocked_file | awk '{print $1}'\"", stdout=True)
        self.md5StdNum = md5StdNum
        # print("md5StdNum <%s>" % md5StdNum)
        assert (result == 0)

        try:
            canRelay = global_functions.send_test_email(mailhost=testsiteIP)
        except Exception as e:
            canRelay = False

        if (uvmContext.appManager().isInstantiated(self.module_name())):
            raise unittest.SkipTest('app %s already instantiated' % self.module_name())
        app = uvmContext.appManager().instantiate(self.module_name(), default_policy_id)
        self.app = app

        if uvmContext.appManager().isInstantiated(self.appNameSSLInspector()):
            raise Exception('app %s already instantiated' % self.appNameSSLInspector())
        appSSL = uvmContext.appManager().instantiate(self.appNameSSLInspector(), default_policy_id)
        # appSSL.start() # leave app off. app doesn't auto-start
        appSSLData = appSSL.getSettings()
        # Enable cloud connection
        system_settings = uvmContext.systemManager().getSettings()
        system_settings['cloudEnabled'] = True
        uvmContext.systemManager().setSettings(system_settings)
Exemple #5
0
    def initial_setup(self):
        global app, orig_settings, test_email_address, can_relay, can_syslog, syslog_server_host, web_app
        if (uvmContext.appManager().isInstantiated(self.module_name())):
            # report app is normally installed.
            # print("App %s already installed" % self.module_name())
            # raise Exception('app %s already instantiated' % self.module_name())
            app = uvmContext.appManager().app(self.module_name())
        else:
            app = uvmContext.appManager().instantiate(self.module_name(), default_policy_id)
        reportSettings = app.getSettings()
        orig_settings = copy.deepcopy(reportSettings)

        if (uvmContext.appManager().isInstantiated(self.webAppName())):
            raise Exception('app %s already instantiated' % self.webAppName())
        web_app = uvmContext.appManager().instantiate(self.webAppName(), default_policy_id)
        # Skip checking relaying is possible if we have determined it as true on previous test.
        try:
            can_relay = global_functions.send_test_email()
        except Exception as e:
            can_relay = False

        if can_syslog == None:
            can_syslog = False
            wan_IP = uvmContext.networkManager().getFirstWanAddress()
            syslog_server_host = global_functions.find_syslog_server(wan_IP)
            if syslog_server_host:
                portResult = remote_control.run_command("sudo lsof -i :514", host=syslog_server_host)
                if portResult == 0:
                    can_syslog = True
    def initial_setup(self):
        global app,md5StdNum, appSSL, appSSLData, canRelay
        # download eicar and trojan files before installing virus blocker
        self.ftp_user_name, self.ftp_password = global_functions.get_live_account_info("ftp")
        remote_control.run_command("rm -f /tmp/eicar /tmp/std_022_ftpVirusBlocked_file /tmp/temp_022_ftpVirusPassSite_file")
        result = remote_control.run_command("wget --user="******" --password='******' -q -O /tmp/eicar http://test.untangle.com/virus/eicar.com")
        assert (result == 0)
        result = remote_control.run_command("wget --user="******" --password='******' -q -O /tmp/std_022_ftpVirusBlocked_file ftp://" + global_functions.ftp_server + "/virus/fedexvirus.zip")
        assert (result == 0)
        md5StdNum = remote_control.run_command("\"md5sum /tmp/std_022_ftpVirusBlocked_file | awk '{print $1}'\"", stdout=True)
        self.md5StdNum = md5StdNum
        # print("md5StdNum <%s>" % md5StdNum)
        assert (result == 0)

        try:
            canRelay = global_functions.send_test_email(mailhost=testsiteIP)
        except Exception as e:
            canRelay = False

        if (uvmContext.appManager().isInstantiated(self.module_name())):
            raise unittest.SkipTest('app %s already instantiated' % self.module_name())
        app = uvmContext.appManager().instantiate(self.module_name(), default_policy_id)
        self.app = app

        if uvmContext.appManager().isInstantiated(self.appNameSSLInspector()):
            raise Exception('app %s already instantiated' % self.appNameSSLInspector())
        appSSL = uvmContext.appManager().instantiate(self.appNameSSLInspector(), default_policy_id)
        # appSSL.start() # leave app off. app doesn't auto-start
        appSSLData = appSSL.getSettings()
        # Enable cloud connection
        system_settings = uvmContext.systemManager().getSettings()
        system_settings['cloudEnabled'] = True
        uvmContext.systemManager().setSettings(system_settings)
 def initial_setup(self):
     global app, appData, appSP, appDataSP, appSSL, appSSLData, canRelay
     if (uvmContext.appManager().isInstantiated(self.module_name())):
         raise unittest.SkipTest('app %s already instantiated' % self.module_name())
     app = uvmContext.appManager().instantiate(self.module_name(), default_policy_id)
     appData = app.getSettings()
     appSP = uvmContext.appManager().app(self.appNameSpamCase())
     appDataSP = appSP.getSmtpSettings()
     if uvmContext.appManager().isInstantiated(self.appNameSSLInspector()):
         raise Exception('app %s already instantiated' % self.appNameSSLInspector())
     appSSL = uvmContext.appManager().instantiate(self.appNameSSLInspector(), default_policy_id)
     # appSSL.start() # leave app off. app doesn't auto-start
     appSSLData = appSSL.getSettings()
     try:
         canRelay = global_functions.send_test_email(mailhost=smtpServerHost)
     except Exception as e:
         canRelay = False
     self.canRelay = canRelay
     getLatestMailSender()
     # flush quarantine.
     curQuarantine = appSP.getQuarantineMaintenenceView()
     curQuarantineList = curQuarantine.listInboxes()
     for checkAddress in curQuarantineList['list']:
         if checkAddress['address']:
             curQuarantine.deleteInbox(checkAddress['address'])
 def initial_setup(self):
     global app, appData, appSP, appDataSP, appSSL, canRelay
     if (uvmContext.appManager().isInstantiated(self.module_name())):
         raise unittest.SkipTest('app %s already instantiated' %
                                 self.module_name())
     app = uvmContext.appManager().instantiate(self.module_name(),
                                               default_policy_id)
     appData = app.getSettings()
     appSP = uvmContext.appManager().app(self.appNameSpamCase())
     appDataSP = appSP.getSmtpSettings()
     if uvmContext.appManager().isInstantiated(self.appNameSSLInspector()):
         raise Exception('app %s already instantiated' %
                         self.appNameSSLInspector())
     appSSL = uvmContext.appManager().instantiate(
         self.appNameSSLInspector(), default_policy_id)
     # appSSL.start() # leave app off. app doesn't auto-start
     try:
         canRelay = global_functions.send_test_email(
             mailhost=smtpServerHost)
     except Exception as e:
         canRelay = False
     getLatestMailSender()