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

Ssl op allow eof #11735

Closed
wants to merge 2 commits into from
Closed

Ssl op allow eof #11735

wants to merge 2 commits into from

Conversation

beldmit
Copy link
Member

@beldmit beldmit commented May 5, 2020

This is the 2nd part of fixing #11209

Checklist
  • documentation is added or updated
  • tests are added or updated

doc/man3/SSL_CONF_cmd.pod Outdated Show resolved Hide resolved
doc/man3/SSL_CONF_cmd.pod Outdated Show resolved Hide resolved
include/openssl/ssl.h Outdated Show resolved Hide resolved
apps/include/opt.h Outdated Show resolved Hide resolved
doc/man3/SSL_CONF_cmd.pod Outdated Show resolved Hide resolved
doc/man3/SSL_CONF_cmd.pod Outdated Show resolved Hide resolved
doc/man3/SSL_CONF_cmd.pod Outdated Show resolved Hide resolved
doc/man3/SSL_CTX_set_options.pod Outdated Show resolved Hide resolved
include/openssl/ssl.h Outdated Show resolved Hide resolved
@mattcaswell
Copy link
Member

Oh...there probably should be a CHANGES entry for this

@beldmit
Copy link
Member Author

beldmit commented May 5, 2020

Oh...there probably should be a CHANGES entry for this

Done. Please reapprove.

@beldmit beldmit added approval: done This pull request has the required number of approvals and removed approval: otc review pending labels May 5, 2020
@mattcaswell
Copy link
Member

Looks like the travis failure is relevant

@beldmit
Copy link
Member Author

beldmit commented May 6, 2020

Fixed and Travis is happy. @mattcaswell could you please reconfirm?

@openssl-machine
Copy link
Collaborator

24 hours has passed since 'approval: done' was set, but as this PR has been updated in that time the label 'approval: ready to merge' is not being automatically set. Please review the updates and set the label manually.

@beldmit beldmit added approval: otc review pending and removed approval: done This pull request has the required number of approvals labels May 6, 2020
@beldmit
Copy link
Member Author

beldmit commented May 6, 2020

Ping @openssl/otc

@mattcaswell mattcaswell added approval: done This pull request has the required number of approvals and removed approval: otc review pending labels May 6, 2020
@kroeckx
Copy link
Member

kroeckx commented May 6, 2020

I wonder if it's not more useful to have an option that instead gives a different distinct error message. I think the "SSL_ERROR_SYSCALL with errno=0" really doesn't tell much, and isn't something we want as an API that people need to check. If this is actually the API we do want, I think that special case should get documented in the SSL_get_error() manpage, and maybe also the SSL_shutdown() manpage.

I'm also wondering if we should backport this to the 1.1.1 branch. If we go with the current patch, it would just be a define and documentation for 1.1.1.

@kroeckx kroeckx removed the approval: done This pull request has the required number of approvals label May 6, 2020
@beldmit
Copy link
Member Author

beldmit commented May 6, 2020

People from Nginx I had a conversation think that the change was not necessary at all and the best solution would be to revert this patch because otherwise they will have to support both variants.

Personally I plan to use this feature as an option to test against known "broken" (omitting close_notify) implementations.

@kroeckx
Copy link
Member

kroeckx commented May 6, 2020 via email

@beldmit
Copy link
Member Author

beldmit commented May 6, 2020

I asked them to respond here.

@mdounin
Copy link

mdounin commented May 6, 2020

As already mentioned by Dmitry, we here at nginx don't think the change was necessary. As Matt already said above in the comments to SSL_CONF_cmd.pod change, the error was always reported. The only issue is that SSL_ERROR_SYSCALL with a 0 errno is not properly documented. On the other hand, the behaviour was present since ancient OpenSSL versions, and actually tested in various software using OpenSSL library, including nginx. A better solution, in our opinion, would be to document the error instead.

Right now the situation in OpenSSL 3.0 is that the error reporting behaviour was changed, and, if we are going to support OpenSSL 3.0, we have to introduce specific error testing for OpenSSL 3.0. And at the same time we have to support previous error reporting, since we support OpenSSL versions starting from OpenSSL 0.9.8, as well as other libraries such as BoringSSL and LibreSSL, which still report connection close with SSL_ERROR_SYSCALL with a 0 errno.

For obvious reasons we don't want to support multiple code paths to test for the same error. Especially keeping in mind that due to BoringSSL and LibreSSL we probably have to support these multiple code paths forever.

It would be really helpful if the change in question was reverted and the existing behaviour (that is, SSL_ERROR_SYSCALL with a 0 errno) was documented instead.

@beldmit beldmit force-pushed the ssl_op_allow_eof branch 2 times, most recently from f35874f to 55032de Compare May 17, 2020 21:50
@beldmit
Copy link
Member Author

beldmit commented May 17, 2020

@kroeckx, all your change requests are processed and Travis will be happy soon

@beldmit
Copy link
Member Author

beldmit commented May 18, 2020

Travis is happy.

apps/s_server.c Outdated Show resolved Hide resolved
*/

static int test_incorrect_shutdown(int tst)
Copy link
Member

Choose a reason for hiding this comment

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

Since the codepath is entirely different I would prefer this to be an independent top-level test instead of a sub-flow of test_shutdown

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Thanks!

@beldmit
Copy link
Member Author

beldmit commented May 18, 2020

Travis is happy.

The incorrect shutdown tests are separated, the description of the -ignore_unexpected_eof option is adjusted.

apps/s_client.c Outdated Show resolved Hide resolved
Partially fixes openssl#11209.

Before OpenSSL 3.0 in case when peer does not send close_notify,
the behaviour was to set SSL_ERROR_SYSCALL error with errno 0.
This behaviour has changed. The SSL_OP_IGNORE_UNEXPECTED_EOF restores
the old behaviour for compatibility's sake.
test/sslapitest.c Outdated Show resolved Hide resolved
Copy link
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

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

LGTM

@mattcaswell mattcaswell added approval: done This pull request has the required number of approvals and removed approval: otc review pending labels May 18, 2020
@openssl-machine openssl-machine added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels May 19, 2020
@openssl-machine
Copy link
Collaborator

This pull request is ready to merge

openssl-machine pushed a commit that referenced this pull request May 19, 2020
Partially fixes #11209.

Before OpenSSL 3.0 in case when peer does not send close_notify,
the behaviour was to set SSL_ERROR_SYSCALL error with errno 0.
This behaviour has changed. The SSL_OP_IGNORE_UNEXPECTED_EOF restores
the old behaviour for compatibility's sake.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from #11735)
openssl-machine pushed a commit that referenced this pull request May 19, 2020
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from #11735)
@beldmit
Copy link
Member Author

beldmit commented May 19, 2020

Merged. Many thanks to all involved!

@beldmit beldmit closed this May 19, 2020
@beldmit beldmit deleted the ssl_op_allow_eof branch May 19, 2020 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Merge to master branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants