Open hvt opened 1 month ago
3.12 has been out of support for more than 6 months.
So we will be trying to reproduce this against 4.0.2
, the only community-supported series.
The standard expiration period used by tls-gen
is 10 years. In theory overriding it to be 50 years or something should be enough.
Here is where the Certificate is not yet valid
error message is generated:
@hvt you've probably found an edge case that the code misses. I'll investigate this when I can find time.
What happens if your certs have a slightly later start time, like epoch time plus 1 second?
What happens if your certs have a slightly later start time, like epoch time plus 1 second?
At first I thought it was a division by zero. So I already tried creating a certificate (and CA) with a Not Before
of Jan 1 00:00:01 1970 GMT
. That failed as well, with the same error.
The code computes the difference between dates in seconds, so something may not be accounting for overflow/wrap around in one of the calendar modules.
In some if not all cases we could use minutes or hours. This health check is meant to be run e.g. every day, not every hour or minute.
Describe the bug
We are using RabbitMQ 3.12.12.
Because of reasons (tm) we have a TLS certificate with an extremely long validity (and also signed by a CA that has that same validity period), namely:
When you now query the health check API for certificate expiration, you receive a HTTP 500 response, without any content. In the logs of RabbitMQ, this crash / traceback is printed:
Reproduction steps
I am not entirely sure if this is caused by the CA validity or the certificate validity. I have however generated an example CA certificate and an example certificate + key:
`ca.crt`
```pem -----BEGIN CERTIFICATE----- MIIFKTCCAxGgAwIBAgIUH7VQuNxYNBgBFwUdwIsaMxLsXKgwDQYJKoZIhvcNAQEN BQAwHjEcMBoGA1UEAwwTUmFiYml0TVEgRXhhbXBsZSBDQTAgFw03MDAxMDEwMDAw MDBaGA8yMDk5MTIzMTIzNTk1OVowHjEcMBoGA1UEAwwTUmFiYml0TVEgRXhhbXBs ZSBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAM8g9ETm4gXIgKNb MOX5PSz2tr5bX/4ZdXeVWBeFkvmQnwPJCoiDy0sDNN8LV80HzZQdy+Cwhq8cBXrR if8I+V3l29gJgujb/M7puWQtYpdGpxYf+HQlqgodYZHcbIc3AjeGrKj8t81uXff5 chZ+vMnlMTedRxSitVO0cYeDRQHWIxg1e3E6IPCNKk8ltXRkEvBiOu88bHkm/k+E 4V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HgMvWHMpRcrUZb1GJBqT+U2sG+4dh+w 1bykhZokWborXY1q7Xdfp18qYWQNfbHOg6l6M1q5bqLPWY77wX09JQGNQPa3 -----END CERTIFICATE----- ````server.key`
```pem -----BEGIN PRIVATE KEY----- MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDm5G/f+FSxgv5c 6x9RneFzF+KFs6Z2tkrkA2hx94cS6TQgprtL28WeEFTjglbUs2LNgkbbS9ZIVfo6 /gcGQbjMije84+B4PYG+VZJRvpcDAXha1TQw+LHepF7ORJilxpk+q7qhTMX3JW87 JKuCZgxGbQjuuZ+jpvavclVBrFWZ8+QXsnTuN/16/KGFctAUzfUZOD/RL7zA3LRl 7c123ROUesffZjTk2AODcnQI8lnLLfgEdhAYl/jVZjF617y7Fk3JaAhKJuIjo9uN EaheAx9qSgjciKRWzz7JCXUG+lZrpwU1GzA1t0Ja+VGHXvxTCnNUq0Eng60Ahvv2 0VXnipn84lxlBL8a3FEIbV36ixE79KnaTSajYp68JAuOIinq+wHV8RdnsMS1mc60 evzBl9XVBLE41TSNGWDssNjMPOJCJRWs6CPqp0CRMfZy5C99vSumXOo6aupCrRXD wVkhYVh8bE6xyy6Jpn+7o7qhYoXOez/3KfIxTzx0Tx+7Rjcwa2ck6LehocXfZxxV NMsI8tOTcD2gGXqsx4sblg8+2QtHlFmwqKxshIm09NBCY8ojYoqgHEdh75MmvPbr 9FkmVKUPa6Am7jDpApoQWVO9B8qENLGu5Bz4RLybjIFrDf/BkdVOwF2VqCCZXspY hSFN8RGfz3RVGN2CFAKu3Js09Z/rIQIDAQABAoICAAcvtv4ZyzEKaoMj2+hJz+Zc 9cAplK9lm+eEf6MeDCzRG1ek0nfy+C/XD31UfwIrYl9F6pF3k8zRxQvbzWyRbebX 3avZ/90rAbdiqT8BsQH3JFk9zfXapInRREe+Dm48EMr791jlfDsY0pR2eLjo484e JXgHFdC3KQue6GGdGb3Ev79JEg1tqrMOp+Xw0K8rfEraDr2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1xiCQh1479w+HMtau5chOE78JxgJGDC7wQoX41H6P jM4F8+WkAgd+Do4SYPH5bBpSf+V6FA== -----END PRIVATE KEY----- ```rabbitmq.conf
like this:Expected behavior
Not triggering a HTTP 500 and not listing the certificate as being about to expire.
Additional context
No response