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

how to override things like clientSupported member of TLS ClientParams #2

Open
bfrk opened this issue May 14, 2024 · 6 comments
Open

Comments

@bfrk
Copy link

bfrk commented May 14, 2024

From 1.9.x to 2.0.x the tls package made a change to require EMS (extended main secret) by default. I must admit that I have no idea what this is about and I don't really care much. However, it turns out that for compatibility reasons I need to change it to the old behavior (which allowed but did not require it).

I am not using tls directly but via http-client-tls which is in turn based on crypton-connection. I need to install a new connection manager, using code like

manager <- newManager $ mkManagerSettings tlsSettings Nothing
setGlobalManager manager

where tlsSettings is of type TLSSettings which is provided by crypton-connection.

The problem is that this data type is either TLSSettingsSimple with no way to override things like the clientSupported member of Network.TLS.ClientParams; or else it is TLSSettings with an argument of type ClientParams, but ClientParams contains server specific data, so it is unsuitable as configuration for a generic connection manager, or at least that is how it appears to me.

The magic that fills in the host specific parameters in the case of TLSSettingsSimple is in makeTLSParams, which gets the host specific data passed as arguments. One possible solution would be to add a member

settingClientSupported :: Maybe ClientSupported

to TLSSettingsSimple and use that in makeTLSParams to override the default.

@kazu-yamamoto
Copy link
Owner

If you kindly send a PR, I will merge it and release a new version.

BTW, TLS 1.2 without EMS is insecure. I understand the server does not support it but I think you should ask to support EMS in the server side.

bfrk added a commit to bfrk/crypton-connection that referenced this issue May 15, 2024
…ngsSimple

This is so we can manipulate these TLS settings even when using a connection
manager like the http-client package does. See
kazu-yamamoto#2 for details.
@bfrk
Copy link
Author

bfrk commented May 15, 2024

I agree that it would be better to upgrade the server, but there are situations where this is difficult or even impossible to achieve: there are legacy servers, particularly proprietary devices which may not even be available any more much less supported with (firmware) upgrades. In my line of work this happens quite frequently.

@kazu-yamamoto
Copy link
Owner

The intention of this breaking change is to tell users that they are using insecure channels.
It is up to them whether or not they continue to use those insecure channels.

@bfrk
Copy link
Author

bfrk commented May 16, 2024

Yes, I agree that this is the right approach. Ideally, a program where the server URL is specified by user input (or configuration) should issue a (single) warning for each server that doesn't support EMS. Doing this in our case would require a separate probing pass with RequireEMS for each new server, falling back to AllowEMS if that fails. I think the right place to add such a feature is the generic connection manager in http-client-tls since this is where we keep track of servers and (TLS enabled) connections.

@kazu-yamamoto
Copy link
Owner

I think that the warning-fallback approach works for clients well.
It's worth considering.
But what about server sides?
How to tell the warnings to their operators?

@bfrk
Copy link
Author

bfrk commented May 16, 2024

I'd say leave it to users (of client programs I mean) to complain to server operators about annoying warnings ;-)

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

No branches or pull requests

2 participants