Beispiel #1
0
    def do():
        logging.info("Going to drop packets from %s for %d seconds..." %
                     (repr(daemons), seconds))

        # Figure out what ports the daemons are listening on
        all_ports = []
        for daemon in daemons:
            pid = procutils.find_jvm(daemon)
            if not pid:
                logging.warn("Daemon %s not running!" % daemon)
                continue
            ports = procutils.get_listening_ports(pid)
            logging.info("%s is listening on ports: %s" %
                         (daemon, repr(ports)))
            all_ports.extend(ports)

        if not all_ports:
            logging.warn("No ports found for daemons: %s. Skipping fault." %
                         repr(daemons))
            return

        # Set up a chain to drop the packets
        chain = iptables.create_gremlin_chain(all_ports)
        logging.info("Created iptables chain: %s" % chain)
        iptables.add_user_chain_to_input_chain(chain)

        logging.info("Gremlin chain %s installed, sleeping %d seconds" %
                     (chain, seconds))
        time.sleep(seconds)

        logging.info("Removing gremlin chain %s" % chain)
        iptables.remove_user_chain_from_input_chain(chain)
        iptables.delete_user_chain(chain)
        logging.info("Removed gremlin chain %s" % chain)
Beispiel #2
0
  def do():
    logging.info("Going to drop packets from %s for %d seconds..." %
                 (repr(daemons), seconds))

    # Figure out what ports the daemons are listening on
    all_ports = []
    for daemon in daemons:
      pid = procutils.find_jvm(daemon)
      if not pid:
        logging.warn("Daemon %s not running!" % daemon)
        continue
      ports = procutils.get_listening_ports(pid)
      logging.info("%s is listening on ports: %s" % (daemon, repr(ports)))
      all_ports.extend(ports)

    if not all_ports:
      logging.warn("No ports found for daemons: %s. Skipping fault." % repr(daemons))
      return

    # Set up a chain to drop the packets
    chain = iptables.create_gremlin_chain(all_ports)
    logging.info("Created iptables chain: %s" % chain)
    iptables.add_user_chain_to_input_chain(chain)

    logging.info("Gremlin chain %s installed, sleeping %d seconds" % (chain, seconds))
    time.sleep(seconds)

    logging.info("Removing gremlin chain %s" % chain)
    iptables.remove_user_chain_from_input_chain(chain)
    iptables.delete_user_chain(chain)
    logging.info("Removed gremlin chain %s" % chain)
Beispiel #3
0
    def do():
        logging.info(
            "Going to drop all networking (save ssh with %s) for %d seconds..."
            % (bastion_host, seconds))
        # TODO check connectivity, or atleast DNS resolution, for bastion_host
        chains = iptables.create_gremlin_network_failure(bastion_host)
        logging.info("Created iptables chains: %s" % repr(chains))
        iptables.add_user_chain_to_input_chain(chains[0])
        iptables.add_user_chain_to_output_chain(chains[1])

        logging.info("Gremlin chains %s installed, sleeping %d seconds" %
                     (repr(chains), seconds))
        time.sleep(seconds)

        if use_flush:
            logging.info("Using flush to remove gremlin chains")
            iptables.flush()
        else:
            logging.info("Removing gremlin chains %s" % repr(chains))
            iptables.remove_user_chain_from_input_chain(chains[0])
            iptables.remove_user_chain_from_output_chain(chains[1])
        iptables.delete_user_chain(chains[0])
        iptables.delete_user_chain(chains[1])
        logging.info("Removed gremlin chains %s" % repr(chains))
        if restart_daemons:
            logging.info("Restarting daemons: %s", repr(restart_daemons))
            for daemon in restart_daemons:
                procutils.start_daemon(daemon)
Beispiel #4
0
  def do():
    logging.info("Going to drop all networking (save ssh with %s) for %d seconds..." %
                 (bastion_host, seconds))
    # TODO check connectivity, or atleast DNS resolution, for bastion_host
    chains = iptables.create_gremlin_network_failure(bastion_host)
    logging.info("Created iptables chains: %s" % repr(chains))
    iptables.add_user_chain_to_input_chain(chains[0])
    iptables.add_user_chain_to_output_chain(chains[1])

    logging.info("Gremlin chains %s installed, sleeping %d seconds" % (repr(chains), seconds))
    time.sleep(seconds)

    if use_flush:
      logging.info("Using flush to remove gremlin chains")
      iptables.flush()
    else:
      logging.info("Removing gremlin chains %s" % repr(chains))
      iptables.remove_user_chain_from_input_chain(chains[0])
      iptables.remove_user_chain_from_output_chain(chains[1])
    iptables.delete_user_chain(chains[0])
    iptables.delete_user_chain(chains[1])
    logging.info("Removed gremlin chains %s" % repr(chains))
    if restart_daemons:
      logging.info("Restarting daemons: %s", repr(restart_daemons))
      for daemon in restart_daemons:
        procutils.start_daemon(daemon)