Easy CA management
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
757 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. #!/usr/bin/env python3
  2. import argparse
  3. import json
  4. from os import path
  5. def main(args):
  6. result_dict = {}
  7. result_dict['keyType'] = 'ssh_host'
  8. result_dict['hostName'] = args.host_name
  9. if path.exists(args.pub_key_path):
  10. with open(args.pub_key_path, 'r') as stream:
  11. key_data = stream.read().strip()
  12. else:
  13. key_data = args.pub_key_path
  14. result_dict['keyData'] = key_data
  15. request = { 'type': 'sign_request', 'request': result_dict }
  16. print(json.dumps(request))
  17. def get_parser():
  18. parser = argparse.ArgumentParser()
  19. parser.add_argument('pub_key_path')
  20. parser.add_argument('host_name')
  21. return parser
  22. if __name__ == '__main__':
  23. parser = get_parser()
  24. main(parser.parse_args())