1
0
mirror of https://github.com/laurivosandi/certidude synced 2025-10-31 01:19:11 +00:00

Add preliminary bootstrap API call

This commit is contained in:
2017-04-12 13:21:49 +00:00
parent 90b663ce26
commit 09724e04dc
6 changed files with 61 additions and 3 deletions

View File

@@ -190,6 +190,7 @@ def certidude_app():
from .cfg import ConfigResource, ScriptResource
from .tag import TagResource, TagDetailResource
from .attrib import AttributeResource
from .bootstrap import BootstrapResource
app = falcon.API(middleware=NormalizeMiddleware())
app.req_options.auto_parse_form_urlencoded = True
@@ -202,6 +203,7 @@ def certidude_app():
app.add_route("/api/request/{cn}/", RequestDetailResource())
app.add_route("/api/request/", RequestListResource())
app.add_route("/api/", SessionResource())
app.add_route("/api/bootstrap/", BootstrapResource())
# Extended attributes for scripting etc.
app.add_route("/api/signed/{cn}/attr/", AttributeResource())

View File

@@ -0,0 +1,14 @@
import logging
from certidude.decorators import serialize
from certidude.config import cp
from certidude import authority, config, const
from jinja2 import Template
logger = logging.getLogger(__name__)
class BootstrapResource(object):
def on_get(self, req, resp):
resp.body = Template(open(config.BOOTSTRAP_TEMPLATE).read()).render(
authority = const.FQDN,
servers = [cn for cn, path, buf, cert, server in authority.list_signed() if server])