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

Explicitly remove support of SSLv2 #396

Closed
wants to merge 1 commit into from

Conversation

stlaz
Copy link
Contributor

@stlaz stlaz commented Jan 13, 2017

It was possible to set tls_version_min/max to 'ssl2', even though
newer versions of NSS will fail to set this as a valid TLS version.
This patch explicitly checks for deprecated TLS versions prior to
creating a TLS connection.

https://fedorahosted.org/freeipa/ticket/6607

@tiran
Copy link
Member

tiran commented Jan 17, 2017

  • What is the point of supporting SSL 3.0, TLS 1.0 and TLS 1.1 on the client side these days? How about we remove ancient and potentially dangerous TLS versions completely?
  • Would it be possible to validate the values during API initialization?

@stlaz
Copy link
Contributor Author

stlaz commented Jan 19, 2017

  • I think we may need to discuss the support on Monday meeting, generally I think SSL 3.0 and TLS 1.0 should not be supported but there might be troubles with connectivity to legacy IPA servers
  • Yes, although in that case we would have to fail instead of falling back to "reasonable defaults" as Env object attribute values cannot be changed once set

@stlaz stlaz mentioned this pull request Feb 2, 2017
5 tasks
ipalib/config.py Outdated
if self.tls_version_min not in TLS_VERSIONS:
raise errors.EnvironmentError(
"Unknown TLS version '{ver}' set in tls_version_min."
.format(self.tls_version_min))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you meant tls_version_max.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup


if min_version_idx < min_allowed_idx:
min_version_idx = min_allowed_idx
root_logger.warning("tls_version_min set too low ('{old}'),"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use a module-specific logger rather than the root logger:

from ipapython.ipa_log_manager import log_mgr

logger = log_mgr.get_logger(__name__)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shall I replace all appearances of root_logger in the module, then?

min_version_idx = TLS_VERSIONS.index(tls_version_min)
except ValueError:
raise InvocationError("tls_version_min ('{val}') is not a known "
"TLS version.".format(val=tls_version_min))
Copy link
Contributor

Choose a reason for hiding this comment

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

InvocationError is not right. I think RuntimeError should be OK. Or NetworkError if you want to use an IPA error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

@stlaz
Copy link
Contributor Author

stlaz commented Feb 7, 2017

Did not realize merging to Env from default constants was happening in the end of _finalize_core(), moved the checks in config.py accordingly.
Also, for some reason, github shows root_logger issue as solved but it's not - should all root_logger appearances be replaces by a module-own logger?

@HonzaCholasta
Copy link
Contributor

@stlaz, you don't have to replace root_logger in old code, but don't use it in new code.

@stlaz
Copy link
Contributor Author

stlaz commented Feb 8, 2017

Done. Also added a docstring to the get_proper_tls_version_span() function.

@HonzaCholasta
Copy link
Contributor

LGTM.

max_version_idx = TLS_VERSIONS.index(tls_version_max)
except ValueError:
raise ValueError("tls_version_max ('{val}') is not a known "
"TLS version.".format(val=tls_version_max))
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to move try-except block to a separate function to avoid the copy-pasta for min and max version checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

max_version_idx = get_proper_tls_version(
        max_version_idx, "max_version_idx", min_version_idx=min_version_idx)

I would rather avoid such overkill.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

logger.warning("tls_version_max set too low ('{old}'),"
"using '{new}' instead"
.format(old=tls_version_max,
new=TLS_VERSIONS[max_version_idx]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above - would it be possible to use a function to avoid copy-pasta?

:param tls_version_max:
the higher value in the TLS min-max span, raised to tls_version_min
if lower than TLS_VERSION_MINIMAL
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add :raises: to docstring.

@tkrizek
Copy link
Contributor

tkrizek commented Feb 16, 2017

Please update the commit title and description to make it clear that it also removes support of SSLv3.

It was possible to set tls_version_min/max to 'ssl2' or 'ssl3',
even though newer versions of NSS will fail to set this as a valid
TLS version. This patch explicitly checks for deprecated TLS versions
prior to creating a TLS connection.

Also, we don't allow tls_version_min/max to be set to a random
string anymore.

https://fedorahosted.org/freeipa/ticket/6607
max_version_idx = TLS_VERSIONS.index(tls_version_max)
except ValueError:
raise ValueError("tls_version_max ('{val}') is not a known "
"TLS version.".format(val=tls_version_max))
Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@tkrizek tkrizek added the ack Pull Request approved, can be merged label Feb 16, 2017
@MartinBasti
Copy link
Contributor

@MartinBasti MartinBasti added the pushed Pull Request has already been pushed label Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
5 participants