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

ServerTlsContext: allow disabling verify peer name #112

Merged
merged 1 commit into from
Jan 19, 2025

Conversation

Thomas-Gelf
Copy link
Contributor

Motivation: servers accepting connections from trusted peers do not know the expected peer name in advance. Therefore, it must be possible to accept incoming connections (validating their client certificate) without being forced to specify an expected client name.

You do not need this when using amphp/socket to run your very own public web server, but it is a requirement when running every other kind of service based on trusted client certificates (with more than one client).

This patch tries to address this, while preserving compatibility with the current behaviour.

@Thomas-Gelf Thomas-Gelf force-pushed the fix/allow-to-verify-peer-wo-name branch 2 times, most recently from b18d6ca to 1ff27dc Compare August 5, 2024 10:44
Motivation: servers accepting connections from trusted peers do not know the
expected peer name in advance. Therefore, it must be possible to accept incoming
connections (validating their client certificate) without being forced to
specify an expected client name.

You do not need this when using amphp/socket to run your very own public web
server, but it is a requirement when running every other kind of service based
on trusted client certificates (with more than one client). Similar (but not the
same) use cases applies with clients, that should connect to trusted peers, w/o
knowing their name in advance.

This patch tries to address this, while preserving compatibility with the
current behaviour.
@Thomas-Gelf Thomas-Gelf force-pushed the fix/allow-to-verify-peer-wo-name branch from 1ff27dc to ff30eac Compare August 5, 2024 15:51
@Thomas-Gelf
Copy link
Contributor Author

Hint: with the last force-push I applied a similar patch for ClientTlsContext too. Faced this issue there too, and keeping them similar makes sense anyway.

@kelunik
Copy link
Member

kelunik commented Aug 5, 2024

How does your setup look like? How are the certificates validated?

@Thomas-Gelf
Copy link
Contributor Author

Hi @kelunik,

custom CA / trust store directory. Verify_peer rejects every connection not signed by a trusted CA. Peer names are not known at connection setup time, especially not on the server side - verify_peer_name is therefore a problem. Once verify_peer allowed connection setup, we grant dedicated permissions based on certificate subject/name or custom certificate extensions.

Cheers,
Thomas

@Thomas-Gelf
Copy link
Contributor Author

@kelunik: if you have related concerns/doubts or different opinions, please let me know

@trowski trowski merged commit 3754621 into amphp:2.x Jan 19, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants