From ebad190b637b1f669c8424378155800b91e03cca Mon Sep 17 00:00:00 2001 From: Sheppy Date: Sun, 1 Jan 2023 19:13:38 +0100 Subject: [PATCH] feat: ssh config for administrators --- main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.py b/main.py index a0ecfa1..1db9f5b 100644 --- a/main.py +++ b/main.py @@ -11,6 +11,8 @@ location /.well-known/acme-challenge/ { } ''' +MASTER_ADDRESS = "atlantishq.de" + if __name__ == "__main__": password = None @@ -100,3 +102,11 @@ if __name__ == "__main__": template = env.get_template("nsca_server.conf.j2") f.write(template.render(vmList=set(filter(lambda x: x.ansible, vmList)), password=password)) + + # dump direct connect ssh-config + with open("./ssh_config_for_clients", "w") as f: + for vmo in filter(lambda x: x.sshOutsidePort, set(vmList)): + f.write("Host {}\n".format(vmo.hostname + "." + MASTER_ADDRESS)) + f.write(" Port {}\n".format(vmo.sshOutsidePort)) + f.write(" User root\n") + f.write("\n")