Put private key out of config file, specify the path to the private key as a commandline argument
This commit is contained in:
parent
3ffc8d01b1
commit
00b73bfa46
2 changed files with 2 additions and 9 deletions
|
@ -84,12 +84,13 @@ if __name__ == "__main__":
|
||||||
# commandline arguments
|
# commandline arguments
|
||||||
argp = ArgumentParser()
|
argp = ArgumentParser()
|
||||||
argp.add_argument("config", type=Path, help="The path to the config file")
|
argp.add_argument("config", type=Path, help="The path to the config file")
|
||||||
|
argp.add_argument("pkey", type=Path, help="The path to the ssh private key")
|
||||||
args = argp.parse_args()
|
args = argp.parse_args()
|
||||||
# read config
|
# read config
|
||||||
config = yaml.safe_load(args.config.read_text())
|
config = yaml.safe_load(args.config.read_text())
|
||||||
config_host = str(config["host"])
|
config_host = str(config["host"])
|
||||||
config_port = int(config["port"])
|
config_port = int(config["port"])
|
||||||
config_private_key = asyncssh.import_private_key(config["private_key"])
|
config_private_key = asyncssh.import_private_key(args.pkey.read_text())
|
||||||
server_public_key = config_private_key.export_public_key("openssh").decode().strip("\n\r")
|
server_public_key = config_private_key.export_public_key("openssh").decode().strip("\n\r")
|
||||||
stderr.write(f"Server public key is \"{server_public_key}\"\n")
|
stderr.write(f"Server public key is \"{server_public_key}\"\n")
|
||||||
stderr.flush()
|
stderr.flush()
|
||||||
|
|
|
@ -5,11 +5,3 @@ clients:
|
||||||
# This are just examples. Please generate your own keypair for each client you want to add
|
# This are just examples. Please generate your own keypair for each client you want to add
|
||||||
example1: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFY33xLzFiLk5GnNu2Bm8Ns3TMSILtU6p1WItgy6sPMP
|
example1: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFY33xLzFiLk5GnNu2Bm8Ns3TMSILtU6p1WItgy6sPMP
|
||||||
example2: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMDV1fTeb7PiYVnqzGTQzdw5r3VPSaDFgfoPm1GD6HaR
|
example2: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMDV1fTeb7PiYVnqzGTQzdw5r3VPSaDFgfoPm1GD6HaR
|
||||||
private_key: | # Change this!!!
|
|
||||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
|
||||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
|
||||||
QyNTUxOQAAACDtzTutk/iImRHKDY2CBwoQab6BfE0ppM3/0wNVbvJEzgAAAJCANLL6gDSy
|
|
||||||
+gAAAAtzc2gtZWQyNTUxOQAAACDtzTutk/iImRHKDY2CBwoQab6BfE0ppM3/0wNVbvJEzg
|
|
||||||
AAAECpsT0qdquxr8MUe1zltF1ttE3Ean52CpYROv0WkOcmle3NO62T+IiZEcoNjYIHChBp
|
|
||||||
voF8TSmkzf/TA1Vu8kTOAAAACmp1bGlhbkBwYzEBAgM=
|
|
||||||
-----END OPENSSH PRIVATE KEY-----
|
|
||||||
|
|
Reference in a new issue