コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
    def test_130_check_cmd_connected(self):
        """Check if cmd is connected using alert rule"""
        # Enable cloud connection
        system_settings = uvmContext.systemManager().getSettings()
        system_settings['cloudEnabled'] = True
        uvmContext.systemManager().setSettings(system_settings)

        # run cmd status
        result = ""
        for i in range(0, 20):
            try:
                result = subprocess.check_output("/usr/bin/pyconnector-status")
            except subprocess.CalledProcessError as e:
                print((e.output))
                time.sleep(10)
                continue
            else:
                break
        assert ("Connected" in result)
コード例 #4
0
ファイル: uvm_tests.py プロジェクト: untangle/ngfw_src
 def test_130_check_cmd_connected(self):
     """Check if cmd is connected using alert rule"""
     # Enable cloud connection  
     system_settings = uvmContext.systemManager().getSettings()
     system_settings['cloudEnabled'] = True
     uvmContext.systemManager().setSettings(system_settings)
     
     # run cmd status
     result = ""
     for i in range(0,20):
         try:
             result = subprocess.check_output("/usr/bin/pyconnector-status")
             result = result.decode("utf-8")  # decode byte to string.
         except subprocess.CalledProcessError as e:
             print((e.output))
             time.sleep(10)
             continue
         else:
             break
     assert("Connected" in result)