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

tls_openssl: only verify client certs if configured to require them #3281

Closed
wants to merge 1 commit into from

Conversation

jes
Copy link
Contributor

@jes jes commented Jan 5, 2024

Summary
If you want opensips to verify server certs you have to enable verify_cert, but this also implicitly makes it verify client certs, when presented, even if you don't have require_client_cert enabled.

Details

There was previously no way to configure opensips to verify server certs without having it also verify client certs, even if you configured it to make client certs optional!

Solution

This PR makes verify_cert only apply in the case of opensips connecting out to a server, and require_client_cert only apply in the case of a client connecting into opensips.

Compatibility

The only scenario I can imagine it breaking is if you have require_client_cert but not verify_cert, in which case formerly it would allow any client cert (but require some client cert to be presented), but now it would verify the client certificate. I don't expect this to be a problem because what is the point in requiring a client cert if you don't verify it?

Closing issues

Formerly client certs would be *verified* if `verify_cert`, but only
*required* if `require_client_cert`.

So if you enable `verify_cert` but you don't enable `require_client_cert`,
the old behaviour was that a client that presented an invalid client certificate
would be rejected, even though a client that presented no certificate at all
would be accepted.

But you need to enable `verify_cert` if you want *server* certificates
to be verified, so this commit makes `verify_cert` only apply to server
certificates and `require_client_cert` only apply to client
certificates.
Copy link

github-actions bot commented Feb 5, 2024

Any updates here? No progress has been made in the last 30 days, marking as stale.

@github-actions github-actions bot added the stale label Feb 5, 2024
@jes
Copy link
Contributor Author

jes commented Feb 5, 2024

No updates here.

@stale stale bot removed the stale label Feb 5, 2024
@bogdan-iancu
Copy link
Member

@jes , as I read the current code, you can do a verify_cert without require_client_cert - basically to verify whatever (if any) cert is provided by the client (by itself), without asking. This makes sense IMHO.

On the other hand, a require_client_cert will not be honored without verify_cert - if you require the cert, then verify it too! Which again seems OK to me.

So going back to your statement :

There was previously no way to configure opensips to verify server certs without having it also verify client certs, even if you configured it to make client certs optional!

You can achieve this (for a server RLS domain) by simply setting the verify_cert only for that particular domain, right ?

@bogdan-iancu bogdan-iancu self-assigned this Feb 14, 2024
@jes
Copy link
Contributor Author

jes commented Feb 16, 2024

Ah! Great idea. That works, thanks very much :).

@jes jes closed this Feb 16, 2024
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.

2 participants