Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Adding Eureka Service Discovery to Keyserver #264

Merged
merged 22 commits into from
Mar 16, 2018
Merged

Conversation

blankdots
Copy link

The keyserver needs to play an extended role, thus we made it register with Eureka Service Discovery.

We don't use a library we instead follow the specification from https://github.com/Netflix/eureka/wiki/Eureka-REST-operations

The keyserver does not fail it there is no connection to Eureka Service discovery.
We provided a fake eureka server just to test that the Keyserver can indeed make the required requests for registration and renewing of lease.

This PR also integrates the RSA key encryption, as we don't want to keep the RSA key unprotected.

@blankdots blankdots requested a review from silverdaz March 16, 2018 13:42
@silverdaz silverdaz added this to the Sprint 25 milestone Mar 16, 2018
asyncio.TimeoutError) as e:
LOG.debug(f"Eureka connection error: {e!r}")
LOG.debug(f"Retrying in {backoff} seconds")
asyncio.sleep(backoff)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not this be awaited? (which could be also updated in db.py#L61)

LOG.error("Could not connect to the Eureka.")
pass
# We don't fail right away as we expect the keysever to continue
# Under "normal deployment" this should exit ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so.
Probably, it should try again later.

async with aiohttp.ClientSession(headers=self._headers) as session:
async with session.put(url) as resp:
LOG.debug('Eureka out_of_service status response %s' % resp.status)
await session.close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The session is closed already by the context manager (ie, at the end of the with statement)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented them out and tried. It seem to be ok.

Frédéric Haziza added 3 commits March 16, 2018 17:35
Moreover, we add [cega-users]/pgp/{username} on the fake cega-users
server, to retrieve the PGP public key of a given user, as if we read
the public key from file.
@silverdaz
Copy link
Contributor

There are now 2 more temporary endpoints:

  • [keyserver-url]/temp/rsa/{key_id} to retrieve the unprotected RSA key
  • [cega-users-url]/pgp/{username} to retrieve the user's PGP public key (ASCII-armored)

@silverdaz silverdaz merged commit 72b9f5d into dev Mar 16, 2018
@silverdaz silverdaz deleted the feature/keyserver branch March 16, 2018 17:17
viklund pushed a commit that referenced this pull request Nov 22, 2018
Adding Eureka Service Discovery to Keyserver
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants