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.

34 lines
764 B

9 years ago
9 years ago
9 years ago
  1. #!/usr/bin/env python3
  2. import argparse
  3. import json
  4. def main(args):
  5. result_dict = {}
  6. result_dict['keyType'] = 'ssh_user'
  7. result_dict['rootRequested'] = args.root_access
  8. result_dict['userName'] = args.user_name
  9. with open(args.pub_key_path, 'r') as stream:
  10. key_data = stream.read().strip()
  11. result_dict['keyData'] = key_data
  12. request = { 'type': 'sign_request', 'request': result_dict }
  13. print(json.dumps(request))
  14. def get_parser():
  15. parser = argparse.ArgumentParser()
  16. parser.add_argument('pub_key_path')
  17. parser.add_argument('user_name')
  18. parser.add_argument('-r', '--root-access', action='store_true')
  19. return parser
  20. if __name__ == '__main__':
  21. parser = get_parser()
  22. main(parser.parse_args())