Skip to content

Commit

Permalink
Add serverCaChainPath server TLS config setting (linkerd#1931)
Browse files Browse the repository at this point in the history
There is no way to specify a supporting CA certificate chain to support a server certificate in a Linkerd server.  If a certificate chain is provided in the file specified by `certPath`, only the first certificate in the file is served.

Add a new server TLS config option `serverCaChainPath`.  This allows you to provide a supporting CA certificate chain for the server cert.

Fixes linkerd#1926

Signed-off-by: Alex Leong <alex@buoyant.io>
  • Loading branch information
adleong committed May 14, 2018
1 parent e4bee61 commit 653dc80
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import java.io.File

case class TlsServerConfig(
certPath: String,
serverCaChainPath: Option[String],
keyPath: String,
caCertPath: Option[String] = None,
ciphers: Option[Seq[String]] = None,
Expand All @@ -34,9 +35,18 @@ case class TlsServerConfig(
case _ => FClientAuth.Off
}

val keyCredentials = serverCaChainPath match {
case Some(serverCaChain) => KeyCredentials.CertKeyAndChain(
new File(certPath),
new File(keyPath),
new File(serverCaChain)
)
case None => KeyCredentials.CertAndKey(new File(certPath), new File(keyPath))
}

Stack.Params.empty + Transport.ServerSsl(Some(SslServerConfiguration(
clientAuth = clientAuth,
keyCredentials = KeyCredentials.CertAndKey(new File(certPath), new File(keyPath)),
keyCredentials = keyCredentials,
trustCredentials = trust,
cipherSuites = cipherSuites,
applicationProtocols = appProtocols
Expand Down
1 change: 1 addition & 0 deletions linkerd/docs/client_tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Key | Default Value | Description
--- | ------------- | -----------
enabled | true | Enable TLS on outgoing connections.
certPath | _required_ | File path to the TLS certificate file.
serverCaChainPath | none | Path to a file containing a CA certificate chain to support the server certificate.
keyPath | _required_ | File path to the TLS key file.
requireClientAuth | false | If true, only accept requests with valid client certificates.
caCertPath | none | File path to the CA cert to validate the client certificates.
Expand Down
1 change: 1 addition & 0 deletions linkerd/examples/tls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ routers:
tls:
certPath: /foo/cert.pem
keyPath: /foo/key.pem
serverCaChainPath: /foo/ca-chain.pem

0 comments on commit 653dc80

Please sign in to comment.