Don't create tor service for CLI apps

This commit is contained in:
Taylor Helsper 2022-12-30 18:49:53 -06:00
parent 08fb786d5b
commit 9a4e3804b8

View File

@ -628,19 +628,25 @@ def create_application_folders(app_data):
run_linux_cmd("chown -R {}:{} {}".format(app_data["linux_user"], app_data["linux_user"], data_folder))
def create_application_tor_service(app_data):
has_ports = False
run_linux_cmd("mkdir -p /etc/torrc.d")
torrc_file = "/etc/torrc.d/"+app_data["short_name"]
with open(torrc_file, "w") as f:
f.write("# Hidden Service for {}\n".format(app_data["short_name"]))
f.write("HiddenServiceDir /var/lib/tor/mynode_{}/\n".format(app_data["short_name"]))
f.write("HiddenServiceVersion 3\n")
if "http_port" in app_data and app_data["http_port"] != None:
f.write("HiddenServicePort 80 127.0.0.1:{}\n".format(app_data["http_port"]))
if "http_port" in app_data and app_data["http_port"] != None:
f.write("HiddenServicePort 443 127.0.0.1:{}\n".format(app_data["https_port"]))
if "extra_ports" in app_data and app_data["extra_ports"] != None:
for p in app_data["extra_ports"]:
f.write("HiddenServicePort {} 127.0.0.1:{}\n".format(p, p))
contents = "# Hidden Service for {}\n".format(app_data["short_name"])
contents += "HiddenServiceDir /var/lib/tor/mynode_{}/\n".format(app_data["short_name"])
if "http_port" in app_data and app_data["http_port"] != None:
contents += "HiddenServicePort 80 127.0.0.1:{}\n".format(app_data["http_port"])
has_ports = True
if "http_port" in app_data and app_data["http_port"] != None:
contents += "HiddenServicePort 443 127.0.0.1:{}\n".format(app_data["https_port"])
has_ports = True
if "extra_ports" in app_data and app_data["extra_ports"] != None:
for p in app_data["extra_ports"]:
contents += "HiddenServicePort {} 127.0.0.1:{}\n".format(p, p)
has_ports = True
if has_ports:
with open(torrc_file, "w") as f:
f.write(contents)
def install_application_tarball(app_data):
log_message(" Running install_application_tarball...")