From 5b545d000ffd97a2ed5daf9679c0d4d497a11306 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 28 Apr 2019 02:06:13 +0200 Subject: [PATCH] change only tls if needed --- home.admin/config.scripts/internet.sshtunnel.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/home.admin/config.scripts/internet.sshtunnel.py b/home.admin/config.scripts/internet.sshtunnel.py index 0854f7c..8cb3e36 100755 --- a/home.admin/config.scripts/internet.sshtunnel.py +++ b/home.admin/config.scripts/internet.sshtunnel.py @@ -156,11 +156,19 @@ if sys.argv[1] == "on": file_content = re.sub("sshtunnel=.*", "sshtunnel='%s %s'" % (ssh_server, ssh_ports), file_content) if restoringOnUpdate == False: serverdomain=ssh_server.split("@")[1] + # make sure serverdomain is set as tls alias - print("Setting server as tls alias and generating new certs") + print("Setting server as tls alias") + oldConfigHash=subprocess.getoutput("sudo shasum -a 256 /mnt/hdd/lnd/tls.cert") subprocess.call("sudo sed -i \"s/^#tlsextradomain=.*/tlsextradomain=/g\" /mnt/hdd/lnd/lnd.conf", shell=True) subprocess.call("sudo sed -i \"s/^tlsextradomain=.*/tlsextradomain=%s/g\" /mnt/hdd/lnd/lnd.conf" % (serverdomain), shell=True) - subprocess.call("sudo /home/admin/config.scripts/lnd.newtlscert.sh", shell=True) + newConfigHash=subprocess.getoutput("sudo shasum -a 256 /mnt/hdd/lnd/tls.cert") + if oldConfigHash != newConfigHash: + print("lnd.conf changed ... generating new TLS cert") + subprocess.call("sudo /home/admin/config.scripts/lnd.newtlscert.sh", shell=True) + else: + print("lnd.conf unchanged... keep TLS cert") + if forwardingLND: # setting server explicitly on LND if LND port is forwarded print("Setting server domain for LND Port")