summaryrefslogtreecommitdiffstats
path: root/retiolum/hosts
diff options
context:
space:
mode:
authorLassulus <Lassulus@googlemail.com>2011-05-12 14:57:52 +0200
committerLassulus <Lassulus@googlemail.com>2011-05-12 14:57:52 +0200
commitd792415a020c92cd0069fba7f3b09b4eec6e2d2b (patch)
tree4474a5bd0f0ee55eb45de60c300a13e8624e6686 /retiolum/hosts
parent86c168daa801b30829f62b6b7f633363fad10345 (diff)
fixed debug error
Diffstat (limited to 'retiolum/hosts')
-rwxr-xr-xretiolum/hosts/.scripts/retiolum.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/retiolum/hosts/.scripts/retiolum.py b/retiolum/hosts/.scripts/retiolum.py
index 05123692..f03e0875 100755
--- a/retiolum/hosts/.scripts/retiolum.py
+++ b/retiolum/hosts/.scripts/retiolum.py
@@ -3,8 +3,11 @@ import sys, os, time, socket, subprocess, thread, random, Queue, binascii, loggi
from optparse import OptionParser
def pub_encrypt(netname, hostname_t, text): #encrypt data with public key
- enc_text = subprocess.os.popen("echo '" + text + "' | openssl rsautl -pubin -inkey /etc/tinc/" + netname + "/hosts/.pubkeys/" + hostname_t + " -encrypt | base64")
- return(enc_text.read())
+ try:
+ enc_text = subprocess.os.popen("echo '" + text + "' | openssl rsautl -pubin -inkey /etc/tinc/" + netname + "/hosts/.pubkeys/" + hostname_t + " -encrypt | base64")
+ return(enc_text.read())
+ except:
+ return(-1)
def priv_decrypt(netname, enc_data): #decrypt data with private key
dec_text = subprocess.os.popen("echo '" + enc_data + "' | base64 -d | openssl rsautl -inkey /etc/tinc/" + netname + "/rsa_key.priv -decrypt")
@@ -150,7 +153,7 @@ def recvthread(netname, hostname, timeoutfifo, authfifo): #recieves input from m
if dataval[3] != hostname:
authfifo.put([dataval[1], dataval[3], ip, dataval[4]])
logging.info("recv: got Stage3: writing data to auth")
- logging.debug("recv: ;" + gdataval[1] + ";" + dataval[3] + ";" + ip + ";" + dataval[4])
+ logging.debug("recv: ;" + dataval[1] + ";" + dataval[3] + ";" + ip + ";" + dataval[4])
except:
logging.error("recv: socket init failed")
time.sleep(10)
@@ -169,7 +172,7 @@ def timeoutthread(netname, timeoutfifo, authfifo): #checks if the hostname is al
line = findhostinlist(hostslist, curhost[1], curhost[2])
if line != -1:
hostslist[line][2] = time.time()
- logging.debug("timeout: refreshing timestamp")
+ logging.debug("timeout: refreshing timestamp of " + hostslist[line][0])
else:
authfifo.put(["Stage1", curhost[1], curhost[2]])
logging.info("timeout: writing to auth")