mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-02-14 09:30:59 +01:00
Import resolvconf_nameservers, fix wrong types
Add resolvconf_nameservers to the list of functions imported from helpers. Fixed an instance where the method client.main was being called with ns_hosts (string obtained from optional argument --ns-hosts) instead of nslist (list of tuples that was already being passed to other methods). Should fix issue #24.
This commit is contained in:
parent
28be71ef9a
commit
a82224c141
@ -11,7 +11,8 @@ import ssh
|
|||||||
import ssyslog
|
import ssyslog
|
||||||
import sys
|
import sys
|
||||||
from ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper
|
from ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper
|
||||||
from helpers import log, debug1, debug2, debug3, Fatal, islocal
|
from helpers import log, debug1, debug2, debug3, Fatal, islocal, \
|
||||||
|
resolvconf_nameservers
|
||||||
|
|
||||||
recvmsg = None
|
recvmsg = None
|
||||||
try:
|
try:
|
||||||
@ -277,18 +278,17 @@ class MultiListener:
|
|||||||
class FirewallClient:
|
class FirewallClient:
|
||||||
|
|
||||||
def __init__(self, port_v6, port_v4, subnets_include, subnets_exclude,
|
def __init__(self, port_v6, port_v4, subnets_include, subnets_exclude,
|
||||||
dnsport_v6, dnsport_v4, ns_hosts, method, udp):
|
dnsport_v6, dnsport_v4, nslist, method, udp):
|
||||||
self.auto_nets = []
|
self.auto_nets = []
|
||||||
self.subnets_include = subnets_include
|
self.subnets_include = subnets_include
|
||||||
self.subnets_exclude = subnets_exclude
|
self.subnets_exclude = subnets_exclude
|
||||||
self.ns_hosts = ns_hosts
|
|
||||||
argvbase = ([sys.argv[1], sys.argv[0], sys.argv[1]] +
|
argvbase = ([sys.argv[1], sys.argv[0], sys.argv[1]] +
|
||||||
['-v'] * (helpers.verbose or 0) +
|
['-v'] * (helpers.verbose or 0) +
|
||||||
['--firewall', str(port_v6), str(port_v4),
|
['--firewall', str(port_v6), str(port_v4),
|
||||||
str(dnsport_v6), str(dnsport_v4),
|
str(dnsport_v6), str(dnsport_v4),
|
||||||
method, str(int(udp))])
|
method, str(int(udp))])
|
||||||
if dnsport_v4 or dnsport_v6:
|
if dnsport_v4 or dnsport_v6:
|
||||||
argvbase += ['--ns-hosts', ns_hosts]
|
argvbase += ['--ns-hosts', ' '.join([ip for _, ip in nslist])]
|
||||||
if ssyslog._p:
|
if ssyslog._p:
|
||||||
argvbase += ['--syslog']
|
argvbase += ['--syslog']
|
||||||
argv_tries = [
|
argv_tries = [
|
||||||
@ -602,7 +602,7 @@ def _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename,
|
|||||||
|
|
||||||
|
|
||||||
def main(listenip_v6, listenip_v4,
|
def main(listenip_v6, listenip_v4,
|
||||||
ssh_cmd, remotename, python, latency_control, dns, ns_hosts,
|
ssh_cmd, remotename, python, latency_control, dns, nslist,
|
||||||
method, seed_hosts, auto_nets,
|
method, seed_hosts, auto_nets,
|
||||||
subnets_include, subnets_exclude, syslog, daemon, pidfile):
|
subnets_include, subnets_exclude, syslog, daemon, pidfile):
|
||||||
|
|
||||||
@ -698,9 +698,9 @@ def main(listenip_v6, listenip_v4,
|
|||||||
udp_listener.print_listening("UDP redirector")
|
udp_listener.print_listening("UDP redirector")
|
||||||
|
|
||||||
bound = False
|
bound = False
|
||||||
if dns or ns_hosts:
|
if dns or nslist:
|
||||||
if dns:
|
if dns:
|
||||||
ns_hosts += resolvconf_nameservers()
|
nslist += resolvconf_nameservers()
|
||||||
# search for spare port for DNS
|
# search for spare port for DNS
|
||||||
debug2('Binding DNS:')
|
debug2('Binding DNS:')
|
||||||
ports = xrange(12300, 9000, -1)
|
ports = xrange(12300, 9000, -1)
|
||||||
@ -740,10 +740,9 @@ def main(listenip_v6, listenip_v4,
|
|||||||
dnsport_v6 = 0
|
dnsport_v6 = 0
|
||||||
dnsport_v4 = 0
|
dnsport_v4 = 0
|
||||||
dns_listener = None
|
dns_listener = None
|
||||||
ns_hosts = []
|
|
||||||
|
|
||||||
fw = FirewallClient(redirectport_v6, redirectport_v4, subnets_include,
|
fw = FirewallClient(redirectport_v6, redirectport_v4, subnets_include,
|
||||||
subnets_exclude, dnsport_v6, dnsport_v4, ns_hosts,
|
subnets_exclude, dnsport_v6, dnsport_v4, nslist,
|
||||||
method, udp)
|
method, udp)
|
||||||
|
|
||||||
if fw.method == "tproxy":
|
if fw.method == "tproxy":
|
||||||
|
@ -215,7 +215,7 @@ try:
|
|||||||
opt.python,
|
opt.python,
|
||||||
opt.latency_control,
|
opt.latency_control,
|
||||||
opt.dns,
|
opt.dns,
|
||||||
opt.ns_hosts,
|
nslist,
|
||||||
method,
|
method,
|
||||||
sh,
|
sh,
|
||||||
opt.auto_nets,
|
opt.auto_nets,
|
||||||
|
Loading…
Reference in New Issue
Block a user