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

enable TLS client forwarding #1446

Merged
merged 1 commit into from
Jun 11, 2017
Merged

enable TLS client forwarding #1446

merged 1 commit into from
Jun 11, 2017

Conversation

drewwells
Copy link
Contributor

Copys the incoming TLS client certificate to the outgoing
request. The backend can then use this certificate for
client authentication ie. k8s client cert authentication

fixes #1392

Copy link
Contributor

@timoreimann timoreimann left a comment

Choose a reason for hiding this comment

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

Left some comments. I mostly focused on Go-specific issues since I'm not very familiar with Go's TLS library/package. Someone with more domain expertise will need to have another look.

Could you please add tests as well?

server.go Outdated
return nil, err
}
ok := pool.AppendCertsFromPEM(data)
if !ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose this can be merged with the previous line and simplified like

if !pool.AppendCertsFromPEM(data) {

server.go Outdated
}
}
config.RootCAs = pool
//config.ClientAuth = tls.RequireAndVerifyClientCert
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove.

server.go Outdated
if frontend.PassTLSCert {
tlsConfig, err = createClientTLSConfig(entryPoint.TLS)
if err != nil {
log.Errorf("failed to create TLS config %s: %v", frontendName, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please capitalize the first letter of the log message.

server.go Outdated
if frontend.PassTLSCert {
tlsConfig, err = createClientTLSConfig(entryPoint.TLS)
if err != nil {
log.Errorf("failed to create TLS config %s: %v", frontendName, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

s/config/config for frontend/

server.go Outdated
@@ -418,6 +418,35 @@ func (server *Server) listenSignals() {
server.Stop()
}

func createClientTLSConfig(tlsOption *TLS) (*tls.Config, error) {
if tlsOption == nil {
return nil, errors.New("no TLS provided")
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC, then we only hit this case if no TLS was configured on the entry point.

Could we handle this error further up the stack, e.g., in loadConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since it's a pointer, a tlsOption(nil) will panic. It should really be checked prior to access

@ldez ldez added contributor/waiting-for-corrections priority/P1 need to be fixed in next release labels Apr 24, 2017
@ldez ldez modified the milestone: 1.4 May 10, 2017
@ldez ldez added status/2-needs-review and removed priority/P1 need to be fixed in next release labels May 10, 2017
@emilevauge
Copy link
Member

Ping @drewwells ?

@drewwells
Copy link
Contributor Author

there were some non-trivial changes to server.go, not sure I will get these conflicts merged correctly.

@zyclonite
Copy link
Contributor

would it be enough to simply forward the subject of the certificate...

i did a pull request for the underlying proxy library to enable this
vulcand/oxy#68

@emilevauge
Copy link
Member

@timoreimann do you validate this PR finally (even with the conflict)?

Copy link
Contributor

@timoreimann timoreimann left a comment

Choose a reason for hiding this comment

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

Sorry, this one fell off my radar.

LGTM, thanks! 👍

@ldez ldez added kind/enhancement a new or improved feature. and removed contributor/waiting-for-corrections labels Jun 7, 2017
@samgurtman-zz
Copy link

Any time frame for merge?

@drewwells
Copy link
Contributor Author

@zyclonite that MR turns off SSL verification

@drewwells
Copy link
Contributor Author

This MR conflicts again, is there any interest in supporting this feature? We have moved on and no longer use Traefik b/c this feature was missing.

@emilevauge
Copy link
Member

@drewwells @samgurtman sorry if it takes some time. We are a small team, half of the maintainers team does this on his spare time. We will merge it for sure, but be patient.

@emilevauge
Copy link
Member

Ping @timoreimann

@timoreimann
Copy link
Contributor

@emilevauge I approved a few days ago. Your LGTM is still missing. 😀

@emilevauge
Copy link
Member

@timoreimann oops, sorry. Was looking from my mobile phone, and reviews are not visible 😊

Copy link
Member

@emilevauge emilevauge left a comment

Choose a reason for hiding this comment

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

Thanks @drewwells
LGTM!

@emilevauge
Copy link
Member

Closing & reopening to enable Semaphore CI

@emilevauge emilevauge closed this Jun 11, 2017
@emilevauge emilevauge reopened this Jun 11, 2017
Copys the incoming TLS client certificate to the outgoing
request. The backend can then use this certificate for
client authentication ie. k8s client cert authentication
@ldez ldez merged commit 3048509 into traefik:master Jun 11, 2017
@drewwells
Copy link
Contributor Author

drewwells commented Jun 11, 2017 via email

@samgurtman-zz
Copy link

Fantastic! Thanks for this! We can fully transition to Traefik now.

@samgurtman-zz
Copy link

samgurtman-zz commented Jun 21, 2017

I'm trying this on Docker Swarm with a build off of master, but adding the label "traefik.frontend.passTLSCert=true" has no effect. Is this to be expected?

@emilevauge
Copy link
Member

@samgurtman, in fact, @drewwells didn't add any label in this PR. We would love if you could help us on this in a new PR ❤️

@samgurtman-zz
Copy link

samgurtman-zz commented Jun 21, 2017

Could you point me to an example of an existing label implementation I can base it off of? I don't have any Go experience so that may be a problem.

@emilevauge
Copy link
Member

@samgurtman you can have a look at traefik.frontend.passHostHeader in https://github.com/containous/traefik/blob/master/provider/docker/docker.go which should be similar :)

@drewwells drewwells deleted the forwardclient branch June 21, 2017 13:21
@drewwells
Copy link
Contributor Author

Well originally this was a POC, but it took months to get the code merged. Maybe somebody with write access can add the other labels. Unless you want labels sometime in September :)

@emilevauge
Copy link
Member

emilevauge commented Jun 21, 2017

@drewwells

Maybe somebody with write access can add the other labels. Unless you want labels sometime in September :)

Maintainers (who have write access) are also making PR and it can take some time to get merged. We are a small team dealing with many contributions. We prefer carefully reviewing every PR than merging on the hoof.

And by the way, you were not that responsive either !

@samgurtman-zz
Copy link

So I added the label handling for docker, and I can confirm the passTLSCert stuff is being triggered, but I see no effects in the headers passed to my downstream server. Has this been smoke tested, and can someone confirm it is actually working with traefik.toml configuration?

@ldez
Copy link
Contributor

ldez commented Jun 22, 2017

This PR is merged. Please open a new issue or discuss this in :

@samgurtman-zz
Copy link

samgurtman-zz commented Jun 22, 2017

Ok, I guess I won't contribute a PR then if you can't confirm whether this existing PR actually has any effect.

@emilevauge
Copy link
Member

@samgurtman we just asked you to come discuss we us somewhere else as this PR is closed. If you think there may be an issue on this, we would love to hear you on Slack instead.

@samgurtman-zz
Copy link

samgurtman-zz commented Jun 22, 2017 via email

@dac388
Copy link

dac388 commented Jun 28, 2017

Pretty confused about how I find out if this issue is resolved, or rather, how to implement the resolution, and by traefik documentation in general, tbh.

@emilevauge
Copy link
Member

emilevauge commented Jun 28, 2017

Thank you for your support ! 👍
This is a closed pull request, please open an issue or come on the slack channel to talk with the community.

@MichaelSp
Copy link

I'm also confused if this suppose to work.
Google leads me here, so maybe you (eg. @emilevauge) can comment on the current state of the implementation to not confuse others as well.
I'd expect:

  1. the latest version to have that feature included: https://store.docker.com/images/traefik
  2. to set label traefik.frontend.passTLSCert=true on my backend container
    is any of that assumptions wrong?

@ldez
Copy link
Contributor

ldez commented Jul 10, 2017

@MichaelSp

  1. this feature will be in the next release (1.4)
  2. the label must be set on the frontend not the backend.

Thanks for your interest in Traefik 😃

This issue PR closed. Please open a new issue or discuss this in :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tls kind/enhancement a new or improved feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

forward client cert to minikube k8s apiserver
8 participants