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

Workaround for SSL events in JSSEngine #1022

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

edewata
Copy link
Contributor

@edewata edewata commented Aug 20, 2024

Currently JSSEngine does not generate SSL events although it seems to receive the alerts from NSS.

As a temporary workaround, the SSLFDProxy has been updated to keep a list of SSL socket listeners, then JSSEngine will add a listener into it. When NSS generates an SSL event, it will be passed to SSLFDProxy listeners directly, then eventually to JSSEngine listeners as well.

The code that creates the SSL event in JSS_NSS_addSSLAlert() has been moved into JSS_NSS_createSSLAlert() so it can be reused.

Note: This PR is needed by dogtagpki/pki#4832

@edewata edewata requested a review from fmarco76 August 20, 2024 01:25
Currently JSSEngine does not generate SSL events although it
seems to receive the alerts from NSS.

As a temporary workaround, the SSLFDProxy has been updated to
keep a list of SSL socket listeners, then JSSEngine will add a
listener into it. When NSS generates an SSL event, it will be
passed to SSLFDProxy listeners directly, then eventually to
JSSEngine listeners as well.

The code that creates the SSL event in JSS_NSS_addSSLAlert() has
been moved into JSS_NSS_createSSLAlert() so it can be reused.
Copy link

Copy link
Member

@fmarco76 fmarco76 left a comment

Choose a reason for hiding this comment

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

I have tested the NonBlockingSocketFactory with patched and not patched JSS. Using the master not patched JSS I have these two scenario:

  • CA signing certificate not trusted, the output is
[root@pki jss]# pki -D org.dogtagpki.client.socketFactory=org.dogtagpki.client.NonBlockingSocketFactory -d $HOME/pluto info
  Server URL: https://pki.example.com:8443/
WARNING: UNTRUSTED ISSUER encountered on 'CN=pki.example.com,OU=pki-tomcat,O=EXAMPLE' indicates a non-trusted CA cert 'CN=CA Signing Certificate,OU=pki-tomcat,O=EXAMPLE'
Trust this certificate (y/N)? N
IOException: Unable to write to socket: Unable to validate CN=pki.example.com, OU=pki-tomcat, O=EXAMPLE: Untrusted issuer: CN=CA Signing Certificate, OU=pki-tomcat, O=EXAMPLE
  • CA signing certificate trusted and self signed user certificate, the output is
 [root@pki jss]# pki -D org.dogtagpki.client.socketFactory=org.dogtagpki.client.NonBlockingSocketFactory -d $HOME/pippo -n pippo info
  Server URL: https://pki.example.com:8443/
SEVERE: FATAL: SSL alert received: UNKNOWN_CA
SEVERE: FATAL: SSL alert sent: UNEXPECTED_MESSAGE
RuntimeException: Unexpected error trying to construct channel: Unable to perform operations on a closed socket!

In this second case the event are correctly fired (with JSS from master).
As a result I think there is a problem with the handling of the CA authorisation and not with the event itself. In fact, server side SSL events are fired correctly since there is not this option

@edewata
Copy link
Contributor Author

edewata commented Aug 27, 2024

@fmarco76 Thanks for the investigation. Please see PR #1023. I've updated the test to include self-signed user cert. It shows some inconsistencies between the two socket factories.

@edewata
Copy link
Contributor Author

edewata commented Aug 28, 2024

@fmarco76 Please see PR #1024. I've moved some of the changes here into that PR to make it easier to investigate SSL alert issues later.

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