api: add client authentication (BROKEN) #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When adding client auth, I get weird behaviour that I am having a hard time chasing down.
First, I have generated
one.jks
, which is attached in a targz.First, I generated a new self-signed CA
ca.key.pem
+ca.crt.pem
Then I generated a new key
one.key.pem
, and used it to create a CSR.I then used the CSR with my CA to create a signed key
one.crt.pem
.I concatenated my
one.crt.pem
and myca.crt.pem
intoone.chain.pem
, and exported it along-sideone.key.pem
into a PKCS12-formatted container with password12345678
namedone.p12
, and then imported that into a new JKS-formatted keystoreone.jks
with same password12345678
.shared-ca.tar.gz
Using the above with the base of this PR, I can configure Logstash's API to have SSL enabled.
After starting Logstash, I can curl the API providing my generated CA, and everything works:
Then I configured Logstash to enable SSL and use
required
for the newapi.ssl.client_authentication
setting.When
api.ssl.client_authentication
isrequired
and I fail to provide a peer, my connection is correctly terminated without a response:But when
api.ssl.client_authentication
isrequired
(minissl:force_peer
) and I do provide a valid cert (one.crt.pem
) and key (one.key.pem
), or whenapi.ssl.client_authentication
isoptional
(minissl:peer
), the connection establishes and then hangs without a response causing curl to timeout 30s later: