Examples of FirewallManager


Examples of io.fabric8.service.jclouds.firewall.FirewallManager

        options.getSystemProperties().put(ContainerProviderUtils.ADDRESSES_PROPERTY_KEY, addresses);
        options.getMetadataMap().put(containerName, jCloudsContainerMetadata);

        //Setup firwall for node
        try {
            FirewallManager firewallManager = firewallManagerFactory.getFirewallManager(computeService);
            if (firewallManager.isSupported()) {
                listener.onStateChange("Configuring firewall.");
                String source = getOriginatingIp();

                Rule httpRule = Rule.create().source("0.0.0.0/0").destination(nodeMetadata).port(8181);
                firewallManager.addRules(httpRule);

                if (source != null) {
                    Rule jmxRule = Rule.create().source(source).destination(nodeMetadata).ports(44444, 1099);
                    Rule sshRule = Rule.create().source(source).destination(nodeMetadata).port(8101);
                    Rule zookeeperRule = Rule.create().source(source).destination(nodeMetadata).port(2181);
                    firewallManager.addRules(jmxRule, sshRule, zookeeperRule);
                }
                //We do add the target node public address to the firewall rules, as a way to make things easier in cases
                //where firewall configuration is shared among nodes of the same groups, e.g. EC2.
                if (!Strings.isNullOrEmpty(publicAddress)) {
                    Rule zookeeperFromTargetRule = Rule.create().source(publicAddress + "/32").destination(nodeMetadata).port(2181);
                    firewallManager.addRule(zookeeperFromTargetRule);
                }
            } else {
                listener.onStateChange(String.format("Skipping firewall configuration. Not supported for provider %s", options.getProviderName()));
            }
        } catch (FirewallNotSupportedOnProviderException e) {
View Full Code Here

Examples of io.fabric8.service.jclouds.firewall.FirewallManager

        assertValid();
        ApiFirewallSupport firewallSupport = findApiFirewallSupport(computeService);
        if (firewallSupport == null) {
            throw new FirewallNotSupportedOnProviderException("Service is currently not supported for firewall operations");
        }
        FirewallManager firewallManager = new FirewallManager(computeService, firewallSupport);
        return firewallManager;
    }
View Full Code Here

Examples of io.fabric8.service.jclouds.firewall.FirewallManager

            if (computeService == null) {
                return null;

            }
            Set<String> sourceCidrs = collectCirds();
            FirewallManager firewallManager = firewallManagerFactory.getFirewallManager(computeService);

            NodeMetadata node = null;

            if (!Strings.isNullOrEmpty(targetContainerName) && getCurator().getZookeeperClient().isConnected() && fabricService != null) {
               CreateJCloudsContainerMetadata metadata = getContainerCloudMetadata(targetContainerName);
               if (metadata != null && !Strings.isNullOrEmpty(metadata.getNodeId())) {
                   targetNodeId = metadata.getNodeId();
               }
            }

            if (!Strings.isNullOrEmpty(targetNodeId)) {
              node = computeService.getNodeMetadata(targetNodeId);
            }

            if (node == null) {
                System.err.println("Could not find target node. Make sure you specified either --target-node-id or --target-container using a valid cloud container.");
                return null;
            }
            if (flush) {
                firewallManager.addRule(Rule.create().destination(node).flush());
                return null;
            }
            for (String cidr : sourceCidrs) {
                Rule rule = Rule.create().destination(node).source(cidr);

                if (port != null && port.length > 0) {
                    rule = rule.ports(port);
                }
                if (revoke) {
                    firewallManager.addRule(rule.revoke());
                } else {
                    firewallManager.addRule(rule);
                }
            }
        }
        return null;
    }
View Full Code Here

Examples of org.apache.whirr.service.FirewallManager

        continue; // skip execution if this group of instances is not in target
      }
      StatementBuilder statementBuilder = new StatementBuilder();

      ComputeServiceContext computeServiceContext = getCompute().apply(clusterSpec);
      FirewallManager firewallManager = new FirewallManager(
          computeServiceContext, clusterSpec, newCluster);

      VelocityEngine velocityEngine = TemplateUtils.newVelocityEngine();

      ClusterActionEvent event = new ClusterActionEvent(getAction(), clusterSpec,
View Full Code Here

Examples of org.apache.whirr.service.FirewallManager

      "10.0.0.1",
      region + "/i-dummy",
      null
    ));

    manager = new FirewallManager(context, clusterSpec, new Cluster(instances));
  }
View Full Code Here

Examples of org.apache.whirr.service.FirewallManager

        continue; // skip execution if this group of instances is not in target
      }
      StatementBuilder statementBuilder = new StatementBuilder();

      ComputeServiceContext computeServiceContext = getCompute().apply(clusterSpec);
      FirewallManager firewallManager = new FirewallManager(
          computeServiceContext, clusterSpec, newCluster);

      VelocityEngine velocityEngine = TemplateUtils.newVelocityEngine();

      ClusterActionEvent event = new ClusterActionEvent(getAction(), clusterSpec,
View Full Code Here

Examples of org.apache.whirr.service.FirewallManager

      "10.0.0.1",
      region + "/i-dummy",
      null
    ));

    manager = new FirewallManager(context, clusterSpec, new Cluster(instances));
  }
View Full Code Here

Examples of org.apache.whirr.service.FirewallManager

    Cluster newCluster = cluster;
    for (InstanceTemplate instanceTemplate : clusterSpec.getInstanceTemplates()) {
      StatementBuilder statementBuilder = new StatementBuilder();

      ComputeServiceContext computServiceContext = getCompute().apply(clusterSpec);
      FirewallManager firewallManager = new FirewallManager(computServiceContext,
          clusterSpec, newCluster);

      ClusterActionEvent event = new ClusterActionEvent(getAction(),
          clusterSpec, newCluster, statementBuilder, getCompute(), firewallManager);
View Full Code Here

Examples of org.apache.whirr.service.FirewallManager

    for (InstanceTemplate instanceTemplate : clusterSpec.getInstanceTemplates()) {
      StatementBuilder statementBuilder = new StatementBuilder();

      ComputeServiceContext computeServiceContext = getCompute().apply(
          clusterSpec);
      FirewallManager firewallManager = new FirewallManager(
          computeServiceContext, clusterSpec, newCluster);

      ClusterActionEvent event = new ClusterActionEvent(getAction(),
          clusterSpec, instanceTemplate, newCluster, statementBuilder,
          getCompute(), firewallManager);
View Full Code Here

Examples of org.apache.whirr.service.FirewallManager

      "10.0.0.1",
      region + "/i-dummy",
      null
    ));

    manager = new FirewallManager(context, clusterSpec, new Cluster(instances));
  }
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.