示例#1
0
        app.setSettings(appData)

        internalAdmin = None
        result = remote_control.run_command("wget -q -O - \"$@\" " +
                                            global_functions.get_http_url(),
                                            stdout=True)
        myRegex = re.compile(
            '.*A regulation banner requirement containing a mix of text including <b>html<\/b> and<br\/>multiple<br\/>lines.*',
            re.DOTALL | re.MULTILINE)
        if re.match(myRegex, result):
            assert (False)
        else:
            assert (True)

    @staticmethod
    def finalTearDown(self):
        global app, appWeb
        if app != None:
            # Restore original settings to return to initial settings
            setDefaultBrandingManagerSettings()
            uvmContextLongTimeout.appManager().destroy(
                app.getAppSettings()["id"])
            app = None
        if appWeb != None:
            uvmContextLongTimeout.appManager().destroy(
                appWeb.getAppSettings()["id"])
            appWeb = None


test_registry.registerApp("branding-manager", BrandingManagerTests)
示例#2
0
        ip_address_testuntangle = socket.gethostbyname(smtpServerHost)
        appSSL.start()
        tlsSMTPResult = sendPhishMail(mailfrom="test060",
                                      host=smtpServerHost,
                                      useTLS=True)
        # print("TLS  : " + str(tlsSMTPResult))
        appSSL.stop()
        assert (tlsSMTPResult == 0)

        events = global_functions.get_events('Phish Blocker',
                                             'All Phish Events', None, 1)
        assert (events != None)
        found = global_functions.check_events(
            events.get('list'), 5, 'c_server_addr', ip_address_testuntangle,
            's_server_port', 25, 'addr', '*****@*****.**',
            'c_client_addr', remote_control.clientIP, 'phish_blocker_action',
            'D')

    @staticmethod
    def finalTearDown(self):
        global app, appSSL
        if app != None:
            uvmContext.appManager().destroy(app.getAppSettings()["id"])
            app = None
        if appSSL != None:
            uvmContext.appManager().destroy(appSSL.getAppSettings()["id"])
            appSSL = None


test_registry.registerApp("phish-blocker", PhishBlockerTests)
示例#3
0
        found = global_functions.check_events( events.get('list'), 5, 
                                            "application_control_application", "GOOGLE", 
                                            "application_control_category", "Web Services", 
                                            "application_control_blocked", True,
                                            "application_control_flagged", True)
        assert( found )

    def test_500_classdDaemonReconnect(self):
        if remote_control.quickTestsOnly:
            raise unittest2.SkipTest('Skipping a time consuming test')
        for i in range(10):
            print "Test %i" % i
            result = subprocess.call("/etc/init.d/untangle-classd restart >/dev/null 2>&1", shell=True)
            assert (result == 0)
            result = remote_control.is_online()
            assert (result == 0)
        # give it some time to recover for future tests
        for i in range(5):
            result = remote_control.is_online()
            time.sleep(1)

    @staticmethod
    def finalTearDown(self):
        global app
        if app != None:
            uvmContext.appManager().destroy( app.getAppSettings()["id"] )
            app = None

test_registry.registerApp("application-control", ApplicationControlTests)

示例#4
0
        start_time = datetime.now()
        result = remote_control.run_command("nmap -PN -sT -T5 --min-parallelism 15 -p10000-10100 1.2.3.5 2>&1 >/dev/null")
        assert (result == 0)

        events = global_functions.get_events('Shield','Blocked Session Events',None,1)
        assert(events != None)
        found = global_functions.check_events( events.get('list'), 5,
                                               'c_client_addr', remote_control.clientIP,
                                               's_server_addr', '1.2.3.5',
                                               min_date=start_time)
        assert( not found )

    @staticmethod
    def finalTearDown(self):
        global orig_netsettings
        # Restore original settings to return to initial settings
        # print "orig_netsettings <%s>" % orig_netsettings
        uvmContext.networkManager().setNetworkSettings(orig_netsettings)

        settings = app.getSettings()
        settings['shieldEnabled'] = default_enabled
        app.setSettings(settings)

        # sleep so the reputation goes down so it will not interfere with any future tests
        time.sleep(3)
        # shield is always installed, do not remove it
        

