Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init gnutls from ed keypair #39

Merged
merged 5 commits into from Sep 12, 2023
Merged

init gnutls from ed keypair #39

merged 5 commits into from Sep 12, 2023

Conversation

tewinget
Copy link
Collaborator

@tewinget tewinget commented Sep 5, 2023

Initialize GNUTLS creds from Ed keypair and confirm key allowed on incoming connection.

@tewinget tewinget marked this pull request as ready for review September 6, 2023 05:27
tests/008-ed-keys.cpp Outdated Show resolved Hide resolved
tests/008-ed-keys.cpp Outdated Show resolved Hide resolved
tests/008-ed-keys.cpp Outdated Show resolved Hide resolved
A GNUTLSCreds can now be initialized from a pair of Ed25519 seed/pubkey.

This enables using libquic in "raw public key" TLS mode, which is
useful/needed for Lokinet.

GNUTLS says it checks that the keys given match one another, but
it does not appear to do so.

This commit includes lokinet-specific ALPN code, as testing it in this
codebase is easier at the moment.  The ALPN specifics and Lokinet
specifics should be separated and the Lokinet specifics should move into
Lokinet.

GNUTLSCreds in raw pubkey mode accepts a verify callback which, given the
other side's public key and requested ALPN will determine whether the
connection should be allowed.

Use case for Lokinet:
  clients send the client ALPN during negotiation,
  relays send the relay ALPN on outbound, and
  relays set both for inbound.
  This is used to determine whether we are being connected to by
  a relay or a client, and check keys / setup lokinet accordingly.

if we need gnutls debug logs, we can set
GNUTLS_DEBUG_LEVEL=level (0-99, >10 is full verbosity it seems)
and gnutls will log to stderr
the lokinet-specific ALPN logic should be divorced from libquic, but for now
it is working; that can be changed later.
ALPN handling in raw public key mode is now handled generically,
rather than having Lokinet-specific concepts.  In future, it will be
easy to have ALPN handling for any mode, not just raw pubkey, but for
now that is not necessary as we do not use ALPNs with normal certs.
@dr7ana dr7ana merged commit 16cba39 into oxen-io:dev Sep 12, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants