def drop_data_to_bucket_from_eventing(self,server): shell = RemoteMachineShellConnection(server) shell.info = shell.extract_remote_info() if shell.info.type.lower() == "windows": raise Exception("Should not run on windows") o, r = shell.execute_command("/sbin/iptables -A OUTPUT -p tcp --dport 11210 -j DROP") shell.log_command_output(o, r) # o, r = shell.execute_command("/sbin/iptables -A INPUT -p tcp --dport 11210 -j DROP") # shell.log_command_output(o, r) log.info("enabled firewall on {0}".format(server)) o, r = shell.execute_command("/sbin/iptables --list") shell.log_command_output(o, r) shell.disconnect()
def reset_firewall(self,server): shell = RemoteMachineShellConnection(server) shell.info = shell.extract_remote_info() o, r = shell.execute_command("/sbin/iptables --flush") shell.log_command_output(o, r) shell.disconnect()