|
74 | 74 |
|
75 | 75 | it "returns undetermined state on unhandled error" do |
76 | 76 | valid, error, cert = SSLTest.test("https://pijoinlrfgind.com") |
77 | | - expect(error).to eq ("SSL certificate test failed: Failed to open TCP connection to pijoinlrfgind.com:443 (getaddrinfo: Name or service not known)") |
| 77 | + expect(error).to include("SSL certificate test failed: Failed to open TCP connection to pijoinlrfgind.com:443") |
| 78 | + expect(error).to include(/name.*not known/i) |
78 | 79 | expect(valid).to be_nil |
79 | 80 | expect(cert).to be_nil |
80 | 81 | end |
81 | 82 |
|
82 | 83 | it "stops on timeouts" do |
83 | 84 | valid, error, cert = SSLTest.test("https://updown.io", open_timeout: 0) |
84 | | - expect(error).to eq ("SSL certificate test failed: Failed to open TCP connection to updown.io:443 (Connection timed out - user specified timeout)") |
| 85 | + expect(error).to include("SSL certificate test failed") |
| 86 | + expect(error).to include(/timeout/i) |
85 | 87 | expect(valid).to be_nil |
86 | 88 | expect(cert).to be_nil |
87 | 89 | end |
88 | 90 |
|
89 | 91 | it "reports revocation exceptions" do |
90 | 92 | expect(SSLTest).to receive(:follow_ocsp_redirects).and_raise(ArgumentError.new("test")) |
91 | | - valid, error, cert = SSLTest.test("https://updown.io") |
| 93 | + valid, error, cert = SSLTest.test("https://digicert.com") |
92 | 94 | expect(error).to eq ("SSL certificate test failed: test") |
93 | 95 | expect(valid).to be_nil |
94 | 96 | expect(cert).to be_a OpenSSL::X509::Certificate |
|
98 | 100 | expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original |
99 | 101 | expect(SSLTest).not_to receive(:follow_crl_redirects) |
100 | 102 | valid, error, cert = SSLTest.test("https://revoked.badssl.com/") |
101 | | - expect(error).to eq ("SSL certificate revoked: The certificate was revoked for an unknown reason (revocation date: 2021-10-27 21:38:48 UTC)") |
| 103 | + expect(error).to eq ("SSL certificate revoked: Key Compromise (revocation date: 2025-11-04 21:01:29 UTC)") |
102 | 104 | expect(valid).to eq(false) |
103 | 105 | expect(cert).to be_a OpenSSL::X509::Certificate |
104 | 106 | end |
|
107 | 109 | expect(SSLTest).to receive(:test_ocsp_revocation).once.and_return([false, "skip OCSP", nil]) |
108 | 110 | expect(SSLTest).to receive(:follow_crl_redirects).once.and_call_original |
109 | 111 | valid, error, cert = SSLTest.test("https://revoked.badssl.com/") |
110 | | - expect(error).to eq ("SSL certificate revoked: Unknown reason (revocation date: 2021-10-27 21:38:48 UTC)") |
| 112 | + expect(error).to eq ("SSL certificate revoked: Key Compromise (revocation date: 2025-11-04 21:01:29 UTC)") |
111 | 113 | expect(valid).to eq(false) |
112 | 114 | expect(cert).to be_a OpenSSL::X509::Certificate |
113 | 115 | end |
114 | 116 |
|
115 | 117 | it "stops following redirection after the limit for the revoked certs check" do |
116 | 118 | valid, error, cert = SSLTest.test("https://github.com/", redirection_limit: 0) |
117 | | - expect(error).to eq ("Revocation test couldn't be performed: OCSP: Request failed (URI: http://ocsp.digicert.com): Too many redirections (> 0), CRL: Request failed (URI: http://crl3.digicert.com/DigiCertTLSHybridECCSHA3842020CA1-1.crl): Too many redirections (> 0)") |
| 119 | + expect(error).to include("Revocation test couldn't be performed: OCSP: Request failed") |
| 120 | + expect(error).to include("Too many redirections (> 0)") |
118 | 121 | expect(valid).to eq(true) |
119 | 122 | expect(cert).to be_a OpenSSL::X509::Certificate |
120 | 123 | end |
|
123 | 126 | # Disable CRL fallback to see error message |
124 | 127 | expect(SSLTest).to receive(:test_crl_revocation).once.and_return([false, "skip CRL", nil]) |
125 | 128 | expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original |
126 | | - valid, error, cert = SSLTest.test("https://www.demarches-simplifiees.fr") |
| 129 | + valid, error, cert = SSLTest.test("https://google.com") |
127 | 130 | expect(error).to eq ("Revocation test couldn't be performed: OCSP: Missing OCSP URI in authorityInfoAccess extension, CRL: skip CRL") |
128 | 131 | expect(valid).to eq(true) |
129 | 132 | expect(cert).to be_a OpenSSL::X509::Certificate |
|
143 | 146 | # Disable OCSP to see error message |
144 | 147 | expect(SSLTest).to receive(:test_ocsp_revocation).once.and_return([false, "skip OCSP", nil]) |
145 | 148 | expect(SSLTest).not_to receive(:follow_crl_redirects) |
146 | | - valid, error, cert = SSLTest.test("https://meta.updown.io") |
| 149 | + valid, error, cert = SSLTest.test("https://github.com") |
147 | 150 | expect(error).to eq ("Revocation test couldn't be performed: OCSP: skip OCSP, CRL: Missing crlDistributionPoints extension") |
148 | 151 | expect(valid).to eq(true) |
149 | 152 | expect(cert).to be_a OpenSSL::X509::Certificate |
150 | 153 | end |
151 | 154 |
|
152 | | - it "works with OCSP for first cert and CRL for intermediate (Let's Encrypt R3 intermediate)" do |
153 | | - expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original |
154 | | - expect(SSLTest).to receive(:follow_crl_redirects).once.and_call_original |
155 | | - valid, error, cert = SSLTest.test("https://meta.updown.io/") |
156 | | - expect(error).to be_nil |
157 | | - expect(valid).to eq(true) |
158 | | - expect(cert).to be_a OpenSSL::X509::Certificate |
159 | | - end |
160 | | - |
161 | | - it "works with OCSP for first cert and CRL for intermediate (Certigna Services CA)" do |
| 155 | + it "works with OCSP for first cert and CRL for intermediate (Google)" do |
162 | 156 | expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original |
163 | 157 | expect(SSLTest).to receive(:follow_crl_redirects).once.and_call_original |
164 | | - # Similar chain: https://www.demarches-simplifiees.fr |
165 | | - valid, error, cert = SSLTest.test("https://www.anonymisation.gov.pf") |
| 158 | + valid, error, cert = SSLTest.test("https://google.com") |
166 | 159 | expect(error).to be_nil |
167 | 160 | expect(valid).to eq(true) |
168 | 161 | expect(cert).to be_a OpenSSL::X509::Certificate |
|
190 | 183 | SSLTest.send(:follow_crl_redirects, URI("http://crl.certigna.fr/certigna.crl")) # 1.1k |
191 | 184 | SSLTest.send(:follow_crl_redirects, URI("http://crl3.digicert.com/DigiCertTLSHybridECCSHA3842020CA1-1.crl")) # 26k |
192 | 185 | expect(SSLTest.cache_size[:crl][:lists]).to eq(2) |
193 | | - expect(SSLTest.cache_size[:crl][:bytes]).to be > 27_000 |
| 186 | + expect(SSLTest.cache_size[:crl][:bytes]).to be > 6000 |
194 | 187 | end |
195 | 188 |
|
196 | 189 | it "returns OCSP cache size properly" do |
197 | | - SSLTest.test("https://updown.io") |
| 190 | + SSLTest.test("https://google.com") |
198 | 191 | expect(SSLTest.cache_size[:ocsp][:responses]).to eq(1) |
199 | 192 | expect(SSLTest.cache_size[:ocsp][:errors]).to eq(0) |
200 | 193 | expect(SSLTest.cache_size[:ocsp][:bytes]).to be > 150 |
|
209 | 202 | it "fetch CRL list and updates cache" do |
210 | 203 | uri = URI("http://crl.certigna.fr/certigna.crl") |
211 | 204 | body, error = SSLTest.send(:follow_crl_redirects, uri) |
212 | | - expect(body.bytesize).to equal 1152 |
| 205 | + expect(body.bytesize).to equal 1417 |
213 | 206 | expect(error).to be_nil |
214 | 207 |
|
215 | 208 | # Check cache status |
|
0 commit comments