25 lines
723 B
Python
Executable File
25 lines
723 B
Python
Executable File
#!/usr/bin/env python
|
|
import argparse
|
|
import json
|
|
import requests
|
|
import sys
|
|
import uuid
|
|
|
|
parser = argparse.ArgumentParser(description="Get the CA's public keys from Tatu API.")
|
|
parser.add_argument('--projid', '-P', required=True)
|
|
parser.add_argument('--tatu-url', default= 'http://127.0.0.1:18322',
|
|
help='URL of the Tatu API')
|
|
args = parser.parse_args()
|
|
|
|
try:
|
|
auth_id = str(uuid.UUID(args.projid, version=4))
|
|
except:
|
|
print '--projid should be the UUID of a Tatu CA (usually a cloud tenant/project).'
|
|
exit()
|
|
|
|
server = args.tatu_url
|
|
response = requests.get(server + '/authorities/' + auth_id)
|
|
if response.status_code != 200:
|
|
print 'Failed to retrieve the CA keys.'
|
|
print response.content
|