Commit 1c815211 authored by Ulysse Beaugnon's avatar Ulysse Beaugnon

Remove some debug print

solve a bug in an SQL request
parent 99f1adfd
......@@ -127,8 +127,10 @@ class PeerManager:
p = subprocess.Popen(('openssl', 'rsautl', '-decrypt', '-inkey', self._key_path),
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
bootpeer = p.communicate(bootpeer)[0].split()
print bootpeer
print bootpeer[0]
if bootpeer[0] != self._prefix:
if self._db.execute("""SELECT COUNT(*) FROM blacklist.flag WHERE prefix = ?""" % bootpeer[0]).next() > 0:
if int(self._db.execute("""SELECT COUNT(*) FROM blacklist.flag WHERE prefix = ?""", (bootpeer[0],)).next()[0]) > 0:
logging.info('BootPeer is blacklisted')
return False
self._db.execute("INSERT INTO peers (prefix, address) VALUES (?,?)", bootpeer)
......
......@@ -92,9 +92,6 @@ class TunnelManager:
del self._iface_to_prefix[connection.iface]
logging.trace('Connection with %s/%u killed'
% (hex(int(prefix, 2))[2:], len(prefix)))
# DEBUG
print self._connection_dict
print self.free_interface_set
def _makeNewTunnels(self):
tunnel_to_make = self._client_count - len(self._connection_dict)
......@@ -107,9 +104,6 @@ class TunnelManager:
for prefix, address in self._peer_db.getUnusedPeers(tunnel_to_make):
logging.info('Establishing a connection with %s/%u' %
(hex(int(prefix, 2))[2:], len(prefix)))
# DEBUG
print self._connection_dict
print self.free_interface_set
iface = self.free_interface_set.pop()
self._connection_dict[prefix] = Connection(address,
self._write_pipe, self._hello, iface,
......@@ -118,9 +112,6 @@ class TunnelManager:
self._peer_db.usePeer(prefix)
i += 1
logging.trace('%u new tunnels established' % (i,))
# DEBUG
print self._connection_dict
print self.free_interface_set
except KeyError:
logging.warning("""Can't establish connection with %s
: no available interface""" % prefix)
......@@ -138,8 +129,6 @@ class TunnelManager:
if ip.startswith(self._network):
iface = line[-1]
# DEBUG
print line
subnet_size = int(line[1], 16)
logging.trace('Route on iface %s detected to %s/%s'
% (iface, ip, subnet_size))
......
......@@ -52,8 +52,9 @@ class Forwarder:
return (self._external_ip, str(external_port), proto)
def refresh(self):
print self._rules
logging.debug('Refreshing port forwarding')
for external_port, local_port, proto in self._rules:
self._u.addportmapping(external_port, proto, self._u.lanaddr,
local_port, 're6stnet openvpn server', '')
self.next_refresh = time.time() + 3600
self.next_refresh = time.time() + 100
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment