mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #10386 from hexfusion/release-3.2
[Cherry-pick 3.2] auth: disable CommonName auth for gRPC-gateway
This commit is contained in:
commit
ab4693d97f
@ -981,10 +981,23 @@ func (as *authStore) AuthInfoFromTLS(ctx context.Context) *AuthInfo {
|
|||||||
cn := chain.Subject.CommonName
|
cn := chain.Subject.CommonName
|
||||||
plog.Debugf("found common name %s", cn)
|
plog.Debugf("found common name %s", cn)
|
||||||
|
|
||||||
return &AuthInfo{
|
ai := &AuthInfo{
|
||||||
Username: cn,
|
Username: cn,
|
||||||
Revision: as.Revision(),
|
Revision: as.Revision(),
|
||||||
}
|
}
|
||||||
|
md, ok := metadata.FromIncomingContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// gRPC-gateway proxy request to etcd server includes Grpcgateway-Accept
|
||||||
|
// header. The proxy uses etcd client server certificate. If the certificate
|
||||||
|
// has a CommonName we should never use this for authentication.
|
||||||
|
if gw := md["grpcgateway-accept"]; len(gw) > 0 {
|
||||||
|
plog.Warningf("ignoring common name in gRPC-gateway proxy request %s", ai.Username)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return ai
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user