def pair(self, env): uuid = env['mapper.vault'] if not uuid4.check(uuid): raise HTTPReturn(http.NOT_FOUND) model = instance(Model) vault = model.get_vault(uuid) if not vault: raise HTTPReturn(http.NOT_FOUND) self._do_auth_hmac_cb(uuid) # Sign the certificate request that was sent to tus certinfo = self.entity if not certinfo or not isinstance(certinfo, dict): raise HTTPReturn(http.BAD_REQUEST) model.create_certificate(uuid, certinfo) # And send our own certificate request in return certinfo = { 'node': vault['node'], 'name': util.gethostname() } certinfo['keys'] = model.get_public_keys(vault['id']) return certinfo
def _get_hostname(self): name = util.gethostname() pos = name.find('.') if pos != -1: name = name[:pos] return name