Examples of Firewall


Examples of com.google.api.services.compute.model.Firewall

    publicAddress = machine.getNetworkPoint().getBestAddress(NetworkPoint.forPublicInternet());

    String serverLink = machine.getServerSelfLink();
    List<Firewall> rules = client.getInstanceFirewallRules(serverLink);

    Firewall matchingRule = findMatchingRule(rules);

    if (OpsContext.isConfigure()) {
      if (matchingRule == null) {
        Firewall rule = new Firewall();
        rule.setSourceRanges(Arrays.asList("0.0.0.0/0"));
        rule.setName("pl-" + UUID.randomUUID().toString());

        Allowed allowed = new Allowed();
        allowed.setIPProtocol("tcp");
        allowed.setPorts(Arrays.asList("" + model.publicPort));
        rule.setAllowed(Arrays.asList(allowed));

        rule.setNetwork(client.buildNetworkUrl("default"));

        client.createFirewallRule(rule);
      }
    }
View Full Code Here

Examples of com.google.api.services.compute.model.Firewall

    @Override
    public List<Resource> create(GccProvisionContextObject pO, int index, List<Resource> resources) throws Exception {
        Stack stack = stackRepository.findById(pO.getStackId());

        Firewall firewall = new Firewall();
        Firewall.Allowed allowed1 = new Firewall.Allowed();
        allowed1.setIPProtocol("tcp");
        allowed1.setPorts(ImmutableList.of("1-65535"));

        Firewall.Allowed allowed2 = new Firewall.Allowed();
        allowed2.setIPProtocol("icmp");

        Firewall.Allowed allowed3 = new Firewall.Allowed();
        allowed3.setIPProtocol("udp");
        allowed3.setPorts(ImmutableList.of("1-65535"));

        firewall.setAllowed(ImmutableList.of(allowed1, allowed2, allowed3));
        firewall.setName(stack.getName() + "in");
        firewall.setSourceRanges(ImmutableList.of("10.0.0.0/16"));
        firewall.setNetwork(String.format("https://www.googleapis.com/compute/v1/projects/%s/global/networks/%s",
                pO.getProjectId(), pO.filterResourcesByType(ResourceType.GCC_NETWORK).get(0).getResourceName()));
        Compute.Firewalls.Insert firewallInsert = pO.getCompute().firewalls().insert(pO.getProjectId(), firewall);
        firewallInsert.execute();
        return Arrays.asList(new Resource(resourceType(), stack.getName() + "in", stack));
    }
View Full Code Here

Examples of com.google.api.services.compute.model.Firewall

    @Override
    public List<Resource> create(GccProvisionContextObject pO, int index, List<Resource> resources) throws Exception {
        Stack stack = stackRepository.findById(pO.getStackId());

        Firewall firewall = new Firewall();
        Firewall.Allowed allowed1 = new Firewall.Allowed();
        allowed1.setIPProtocol("tcp");
        allowed1.setPorts(ImmutableList.of("1-65535"));

        Firewall.Allowed allowed2 = new Firewall.Allowed();
        allowed2.setIPProtocol("icmp");

        Firewall.Allowed allowed3 = new Firewall.Allowed();
        allowed3.setIPProtocol("udp");
        allowed3.setPorts(ImmutableList.of("1-65535"));

        firewall.setAllowed(ImmutableList.of(allowed1, allowed2, allowed3));
        firewall.setName(stack.getName() + "out");
        firewall.setSourceRanges(ImmutableList.of("0.0.0.0/0"));
        firewall.setNetwork(String.format("https://www.googleapis.com/compute/v1/projects/%s/global/networks/%s",
                pO.getProjectId(), pO.filterResourcesByType(ResourceType.GCC_NETWORK).get(0).getResourceName()));
        Compute.Firewalls.Insert firewallInsert = pO.getCompute().firewalls().insert(pO.getProjectId(), firewall);
        firewallInsert.execute();
        return Arrays.asList(new Resource(resourceType(), stack.getName() + "out", stack));
    }
View Full Code Here

