def unroute_to_localhost(self, ip): logging.getLogger("gigalixir-cli").info("Cleaning up iptables") logging.getLogger("gigalixir-cli").info( "If prompted, please enter your sudo password:"******"sudo iptables -t nat -D OUTPUT -p all -d %(ip)s -j DNAT --to-destination 127.0.0.1" % {"ip": ip})
def route_to_localhost(self, ip, epmd_port, distribution_port): logging.getLogger("gigalixir-cli").info("Setting up iptables") logging.getLogger("gigalixir-cli").info( "If prompted, please enter your sudo password:"******"sudo iptables -t nat -L OUTPUT") cast( "sudo iptables -t nat -A OUTPUT -p all -d %(ip)s -j DNAT --to-destination 127.0.0.1" % {"ip": ip})
def route_to_localhost(self, ip): """ It's not great that we use "from any to any". It would be better to use from any to 10.244.7.124, but when I do that, erl fails to startup with Protocol 'inet_tcp': register/listen error: etimedout My guess is, it's trying to find epmd to register itself, but can't due to something in this file. """ ps = subprocess.Popen(('echo', """ rdr pass on lo0 inet proto tcp from any to any port 4369 -> 127.0.0.1 port 4369 rdr pass on lo0 inet proto tcp from any to 10.244.7.124 port 36606 -> 127.0.0.1 port 36606 """), stdout=subprocess.PIPE) subprocess.call(('sudo', 'pfctl', '-ef', '-'), stdin=ps.stdout) ps.wait() cast("sudo ifconfig lo0 10.244.7.124 netmask 255.255.255.255 alias")
def route_to_localhost(self, ip, epmd_port, distribution_port): """ It's not great that we use "from any to any". It would be better to use from any to 10.244.7.124, but when I do that, erl fails to startup with Protocol 'inet_tcp': register/listen error: etimedout My guess is, it's trying to find epmd to register itself, but can't due to something in this file. """ logging.getLogger("gigalixir-cli").info("Setting up pfctl") logging.getLogger("gigalixir-cli").info("If prompted, please enter your sudo password:"******""" rdr pass on lo0 inet proto tcp from any to any port %s -> 127.0.0.1 port %s rdr pass on lo0 inet proto tcp from any to %s port %s -> 127.0.0.1 port %s """ % (epmd_port, epmd_port, ip, distribution_port, distribution_port)), stdout=subprocess.PIPE) subprocess.call(('sudo', 'pfctl', '-ef', '-'), stdin=ps.stdout) ps.wait() cast("sudo ifconfig lo0 %s netmask 255.255.255.255 alias" % ip)
def open(self, url): logging.getLogger("gigalixir-cli").info("Running: open %s" % url) cast("open %s" % url)
def unroute_to_localhost(self, ip): cast("sudo ifconfig lo0 10.244.7.124 netmask 255.255.255.255 -alias") subprocess.call("sudo pfctl -ef /etc/pf.conf".split())
def unroute_to_localhost(self, ip): logging.getLogger("gigalixir-cli").info("Cleaning up pfctl") logging.getLogger("gigalixir-cli").info( "If prompted, please enter your sudo password:"******"sudo ifconfig lo0 %s netmask 255.255.255.255 -alias" % ip) subprocess.call("sudo pfctl -ef /etc/pf.conf".split())
def route_to_localhost(self, ip, epmd_port, distribution_port): # NOTE: Untested as multiplexing not supported on platform logging.getLogger("gigalixir-cli").info("Setting up route") cast("route ADD %s MASK 255.255.255.255 127.0.0.1" % ip)
def unroute_to_localhost(self, ip): # NOTE: Untested as multiplexing not supported on platform logging.getLogger("gigalixir-cli").info("Cleaning up route") cast("route delete %s" % ip)
def route_to_localhost(self, ip): # cast("sudo iptables -t nat -L OUTPUT") cast( "sudo iptables -t nat -A OUTPUT -p all -d %(ip)s -j DNAT --to-destination 127.0.0.1" % {"ip": ip})