Allow host cert renewals even if client auth strictness is false#4852
Allow host cert renewals even if client auth strictness is false#4852yadvr merged 1 commit intoapache:mainfrom
Conversation
plugins/ca/root-ca/src/main/java/org/apache/cloudstack/ca/provider/RootCAProvider.java
Outdated
Show resolved
Hide resolved
...ins/ca/root-ca/src/main/java/org/apache/cloudstack/ca/provider/RootCACustomTrustManager.java
Outdated
Show resolved
Hide resolved
...ins/ca/root-ca/src/main/java/org/apache/cloudstack/ca/provider/RootCACustomTrustManager.java
Show resolved
Hide resolved
0d54a45 to
c6ba1bf
Compare
c6ba1bf to
3a90514
Compare
8a83668 to
b029acf
Compare
|
Update PR with more tests and now when not in strict mode it will still log issues with certificates, but just accept the cert still. |
...ins/ca/root-ca/src/main/java/org/apache/cloudstack/ca/provider/RootCACustomTrustManager.java
Show resolved
Hide resolved
includes updated tests and logging
b029acf to
a56e844
Compare
|
Let me know if i can do anything else to help this along |
|
@sureshanaparti do you approve now? |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ centos7 ✔️ centos8 ✔️ debian. SL-JID 87 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian Build Failed (tid-753) |
|
Trillian test result (tid-764)
|
|
Needs some manual testing/validation, otherwise lgtm |
|
@blueorangutan package |
|
@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ centos7 ✔️ centos8 ✔️ debian. SL-JID 338 |
|
@blueorangutan test |
|
@nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-1070)
|
|
@weizhouapache can you please test this PR? |
There was a problem hiding this comment.
@Slair1 @nvazquez
tested ok. except two small questions.
(1) change global settings (just for my testing, do not set it on production)
ca.framework.cert.expiry.alert.period , from 15 to 1500 (days)
ca.framework.background.task.delay, from 3600 to 60 (seconds)
ca.plugin.root.auth.strictness , from true to false.
(2) add debug info in server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java
try {
- if (LOG.isTraceEnabled()) {
- LOG.trace("CA background task is running...");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("CA background task is running...");
}
(3) without this patch
$ egrep "Certificate is going to expire|CA background task is running" /var/log/cloudstack/management/management-server.log
2021-07-15 07:12:03,827 DEBUG [o.a.c.c.CAManagerImpl] (BackgroundTaskPollManager-2:ctx-59f9ec37) (logid:7d7a59b2) CA background task is running...
2021-07-15 07:13:30,314 DEBUG [o.a.c.c.CAManagerImpl] (BackgroundTaskPollManager-5:ctx-e17c3499) (logid:de3f6c2a) CA background task is running...
2021-07-15 07:14:58,516 DEBUG [o.a.c.c.CAManagerImpl] (BackgroundTaskPollManager-4:ctx-13297c4e) (logid:4dc266a0) CA background task is running...
2021-07-15 07:16:26,420 DEBUG [o.a.c.c.CAManagerImpl] (BackgroundTaskPollManager-5:ctx-13d9b8c4) (logid:10203dcf) CA background task is running...
(4) with the patch
$ egrep "Certificate is going to expire|CA background task is running" /var/log/cloudstack/management/management-server.log
2021-07-15 09:12:13,759 DEBUG [o.a.c.c.CAManagerImpl] (BackgroundTaskPollManager-6:ctx-a913172f) (logid:4c23e662) CA background task is running...
2021-07-15 09:12:13,761 WARN [o.a.c.c.CAManagerImpl] (BackgroundTaskPollManager-6:ctx-a913172f) (logid:4c23e662) Certificate is going to expire for host id=5, uuid=060e2261-8214-4385-b0d4-ce90b6fe2786, name=s-79-VM, ip=10.0.36.8, zone id=1
2021-07-15 09:12:23,912 WARN [o.a.c.c.CAManagerImpl] (BackgroundTaskPollManager-6:ctx-a913172f) (logid:4c23e662) Certificate is going to expire for host id=2, uuid=fd8384ff-fe21-41e2-84ea-bc70e6d26b97, name=v-1-VM, ip=10.0.36.3, zone id=1
2021-07-15 09:12:34,978 WARN [o.a.c.c.CAManagerImpl] (BackgroundTaskPollManager-6:ctx-a913172f) (logid:4c23e662) Certificate is going to expire for host id=1, uuid=4ea38782-280c-4122-aea8-63682c16c115, name=ref-trl-1000-k-Mu20-wei-zhou-kvm2, ip=10.0.34.159, zone id=1
2021-07-15 09:12:40,425 WARN [o.a.c.c.CAManagerImpl] (BackgroundTaskPollManager-6:ctx-a913172f) (logid:4c23e662) Certificate is going to expire for host id=4, uuid=d9988a7b-7e02-4e90-9c4a-798c588b1cba, name=ref-trl-1000-k-Mu20-wei-zhou-kvm1, ip=10.0.33.203, zone id=1
...ins/ca/root-ca/src/main/java/org/apache/cloudstack/ca/provider/RootCACustomTrustManager.java
Show resolved
Hide resolved
| final String errorMsg = String.format("Client certificate has expired with serial=%x, subject=%s from address=%s", | ||
| primaryClientCertificate.getSerialNumber(), primaryClientCertificate.getSubjectDN(), clientAddress); | ||
| LOG.error(errorMsg); | ||
| if (!allowExpiredCertificate) { |
There was a problem hiding this comment.
@Slair1 what if allowExpiredCertificate is true ? log the error and silently ignore it ?
should it be appended to exceptionMsg ?
|
Thanks @weizhouapache, looks good. @Slair1 can you please check the open comment? Then will be good to go |
|
Ping @slavkap thanks for the PR, it seems like an important fix. Can you address the outstanding comment so we can move forward with this PR? |
|
@rhtyd, unfortunately, I don't have anything with this PR |
|
@Slair1 can you address the outstanding comment so we can move forward with this PR? |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 929 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-1722)
|
|
@nvazquez @rhtyd |
|
Merging this based on your comment @weizhouapache |
Description
This PR allows the management servers to renew certificates issued to hosts, even if ca.plugin.root.auth.strictness is false. There is already a global setting named ca.framework.cert.automatic.renewal that should be controlling the certificate renewals. However, ca.plugin.root.auth.strictness currently circumvents that setting.
More Detail
The ca.plugin.root.auth.strictness setting is checked early in the client certificate checking method and exits the method without adding the certificate to the management server's in-memory certificate map if strictness is false. The certificate renewal process (if enabled with ca.framework.cert.automatic.renewal) reads that in-memory certificate map to determine what certs it could renew. Those two settings shouldn't be so closely related.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
We've deployed and tested this in our CloudStack environments.