CAS needs to make at least one headless HTTP request (we use cURL) to the CAS server during ticket validation. It seems that historically, this module has provided a setting for the user to provide a path to the public certificate file for the certificate authority that signed the TLS certificate used by the CAS server. This file is then used to validate the authenticity of the CAS server during any cURL requests we make. If the user doesn't specify a path, then the CAS server is not verified to be authentic.
I think we can improve this behavior a bit. The problem I see here is that our default behavior is to NOT perform validation of the CAS server. Non technical users will be more than happy to not investigate this option further and now their authentication system is flawed.
I propose we present the following radio buttons:
[ ] Verify CAS server, use default CA chain file (selected by default)
[ ] Verify CAS server, use specific CA PEM file
[ ] Do not verify CAS server (not recommended)
If the 2nd option is selected we provide a text field (like we do now) to provide the path to the PEM file. With the first option, we essentially just tell cURL that yes, we want to verify the peer, but we don't have a specific CA chain file to use. cURL should then use a default one that's located somewhere on the file system.
I think we can provide some additional explanation text as well, to help non technical users understand what these mean.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | interdiff.txt | 3.8 KB | yalet |
| #17 | 2393411_17.patch | 10.36 KB | yalet |
| #12 | 2393411_12.patch | 7.52 KB | bkosborne |
| #12 | interdiff.txt | 1.92 KB | bkosborne |
| #9 | cas_2392411_9.patch | 7.52 KB | caseyfw |
Comments
Comment #1
bkosborneI'll work on a patch for this.
Comment #2
yalet commentedWe should also consider backporting this to the 7.x version.
Comment #3
bkosborneYeah. We'd have to change the default for 7.x to be "no validation" though, since that's what it is now.
Comment #4
yalet commentedRan into this irritating behavior in the 7.x version, which motivated me to return to this issue and write it up for 8.x. Patch attached. I've fixed the existing tests, added a test for the new configuration getter, but did not yet modify the CasValidator tests to have 100% code coverage again.
Comment #5
bkosborneHow about "Choose an appropriate option below for verifying the SSL certificate of your CAS server."
Should we instead default to TRUE id the file doesn't exist?
rogue space
Yes, verify my CAS server's SSL cert. Use my own CA certificate chain provided below.
No, do not verify the SSL cert of my CAS server. (Note: this should NEVER be used in production).
The "if omitted" wording could still be confusing to people that think they NEED to have this even though they don't. We should probably hide this field (field API lets us do that I think) unless the custom option is selected above.
Comment #6
bkosborneComment #7
caseyfw commentedThis UI would greatly benefit from using the states API to rollout the cert path field when you select this option.
Comment #8
caseyfw commentedFixes @bkosborne's suggestions.
I considered implementing hook_requirements to ensure the custom cert file exists, but it would just add unnecessary overhead to each request, especially given Guzzle 6's remarkably sane failure-mode behaviour in regards to verification certs: http://guzzle.readthedocs.org/en/latest/request-options.html#verify
Comment #9
caseyfw commentedFixed verification logic for patch 8.
Comment #10
caseyfw commentedComment #11
yalet commentedWhen I attempt to use the 'Verify using custom [...]' option and leave the text field blank, I get a verification error on the form: 'SSL verification method custom certificate file does not exist.' This contradicts the description of the field, which says that if the field is blank, the default web server certificates will be used.
Comment #12
bkosborneAddressed the above comment
Comment #14
yalet commentedThis looks good, but still needs an update for the tests.
Comment #16
yalet commentedThe previous commit was to fix a regression in CasValidatorTest that I noticed while starting to work on updating the tests for this issue. That commit does not include any of the work in this patch, but I referenced this issue where I found the issue.
We had a test that was a spurious pass after the Guzzle update. I updated the test to actually test what it was intended to test, and made a related change to the CasValidator to generalize the types of Guzzle exceptions we catch.
Comment #17
yalet commentedTests.
Comment #18
bkosborneThis isn't applying cleaning against 8.x-1.x branch:
error: patch failed: tests/src/Unit/Service/CasValidatorTest.php:17
error: tests/src/Unit/Service/CasValidatorTest.php: patch does not apply
Did you generate this against 8.x-1.x?
Comment #19
bkosborneignore that, I'm dumb
Comment #20
bkosborneCommitted