Track tasks and feature requests
Join 40 million developers who use GitHub issues to help identify, assign, and keep track of the features and bug fixes your projects need.
Sign up for free See pricing for teams and enterprisestls_cipher is not logged correctly with TLSv1.3 #2505
Comments
This comment has been minimized.
This comment has been minimized.
|
Oops, good point. The new ciphers were originally omitted from the map intentionally because they can't be configured. Would totally accept a pull request that adds those to the map, if it has a test that shows that setting up the TLS directive doesn't break if those ciphers are specified. |
This comment has been minimized.
This comment has been minimized.
|
Similar to #2485 |
This comment has been minimized.
This comment has been minimized.
|
Commit golang/go@0ee22d9 should be included in the upcoming Go 1.14 release. Can that replace some of Caddy's existing code? Would Caddy's API need to change for v2.0 to prepare for these pending changes in Go 1.14? If so, is it too late for that? |
This comment has been minimized.
This comment has been minimized.
|
@moorereason It's not too late; if Go 1.14 is released on time, it should be before our release candidates. We should try to get this into v2. |
This comment has been minimized.
This comment has been minimized.
|
I'd like to work on this if help is still needed. |
This comment has been minimized.
This comment has been minimized.
|
@ali-alsabbah That would be greatly appreciated! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@ali-alsabbah further up in this issue's history, you should see a closed pull request where I attempted to fix it. There is a little more to it than adding it to the map - last I looked, Caddy used the same map to parse caddy's config - and TLS 1.3 suites are not configurable in Go. The linked pull request noted that. I think the pull request was fairly close - I just struggled to find the time to finish it out. If you want to take what I did in the pull request, please do. |
This comment has been minimized.
This comment has been minimized.
|
Also, I should mention that this should be branched from the caddy/modules/caddytls/values.go Lines 25 to 55 in 64f0173 Note that there are some divergences in the naming... would need to see if it is still worth using. |
This comment has been minimized.
This comment has been minimized.
|
@mholt, This is the first time I've looked at v2, so maybe I'm missing something. Any pointers? |
This comment has been minimized.
This comment has been minimized.
|
@moorereason Good point, I haven't yet exposed TLS-related placeholders in v2. In v2, we use structured logging, so the only customization would be filtering/removal of fields, rather than crafting a template. |
This comment has been minimized.
This comment has been minimized.
|
Alright, I’ll work on this over the next couple of weeks. |
This comment has been minimized.
This comment has been minimized.
|
@mholt said:
How does this work? I have @ali-alsabbah, |
This comment has been minimized.
This comment has been minimized.
|
@moorereason Great question. What happens is that log entries are emitted with structure, i.e. a mapping of field to value. What fields any particular log emits is arbitrary depending on what the developer writes. The encoder is what determines how to write the output (i.e. JSON, console, etc.). We have a special encoder called a filter encoder which has access to the individual fields, so it can change or remove them before passing them to a wrapped/underlying encoder that does the actual encoding work. To add TLS data to log emissions, it should be as simple as just adding the relevant fields to a log like this one: caddy/modules/caddyhttp/server.go Lines 175 to 181 in e51e56a |
This comment has been minimized.
This comment has been minimized.
|
@mholt, |
This comment has been minimized.
This comment has been minimized.
|
@moorereason does this mean no work is needed from me here? @mholt if that’s the case, do you have any other issues you need help with that are good for newcomers to Caddy? |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@ali-alsabbah this is getting off-topic from this thread, but one thing I could see being very valuable is re-implementing some of the Caddy v1 plugins as v2 modules. See the bottom of the sidebar on https://caddyserver.com/v1/docs (Directives/Middleware) for a list of v1 plugins. See https://caddyserver.com/docs/extending-caddy for docs on setting up v2 modules. Feel free to open up new issues if you need any help! |
This comment has been minimized.
This comment has been minimized.
|
@ali-alsabbah: Correct. |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@francislavoie is there an issue open for this? Would like to discuss further. |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@ali-alsabbah Nope. Like I said, feel free to open up new issues for any plugins you want to work on if you need any help. |


1. Which version of Caddy are you using (
caddy -version)?0.11.5.
2. What are you trying to do?
Have caddy log the
tls_cipherthat the client and server negotiated with TLSv1.34. How did you run Caddy (give the full command and describe the execution environment)?
Can re reproduced simply by running
caddy.6. What did you expect to see?
I expect the logs to contain the TLS cipher like "TLS_AES_128_GCM_SHA256".
7. What did you see instead (give full error messages and/or log)?
"UNKNOWN" is seen in the logs.
8. Why is this a bug, and how do you think this should be fixed?
It looks like
config.goneeds the 1.3 cipher suites added toSupportedCiphersMapwhich is used byGetSupportedCipherNamehttps://github.com/mholt/caddy/blob/72d0debde6bf01b5fdce0a4f3dc2b35cba28241a/caddytls/config.go#L457
The lack of the TLSv1.3 cipher suite IDs means that the logged suite will be "UNKNOWN", and that the
tls_cipherenvironment variable that the fastcgi module sets here:https://github.com/mholt/caddy/blob/053373a38519d8cdf4ee7582ed9dc6ce239597cc/caddyhttp/fastcgi/fastcgi.go#L341
The go docs seem to indicate that the TLSv1.3 constants are there, so I think this is a matter of adding a few more IDs to the map, something like:
Looking a bit hard through, it looks like this map is also used for configuring caddy. Since Go's ciphers are not configurable for TLSv1.3, adding them to the existing map is likely not correct.
https://github.com/mholt/caddy/blob/72d0debde6bf01b5fdce0a4f3dc2b35cba28241a/caddytls/setup.go#L200