Examples of org.apache.qpid.server.security.access.plugins.Firewall

        buf.close();

        // Configure plugin
        FirewallConfiguration config = new FirewallConfiguration();
        config.setConfiguration("", new XMLConfiguration(confFile));
        Firewall plugin = new Firewall();
        plugin.configure(config);
        return plugin;
    }
View Full Code Here

Examples of org.apache.qpid.server.security.access.plugins.Firewall

    }
   
    public void testDefaultAction() throws Exception
    {
        // Test simple deny
        Firewall plugin = initialisePlugin("deny");
        assertEquals(Result.DENIED, plugin.access(ObjectType.VIRTUALHOST, _address));

        // Test simple allow
        plugin = initialisePlugin("allow");
        assertEquals(Result.ALLOWED, plugin.access(ObjectType.VIRTUALHOST, _address));
    }
View Full Code Here

Examples of org.apache.qpid.server.security.access.plugins.Firewall

    {
        RuleInfo rule = new RuleInfo();
        rule.setAccess("allow");
        rule.setNetwork("192.168.23.23");
       
        Firewall plugin = initialisePlugin("deny", new RuleInfo[]{rule});

        assertEquals(Result.DENIED, plugin.access(ObjectType.VIRTUALHOST, _address));
       
        // Set IP so that we're connected from the right address
        _address = new InetSocketAddress("192.168.23.23", 65535);
        assertEquals(Result.ALLOWED, plugin.access(ObjectType.VIRTUALHOST, _address));
    }
View Full Code Here

Examples of org.apache.qpid.server.security.access.plugins.Firewall

    {
        RuleInfo rule = new RuleInfo();
        rule.setAccess("allow");
        rule.setNetwork("192.168.23.0/24");
       
        Firewall plugin = initialisePlugin("deny", new RuleInfo[]{rule});

        assertEquals(Result.DENIED, plugin.access(ObjectType.VIRTUALHOST, _address));
       
        // Set IP so that we're connected from the right address
        _address = new InetSocketAddress("192.168.23.23", 65535);
        assertEquals(Result.ALLOWED, plugin.access(ObjectType.VIRTUALHOST, _address));
    }
View Full Code Here

Examples of org.apache.qpid.server.security.access.plugins.Firewall

    {
        RuleInfo rule = new RuleInfo();
        rule.setAccess("allow");
        rule.setHostname(new InetSocketAddress("127.0.0.1", 5672).getHostName());
       
        Firewall plugin = initialisePlugin("deny", new RuleInfo[]{rule});

        // Set IP so that we're connected from the right address
        _address = new InetSocketAddress("127.0.0.1", 65535);
        assertEquals(Result.ALLOWED, plugin.access(ObjectType.VIRTUALHOST, _address));
    }
View Full Code Here

Examples of org.apache.qpid.server.security.access.plugins.Firewall

    {
        RuleInfo rule = new RuleInfo();
        rule.setAccess("allow");
        String hostname = new InetSocketAddress("127.0.0.1", 0).getHostName();
        rule.setHostname(".*"+hostname.subSequence(hostname.length() - 1, hostname.length())+"*");
        Firewall plugin = initialisePlugin("deny", new RuleInfo[]{rule});

        // Set IP so that we're connected from the right address
        _address = new InetSocketAddress("127.0.0.1", 65535);
        assertEquals(Result.ALLOWED, plugin.access(ObjectType.VIRTUALHOST, _address));
    }
View Full Code Here

Examples of org.apache.qpid.server.security.access.plugins.Firewall

        RuleInfo thirdRule = new RuleInfo();
        thirdRule.setAccess("deny");
        thirdRule.setHostname("localhost");
       
        Firewall plugin = initialisePlugin("deny", new RuleInfo[]{firstRule, secondRule, thirdRule});

        assertEquals(Result.DENIED, plugin.access(ObjectType.VIRTUALHOST, _address));
       
        // Set IP so that we're connected from the right address
        _address = new InetSocketAddress("192.168.23.23", 65535);
        assertEquals(Result.ALLOWED, plugin.access(ObjectType.VIRTUALHOST, _address));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.