diff --git a/make_get_request.py b/make_get_request.py new file mode 100755 index 0000000..cc93cab --- /dev/null +++ b/make_get_request.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +import argparse +import json + + +def main(args): + result_dict = {} + result_dict['type'] = 'get_certificate' + result_dict['requestID'] = args.request_id + + print(json.dumps(result_dict)) + + +def get_parser(): + parser = argparse.ArgumentParser() + parser.add_argument('request_id') + + return parser + + +if __name__ == '__main__': + parser = get_parser() + main(parser.parse_args()) diff --git a/make_ssh_host_request.py b/make_ssh_host_request.py index 168ed95..33e2f73 100755 --- a/make_ssh_host_request.py +++ b/make_ssh_host_request.py @@ -14,7 +14,9 @@ def main(args): result_dict['keyData'] = key_data - print(json.dumps(result_dict)) + request = { 'type': 'sign_request', 'request': result_dict } + + print(json.dumps(request)) def get_parser(): diff --git a/make_ssh_user_request.py b/make_ssh_user_request.py index 808d17d..6b15498 100755 --- a/make_ssh_user_request.py +++ b/make_ssh_user_request.py @@ -15,7 +15,9 @@ def main(args): result_dict['keyData'] = key_data - print(json.dumps(result_dict)) + request = { 'type': 'sign_request', 'request': result_dict } + + print(json.dumps(request)) def get_parser(): diff --git a/request_server.py b/request_server.py index 0c9b495..51c44f7 100755 --- a/request_server.py +++ b/request_server.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import json import os.path import sys import time @@ -17,8 +18,10 @@ def exit_good(response): def exit_bad(reason): - response['status'] = 'error' - response['reason'] = reason + response = { + 'status': 'error', + 'reason': reason + } print(json.dumps(response)) sys.exit(0) @@ -55,7 +58,7 @@ def main(): with open(result_path, 'r') as stream: result_data = stream.read() - exit_good({ 'requestID': request_id, 'requestData': request_data }) + exit_good({ 'requestID': request_id, 'result': result_data }) else: exit_bad('unknown_type')