NIFI-4247 Support ranges in tls-toolkit SAN cli option.#3457
NIFI-4247 Support ranges in tls-toolkit SAN cli option.#3457natural wants to merge 1 commit intoapache:masterfrom
tls-toolkit SAN cli option.#3457Conversation
|
Reviewing... |
| tlsClientConfig.setDomainAlternativeNames(Collections.singletonList(domainAlternativeNames.get(instanceIndex))); | ||
| logger.info("Using alternate name " + domainAlternativeNames.get(instanceIndex) + " with hostname " + hostname + "."); | ||
| } else { | ||
| logger.info("Hostname count does not match given alternate name count. Verify names in resulting certificate."); |
There was a problem hiding this comment.
Might want to escalate this to logger.warn as it would be an edge case (not even sure we know how to handle it) when a non-static domain alternative name pattern is applied but the range does not match the hostname pattern count.
There was a problem hiding this comment.
Will update to logger.warn
|
Troy, this looks like great work. I would like to see more explicit unit test cases added, but I understand that the toolkit testing can sometimes be difficult because of the tight coupling with I ran a number of scenarios and I've pasted my results below to document. Only one scenario (#7) failed, and one (#1) had a possible minor improvement. 1. Static hostname, no SANExpected output: 1 generated keystore containing 1 certificate with single hostname and 1 SAN entry (1 hostname) Notes:
2. Static hostname, static SANExpected output: 1 generated keystore containing 1 certificate with single hostname and 2 SAN entries (1 hostname, 1 alternate name) 3. Dynamic hostname, static SANExpected output: 2 generated keystores each containing 1 certificate with single hostname and 2 SAN entries (1 (dynamic) hostname, 1 static alternate name) 4. Dynamic hostname, dynamic SAN (same range)Expected output: 2 generated keystores each containing 1 certificate with single hostname and 2 SAN entries (1 (dynamic) hostname, 1 (dynamic) SAN) 5. Dynamic hostname, dynamic SAN (different range values; same range length)Expected output: 2 generated keystores each containing 1 certificate with single hostname and 2 SAN entries (1 (dynamic) hostname, 1 (dynamic) SAN) 6. Dynamic hostname, dynamic SAN (different range values; different range length)Expected output: 2 generated keystores each containing 1 certificate with single hostname and 4 SAN entries (1 (dynamic) hostname, 3 (exhaustive) SAN) 7. Dynamic hostname, dynamic SAN (different range values; same range length; reverse order)Expected output: 2 generated keystores each containing 1 certificate with single hostname and 2 SAN entries (1 (dynamic) hostname, 1 (dynamic) SAN) Notes:
8. Dynamic hostname, dynamic SAN (different range values; range is non-numeric)Expected output: 2 generated keystores each containing 1 certificate with single hostname and 2 SAN entries (1 (dynamic) hostname, 1 (dynamic) SAN) or early exception |
|
I also made a trivial formatting fix. You can pull from alopresto/nifi-4247-a, but it's likely faster to just remove the space manually. |
|
@alopresto those tests are great, thank you for including them in your comment. So much better than "Oh I tried this or that and it failed." I think I can include those tests or something similar in the unit tests; they're already doing similar checks I believe. I'm not quite certain what's going on with no. 7, so there may be some work in fixing it that. |
The code in this change-set provides support for ranges in the SAN argument of the tls-toolkit cli. For example:
Thank you for submitting a contribution to Apache NiFi.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically master)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.