test_registry.registerApp("shield", ShieldTests)
示例#5
0
        # does the backup exist
        assert (result == 0)

        #extract backup
        subprocess.call("mkdir /tmp/untangleBackup", shell=True)
        subprocess.call(
            "tar -xf /tmp/untangleBackup.backup -C /tmp/untangleBackup",
            shell=True)
        subprocess.call(
            "tar -xf " + glob.glob("/tmp/untangleBackup/files*.tar.gz")[0] +
            " -C /tmp/untangleBackup",
            shell=True)  #use glob since extracted file has timestamp

        #Check the cert in the backup
        newCertFilePath = "/tmp/untangleBackup/usr/share/untangle/settings/untangle-certificates/apache.pem"
        newCertFile = open(newCertFilePath, "r")
        newCertFileLines = newCertFile.read().splitlines()

        #compare original and modified certs
        assert (newline == newCertFileLines[1])

    def test_130_check_cmd_connected(self):
        """Check if cmd is connected using alert rule"""

        # run cmd status
        result = subprocess.check_output("/usr/bin/pyconnector-status")
        assert ("Connected" in result)


test_registry.registerApp("uvm", UvmTests)
        appData['captureRules']['list'] = []
        appData['captureRules']['list'].append(createCaptureNonWanNicRule(1))
        appData['authenticationType'] = "NONE"
        appData['pageType'] = "BASIC_MESSAGE"
        appData['userTimeout'] = 3600  # default
        appData['disableSecureRedirect'] = True
        app.setSettings(appData)

        # check that the request times out when secure redirection is disabled
        result = remote_control.run_command(
            "curl -s --connect-timeout 10 -L -o /tmp/capture_test_072.out --insecure https://test.untangle.com/"
        )
        assert (result != 0)

    @staticmethod
    def finalTearDown(self):
        global app, appAD, appWeb
        uvmContext.localDirectory().setUsers(removeLocalDirectoryUser())
        if app != None:
            uvmContext.appManager().destroy(app.getAppSettings()["id"])
            app = None
        if appAD != None:
            uvmContext.appManager().destroy(appAD.getAppSettings()["id"])
            appAD = None
        if appWeb != None:
            uvmContext.appManager().destroy(appWeb.getAppSettings()["id"])
            appWeb = None


test_registry.registerApp("captive-portal", CaptivePortalTests)
示例#7
0
        rules_clear()
        rule_append(
            create_rule_single_condition("CLIENT_COUNTRY",
                                         "XL",
                                         blocked=False,
                                         flagged=True))
        result = remote_control.run_command(
            "wget -q -O /dev/null -t 1 --timeout=3 http://test.untangle.com/")
        assert (result == 0)

        events = global_functions.get_events('Firewall', 'Flagged Events',
                                             None, 1)
        assert (events != None)
        found = global_functions.check_events(events.get('list'), 5,
                                              'c_client_addr',
                                              remote_control.clientIP,
                                              'client_country', "XL",
                                              'firewall_blocked', False,
                                              'firewall_flagged', True)
        assert (found)

    @staticmethod
    def finalTearDown(self):
        global app
        if app != None:
            uvmContext.appManager().destroy(app.getAppSettings()["id"])
        app = None


test_registry.registerApp("firewall", FirewallTests)
示例#8
0
            for x in range(0, 5):
                result = global_functions.get_public_ip_address()
                print(
                    "WAN Down NAT 1:1 IP %s  External IP %s and retrieved IP %s"
                    % (wanIP, wanExternalIP, result))
                assert (result == wanExternalIP)
            uvmContext.networkManager().setNetworkSettings(orig_netsettings)

        nuke_wan_failover_rules()
        # Check to see if the faceplate counters have incremented.
        post_count = global_functions.get_app_metric_value(
            app_wan_failover, "changed")
        assert (pre_count < post_count)

    @staticmethod
    def finalTearDown(self):
        global app, app_wan_failover
        # Restore original settings to return to initial settings
        if app != None:
            uvmContext.appManager().destroy(app.getAppSettings()["id"])
            app = None
        if app_wan_failover != None:
            uvmContext.appManager().destroy(
                app_wan_failover.getAppSettings()["id"])
            app_wan_failover = None
        if orig_netsettings != None:
            uvmContext.networkManager().setNetworkSettings(orig_netsettings)


test_registry.registerApp("wan-balancer", WanBalancerTests)
示例#9
0
        events = global_functions.get_events('OpenVPN', 'Connection Events',
                                             None, 1)
        assert (events != None)
        found = global_functions.check_events(events.get('list'), 5,
                                              'remote_address',
                                              global_functions.vpnClientVpnIP,
                                              'client_name', vpnClientName)
        assert (found)

        # Check to see if the faceplate counters have incremented.
        post_events_connect = global_functions.get_app_metric_value(
            app, "connect")
        assert (pre_events_connect < post_events_connect)

    @staticmethod
    def finalTearDown(self):
        global app, appWeb, appDC
        if app != None:
            uvmContext.appManager().destroy(app.getAppSettings()["id"])
            app = None
        if appWeb != None:
            uvmContext.appManager().destroy(appWeb.getAppSettings()["id"])
            appWeb = None
        if appDC != None:
            uvmContext.appManager().destroy(appDC.getAppSettings()["id"])
            appDC = None


test_registry.registerApp("openvpn", OpenVpnTests)
#
# Just extends the spam base tests to include SSL Inspector with default settings
#
class SpamBlockerTests(SpamBlockerBaseTests):
    @staticmethod
    def appName():
        return "spam-blocker"

    @staticmethod
    def shortName():
        return "spam-blocker"

    @staticmethod
    def displayName():
        return "Spam Blocker"

    # verify daemon is running
    def test_009_IsRunningAndSSL(self):
        appSSL = appSP = uvmContext.appManager().app(
            self.appNameSSLInspector())
        appSSL.start()
        result = os.system(
            "ps aux | grep spamd | grep -v grep >/dev/null 2>&1")
        assert (result == 0)
        result = os.system(
            "ps aux | grep spamcatd | grep -v grep >/dev/null 2>&1")
        assert (result == 0)


test_registry.registerApp("spam-blocker-w-ssl", SpamBlockerTests)
示例#11
0
        appData = app.getSettings()
        appData['rules']['list'].append(setUpTunnelRule())
        appData['tunnels']['list'].append(setUpTunnelProfile())
        app.setSettings(appData)

        # wait for vpn tunnel to form
        timeout = 60
        connected = False
        while (not connected and timeout > 0):
            newWanIP = remote_control.run_command(
                "wget --timeout=4 -q -O - \"$@\" test.untangle.com/cgi-bin/myipaddress.py",
                stdout=True)
            if (currentWanIP != newWanIP):
                connected = True
            else:
                timeout -= 1

        # If VPN tunnel has failed to connect, fail the test,
        assert (connected)

    @staticmethod
    def finalTearDown(self):
        global app
        if app != None:
            uvmContext.appManager().destroy(app.getAppSettings()["id"])
        app = None


test_registry.registerApp("tunnel-vpn", TunnelVpnTests)
        found = global_functions.check_events(events.get('list'),
                                              500,
                                              "source_addr",
                                              remote_control.clientIP,
                                              "dest_addr",
                                              test_untangle_com_ip,
                                              "dest_port",
                                              80,
                                              "protocol",
                                              6,
                                              "blocked",
                                              True,
                                              min_date=startTime)

        print "found: %s" % str(found)
        assert (not found)

    @staticmethod
    def finalTearDown(self):
        """
        Shut down
        """
        global app
        if app == None:
            return
        uvmContext.appManager().destroy(app.getAppSettings()["id"])
        app = None


test_registry.registerApp("intrusion-prevention", IntrusionPreventionTests)