[Freeipa-users] Re: Certificate renewals with external CA

2017-08-29 Thread Rob Crittenden via FreeIPA-users
Rob Foehl wrote:
> On Mon, 19 Jun 2017, Rob Crittenden wrote:
> 
>> Rob Foehl wrote:
>>> On Thu, 15 Jun 2017, Rob Crittenden wrote:
>>>
 Rob Foehl wrote:
> Can I at least get a yes or no on whether external CA certificate
> renewal has ever been tested when that certificate is nearing
> expiration?

 Yes. I tested this with IPA v3.0. Did it break in between? Possible.

 As I pointed out certmonger is unaware of the certificate chain and
 focuses only on the cert not-after date and resubmits the CSR to the CA
 that issued the certificate originally.
>>>
>>> Thanks for the reply.
>>>
>>> certmonger not knowing about the chain is understandable, as is the
>>> resubmission of each tracked cert to the existing CA.  Doing this
>>> results in a pile of certs that expire relatively quickly, being tied to
>>> the old CA, but that's also not surprising -- the surprise is that it
>>> only did that once, and has since appeared to ignore them all, even
>>> after the CA was renewed manually and the newly-issued-but-short-lived
>>> certs tied to the old CA expired.
>>
>> Ok, I'll need to try to reproduce it. It may take me a while to get
>> around to this so feel free to nag me.
> 
> Consider this that, maybe...  I just got around to beating my head
> against this some more myself.  I'm still trying to convince myself that
> use of an external CA is viable, so I'd resurrected the test VM from
> May/June and this time actually managed to sort it out.  More detail below.
> 
> I just duplicated last week's result using an earlier snapshot of the
> same VM and a renewed CA cert with a 3-day validity.  certmonger
> ignored
> every other cert that it already renewed once with the original CA;
> whole system is hosed after the original cert expires.  It's probably
> possible to recover by manually replacing every certificate, but I
> haven't had time to try that.

 certmonger checks at days 28, 7, 3, 2 and 1 before expiration by
 default
 for certificate expiration so it should have looked at the certs at
 least two times, three depending on timing (and really, it's seconds
 before expiration). Did you let the system sit for 3 days before things
 died? Was anything logged to syslog? Moving time forward a day at a
 time
 is insufficient to test this without restarting certmonger.
>>>
>>> I let the original VM snapshot run for a month straight, renewing the
>>> IPA CA by hand after the first round of certmonger-initiated renewals
>>> with 14 days til expiration and on the second attempt after expiration.
>>> The first attempt used another 30-day cert, the second used a 3-day and
>>> was allowed to run straight through.  No time jumps while the VM is
>>> running, and all snapshots with the VM powered off, so it always booted
>>> with an accurate clock.
>>>
>>> certmonger never logged anything after the first renewal cycle on either
>>> attempt.  A 'getcert list' on the long-running VM shows all of the
>>> tracked certificates with an expiration date of 2017-06-24, which
>>> matches the lifetime of the renewed CA cert, but none of the services
>>> attempting to load or use them are happy.
>>
>> It depends on why they aren't happy. Are they not happy due to expired
>> certs or something else?
> 
> They weren't happy due to the expired CA certs, and in some cases the
> leaf certificates hadn't been updated in place due to SELinux denials.

We recently started seeing this as well,
https://bugzilla.redhat.com/show_bug.cgi?id=1481388

This is a frustrating issue as the certificate gets issued but the
places that need to be updated to reflect it aren't which causes a
cascade of failures.

> 
> I'm still not sure why certmonger thought it'd replaced certificates
> when it hadn't, and I don't remember which of the last ~30 snapshots
> left them in this state, or I'd dig deeper :)

Because certmonger doesn't track the pre or post scripts. From
certmonger's perspective (at least in the BZ above) the certificate was
successfully renewed but because of SELinux issues parts of the
post-command script blew up which leaves things in an unhappy state in
general.

> 
>>> But httpd still refuses to start with that NSSDB, and this appears to be
>>> why:
>>>
>>> # certutil -L -n Signing-Cert -d /etc/httpd/alias
>>> Certificate:
>>> Data:
>>> Version: 3 (0x2)
>>> Serial Number: 9 (0x9)
>>> Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption
>>> Issuer: "CN=Certificate Authority,O=EXAMPLE.COM"
>>> Validity:
>>> Not Before: Mon May 08 06:33:16 2017
>>> Not After : Wed Jun 07 06:25:53 2017
>>> Subject: "CN=Object Signing Cert,O=EXAMPLE.COM"
>>
>> mod_nss shouldn't be considering the signing cert so I doubt this is
>> related.
> 
> The startup failures may have been related to the WSGI modules trying to
> connect to other services with expired certs.  Either way, that expire

[Freeipa-users] Re: Certificate renewals with external CA

2017-08-28 Thread Rob Foehl via FreeIPA-users

On Mon, 19 Jun 2017, Rob Crittenden wrote:


Rob Foehl wrote:

On Thu, 15 Jun 2017, Rob Crittenden wrote:


Rob Foehl wrote:

Can I at least get a yes or no on whether external CA certificate
renewal has ever been tested when that certificate is nearing
expiration?


Yes. I tested this with IPA v3.0. Did it break in between? Possible.

As I pointed out certmonger is unaware of the certificate chain and
focuses only on the cert not-after date and resubmits the CSR to the CA
that issued the certificate originally.


Thanks for the reply.

certmonger not knowing about the chain is understandable, as is the
resubmission of each tracked cert to the existing CA.  Doing this
results in a pile of certs that expire relatively quickly, being tied to
the old CA, but that's also not surprising -- the surprise is that it
only did that once, and has since appeared to ignore them all, even
after the CA was renewed manually and the newly-issued-but-short-lived
certs tied to the old CA expired.


Ok, I'll need to try to reproduce it. It may take me a while to get
around to this so feel free to nag me.


Consider this that, maybe...  I just got around to beating my head against 
this some more myself.  I'm still trying to convince myself that use of an 
external CA is viable, so I'd resurrected the test VM from May/June and 
this time actually managed to sort it out.  More detail below.



I just duplicated last week's result using an earlier snapshot of the
same VM and a renewed CA cert with a 3-day validity.  certmonger ignored
every other cert that it already renewed once with the original CA;
whole system is hosed after the original cert expires.  It's probably
possible to recover by manually replacing every certificate, but I
haven't had time to try that.


certmonger checks at days 28, 7, 3, 2 and 1 before expiration by default
for certificate expiration so it should have looked at the certs at
least two times, three depending on timing (and really, it's seconds
before expiration). Did you let the system sit for 3 days before things
died? Was anything logged to syslog? Moving time forward a day at a time
is insufficient to test this without restarting certmonger.


I let the original VM snapshot run for a month straight, renewing the
IPA CA by hand after the first round of certmonger-initiated renewals
with 14 days til expiration and on the second attempt after expiration.
The first attempt used another 30-day cert, the second used a 3-day and
was allowed to run straight through.  No time jumps while the VM is
running, and all snapshots with the VM powered off, so it always booted
with an accurate clock.

certmonger never logged anything after the first renewal cycle on either
attempt.  A 'getcert list' on the long-running VM shows all of the
tracked certificates with an expiration date of 2017-06-24, which
matches the lifetime of the renewed CA cert, but none of the services
attempting to load or use them are happy.


It depends on why they aren't happy. Are they not happy due to expired
certs or something else?


They weren't happy due to the expired CA certs, and in some cases the leaf 
certificates hadn't been updated in place due to SELinux denials.


I'm still not sure why certmonger thought it'd replaced certificates when 
it hadn't, and I don't remember which of the last ~30 snapshots left them 
in this state, or I'd dig deeper :)



But httpd still refuses to start with that NSSDB, and this appears to be
why:

# certutil -L -n Signing-Cert -d /etc/httpd/alias
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 9 (0x9)
Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption
Issuer: "CN=Certificate Authority,O=EXAMPLE.COM"
Validity:
Not Before: Mon May 08 06:33:16 2017
Not After : Wed Jun 07 06:25:53 2017
Subject: "CN=Object Signing Cert,O=EXAMPLE.COM"


mod_nss shouldn't be considering the signing cert so I doubt this is
related.


The startup failures may have been related to the WSGI modules trying to 
connect to other services with expired certs.  Either way, that expired CA 
cert is what gets presented to HTTPS clients, so it's still a problem.



Does certmonger know how to replace the entire certificate chain in the
respective store(s)?

(The third certificate in there, ipaCert / CN=IPA RA, has the same dates
as the Server-Cert above.)


So it was renewed as well.

certmonger doesn't push out new chains so if that changed in between
that would do it. This is another way to test cert validation from the
command-line:

# certutil -V -u V -d /etc/httpd/alias -n Server-Cert

If you want to see if updating the CA cert(s) makes any difference.





Even in a worst-case scenario, where all the certs expire, it is a
fairly straightforward process to get the services back up by going back
in time, renewing the IPA CA then restarting certmonger to renew the
service certificates.

Is it perfect? No. A search of the users forum should make 

[Freeipa-users] Re: Certificate renewals with external CA

2017-06-19 Thread Rob Crittenden via FreeIPA-users
Rob Foehl wrote:
> On Thu, 15 Jun 2017, Rob Crittenden wrote:
> 
>> Rob Foehl wrote:
>>> Can I at least get a yes or no on whether external CA certificate
>>> renewal has ever been tested when that certificate is nearing
>>> expiration?
>>
>> Yes. I tested this with IPA v3.0. Did it break in between? Possible.
>>
>> As I pointed out certmonger is unaware of the certificate chain and
>> focuses only on the cert not-after date and resubmits the CSR to the CA
>> that issued the certificate originally.
> 
> Thanks for the reply.
> 
> certmonger not knowing about the chain is understandable, as is the
> resubmission of each tracked cert to the existing CA.  Doing this
> results in a pile of certs that expire relatively quickly, being tied to
> the old CA, but that's also not surprising -- the surprise is that it
> only did that once, and has since appeared to ignore them all, even
> after the CA was renewed manually and the newly-issued-but-short-lived
> certs tied to the old CA expired.

Ok, I'll need to try to reproduce it. It may take me a while to get
around to this so feel free to nag me.

>>> I just duplicated last week's result using an earlier snapshot of the
>>> same VM and a renewed CA cert with a 3-day validity.  certmonger ignored
>>> every other cert that it already renewed once with the original CA;
>>> whole system is hosed after the original cert expires.  It's probably
>>> possible to recover by manually replacing every certificate, but I
>>> haven't had time to try that.
>>
>> certmonger checks at days 28, 7, 3, 2 and 1 before expiration by default
>> for certificate expiration so it should have looked at the certs at
>> least two times, three depending on timing (and really, it's seconds
>> before expiration). Did you let the system sit for 3 days before things
>> died? Was anything logged to syslog? Moving time forward a day at a time
>> is insufficient to test this without restarting certmonger.
> 
> I let the original VM snapshot run for a month straight, renewing the
> IPA CA by hand after the first round of certmonger-initiated renewals
> with 14 days til expiration and on the second attempt after expiration. 
> The first attempt used another 30-day cert, the second used a 3-day and
> was allowed to run straight through.  No time jumps while the VM is
> running, and all snapshots with the VM powered off, so it always booted
> with an accurate clock.
> 
> certmonger never logged anything after the first renewal cycle on either
> attempt.  A 'getcert list' on the long-running VM shows all of the
> tracked certificates with an expiration date of 2017-06-24, which
> matches the lifetime of the renewed CA cert, but none of the services
> attempting to load or use them are happy.

It depends on why they aren't happy. Are they not happy due to expired
certs or something else?

[snip]

> 
> But httpd still refuses to start with that NSSDB, and this appears to be
> why:
> 
> # certutil -L -n Signing-Cert -d /etc/httpd/alias
> Certificate:
> Data:
> Version: 3 (0x2)
> Serial Number: 9 (0x9)
> Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption
> Issuer: "CN=Certificate Authority,O=EXAMPLE.COM"
> Validity:
> Not Before: Mon May 08 06:33:16 2017
> Not After : Wed Jun 07 06:25:53 2017
> Subject: "CN=Object Signing Cert,O=EXAMPLE.COM"

mod_nss shouldn't be considering the signing cert so I doubt this is
related.

> 
> Does certmonger know how to replace the entire certificate chain in the
> respective store(s)?
> 
> (The third certificate in there, ipaCert / CN=IPA RA, has the same dates
> as the Server-Cert above.)

So it was renewed as well.

certmonger doesn't push out new chains so if that changed in between
that would do it. This is another way to test cert validation from the
command-line:

# certutil -V -u V -d /etc/httpd/alias -n Server-Cert

If you want to see if updating the CA cert(s) makes any difference.

> 
> 
>> Even in a worst-case scenario, where all the certs expire, it is a
>> fairly straightforward process to get the services back up by going back
>> in time, renewing the IPA CA then restarting certmonger to renew the
>> service certificates.
>>
>> Is it perfect? No. A search of the users forum should make that
>> apparent. It has been difficult to reproduce the failures because it's
>> difficult to simulate by moving time around. Several years ago I left
>> VMs running for months to try to simulate failures and it always worked
>> for me.
> 
> I haven't tried kicking the clock around yet...  The second attempt
> booted from a month-old snapshot and immediately blew itself up;
> renewing the CA cert and restarting certmonger (really, the whole VM)
> didn't change anything.

If the chain changes then yeah, that'd cause problems.

>> Note too that there is a difference between certmonger and the renewals.
>> certmonger renews certs but there are helpers that need to fire off to
>> update information with

[Freeipa-users] Re: Certificate renewals with external CA

2017-06-15 Thread Rob Foehl via FreeIPA-users

On Thu, 15 Jun 2017, Rob Crittenden wrote:


Rob Foehl wrote:

Can I at least get a yes or no on whether external CA certificate
renewal has ever been tested when that certificate is nearing expiration?


Yes. I tested this with IPA v3.0. Did it break in between? Possible.

As I pointed out certmonger is unaware of the certificate chain and
focuses only on the cert not-after date and resubmits the CSR to the CA
that issued the certificate originally.


Thanks for the reply.

certmonger not knowing about the chain is understandable, as is the 
resubmission of each tracked cert to the existing CA.  Doing this results 
in a pile of certs that expire relatively quickly, being tied to the old 
CA, but that's also not surprising -- the surprise is that it only did 
that once, and has since appeared to ignore them all, even after the CA 
was renewed manually and the newly-issued-but-short-lived certs tied to 
the old CA expired.



I just duplicated last week's result using an earlier snapshot of the
same VM and a renewed CA cert with a 3-day validity.  certmonger ignored
every other cert that it already renewed once with the original CA;
whole system is hosed after the original cert expires.  It's probably
possible to recover by manually replacing every certificate, but I
haven't had time to try that.


certmonger checks at days 28, 7, 3, 2 and 1 before expiration by default
for certificate expiration so it should have looked at the certs at
least two times, three depending on timing (and really, it's seconds
before expiration). Did you let the system sit for 3 days before things
died? Was anything logged to syslog? Moving time forward a day at a time
is insufficient to test this without restarting certmonger.


I let the original VM snapshot run for a month straight, renewing the IPA 
CA by hand after the first round of certmonger-initiated renewals with 14 
days til expiration and on the second attempt after expiration.  The first 
attempt used another 30-day cert, the second used a 3-day and was allowed 
to run straight through.  No time jumps while the VM is running, and all 
snapshots with the VM powered off, so it always booted with an accurate 
clock.


certmonger never logged anything after the first renewal cycle on either 
attempt.  A 'getcert list' on the long-running VM shows all of the tracked 
certificates with an expiration date of 2017-06-24, which matches the 
lifetime of the renewed CA cert, but none of the services attempting to 
load or use them are happy.


Now that I poke around some more, here's a wrinkle:

# getcert list -d /etc/httpd/alias -n Server-Cert
Number of certificates and requests being tracked: 8.
Request ID '20170508063315':
status: MONITORING
stuck: no
key pair storage: 
type=NSSDB,location='/etc/httpd/alias',nickname='Server-Cert',token='NSS 
Certificate DB',pinfile='/etc/httpd/alias/pwdfile.txt'
certificate: 
type=NSSDB,location='/etc/httpd/alias',nickname='Server-Cert',token='NSS 
Certificate DB'
CA: IPA
issuer: CN=Certificate Authority,O=EXAMPLE.COM
subject: CN=ipa1.example.com,O=EXAMPLE.COM
expires: 2017-06-24 04:32:24 UTC
dns: ipa1.example.com
principal name: HTTP/ipa1.example@example.com
key usage: 
digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment
eku: id-kp-serverAuth,id-kp-clientAuth
pre-save command:
post-save command: /usr/libexec/ipa/certmonger/restart_httpd
track: yes
auto-renew: yes

So certmonger thinks it renewed that, and indeed that certificate is now 
tied to the new IPA CA lifetime *and* was renewed a week after the 
original IPA CA renewal on May 24 (even though this was never logged):


# certutil -L -n Server-Cert -d /etc/httpd/alias
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 19 (0x13)
Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption
Issuer: "CN=Certificate Authority,O=EXAMPLE.COM"
Validity:
Not Before: Wed May 31 14:52:53 2017
Not After : Sat Jun 24 04:32:24 2017
Subject: "CN=ipa1.example.com,O=EXAMPLE.COM"

But httpd still refuses to start with that NSSDB, and this appears to be 
why:


# certutil -L -n Signing-Cert -d /etc/httpd/alias
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 9 (0x9)
Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption
Issuer: "CN=Certificate Authority,O=EXAMPLE.COM"
Validity:
Not Before: Mon May 08 06:33:16 2017
Not After : Wed Jun 07 06:25:53 2017
Subject: "CN=Object Signing Cert,O=EXAMPLE.COM"


Does certmonger know how to replace the entire certificate chain in the 
respective store(s)?


(The third certificate in there, ipaCert / CN=IPA RA, has the same dates 
as the Server-Cert above.)




Even in a worst-case scenario, where all the certs expire, it is a
fairly straightforward process to get the service

[Freeipa-users] Re: Certificate renewals with external CA

2017-06-15 Thread Rob Crittenden via FreeIPA-users
Rob Foehl wrote:
> On Fri, 9 Jun 2017, I wrote:
> 
>> In short, that didn't go particularly well at all, which in some ways
>> brings me back to the original as-yet-unanswered deployment question:
>>
>> Is trying to do this with an external CA worth the pain?
> 
> Three attempts at this question, and zero answers...

Things slip through the cracks.

> Can I at least get a yes or no on whether external CA certificate
> renewal has ever been tested when that certificate is nearing expiration?

Yes. I tested this with IPA v3.0. Did it break in between? Possible.

As I pointed out certmonger is unaware of the certificate chain and
focuses only on the cert not-after date and resubmits the CSR to the CA
that issued the certificate originally.

> I just duplicated last week's result using an earlier snapshot of the
> same VM and a renewed CA cert with a 3-day validity.  certmonger ignored
> every other cert that it already renewed once with the original CA;
> whole system is hosed after the original cert expires.  It's probably
> possible to recover by manually replacing every certificate, but I
> haven't had time to try that.

certmonger checks at days 28, 7, 3, 2 and 1 before expiration by default
for certificate expiration so it should have looked at the certs at
least two times, three depending on timing (and really, it's seconds
before expiration). Did you let the system sit for 3 days before things
died? Was anything logged to syslog? Moving time forward a day at a time
is insufficient to test this without restarting certmonger.

Even in a worst-case scenario, where all the certs expire, it is a
fairly straightforward process to get the services back up by going back
in time, renewing the IPA CA then restarting certmonger to renew the
service certificates.

Is it perfect? No. A search of the users forum should make that
apparent. It has been difficult to reproduce the failures because it's
difficult to simulate by moving time around. Several years ago I left
VMs running for months to try to simulate failures and it always worked
for me.

Note too that there is a difference between certmonger and the renewals.
certmonger renews certs but there are helpers that need to fire off to
update information within IPA as well and to distribute updated
certificates to replicas. These scripts were updated significantly since
I wrote them to be much more robust in terms of reliability and logging.

rob
___
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org


[Freeipa-users] Re: Certificate renewals with external CA

2017-06-14 Thread Rob Foehl via FreeIPA-users

On Fri, 9 Jun 2017, I wrote:

In short, that didn't go particularly well at all, which in some ways brings 
me back to the original as-yet-unanswered deployment question:


Is trying to do this with an external CA worth the pain?


Three attempts at this question, and zero answers...

Can I at least get a yes or no on whether external CA certificate renewal 
has ever been tested when that certificate is nearing expiration?


I just duplicated last week's result using an earlier snapshot of the same 
VM and a renewed CA cert with a 3-day validity.  certmonger ignored every 
other cert that it already renewed once with the original CA; whole system 
is hosed after the original cert expires.  It's probably possible to 
recover by manually replacing every certificate, but I haven't had time to 
try that.


-Rob
___
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org


[Freeipa-users] Re: Certificate renewals with external CA

2017-06-08 Thread Rob Foehl via FreeIPA-users

On Fri, 26 May 2017, Rob Crittenden wrote:


Rob Foehl via FreeIPA-users wrote:

On Fri, 26 May 2017, Fraser Tweedale wrote:


What is the validity of the leaf certificates?  Is the notAfter time
of the leaf certificate pegged to the notAfter time of the CA
certificate?  If so, this is (IMO) a bug.


The leaf certs' expiration is pegged to that of the CA cert that was
used to issue them -- the old one, in this case -- but that is expected
behavior for any CA.  It wouldn't be semantically valid otherwise, and
there's no guarantee that the CA cert will actually be renewed without
changing the key.

The odd behavior here is that certmonger woke up, noticed that every IPA
cert including the externally-signed IPA CA needed to be renewed, and
immediately caused the CA to renew them all.  The IPA CA cert itself
yielded a log entry like this:

May 25 00:25:21 ipa.example.com dogtag-ipa-ca-renew-agent-submit[868]:
Certificate with subject 'CN=Certificate Authority,O=EXAMPLE.COM' is
about to expire, use ipa-cacert-manage to renew it

The other 7 or so IPA-generated certificates (host, RA, OCSP, etc.) were
renewed using the existing CA cert, with new validity periods tied to
that cert.  As mentioned, certmonger would likely figure this out and
renew them all again using the since-replaced CA cert within the ~2 week
period until they all expire again, but this seems like unexpected
behavior when the IPA CA cert is signed by an external CA and can't be
auto-renewed.

(Actually, based on the order the renewals were submitted, this seems
like it'd be an issue even if the CA cert were automatically renewed --
it wasn't the first one to be submitted, either.  Incidentally, the
certs which were renewed aren't a complete list -- both the
"CN=ipa-ca-agent" and "CN=Object Signing Cert" certs weren't renewed and
aren't tracked by certmonger.)


certmonger doesn't have the context to know internal vs external. It
just knows a cert is expiring within its window so it renews it. IMHO
this is completely expected.


Right, I wouldn't expect it to know the provenance of the CA cert...  I am 
wondering whether it should be able to recognize the dependency between 
the certs, though -- it should be able to recognize the chain, at least.



I believe that certmonger will renew it again as the final day approaches.


So, out of curiosity, I left the VM running through the original CA 
expiration date to see what would happen.  The results aren't pretty:


- the running httpd kept using the old certificate (and CA chain), which
  broke https sessions to the UI/API (as might be expected);

- certmonger thinks it's renewed everything, with the new expiration dates
  lined up with that of the replaced external CA;

- none of the services recognize that they have new certs installed, for
  example the same httpd issue as seen in another thread:

[Fri Jun 09 01:07:37.413789 2017] [:error] [pid 14616] SSL Library Error: -8162 
The certificate issuer's certificate has expired. Check your system date and 
time
[Fri Jun 09 01:07:37.413828 2017] [:error] [pid 14616] Unable to verify certificate 
'Server-Cert'. Add "NSSEnforceValidCerts off" to nss.conf so the server can 
start until the problem can be resolved.

 vs.

# getcert list -d /etc/httpd/alias -n Server-Cert
Number of certificates and requests being tracked: 8.
Request ID '20170508063315':
status: MONITORING
stuck: no
key pair storage: 
type=NSSDB,location='/etc/httpd/alias',nickname='Server-Cert',token='NSS 
Certificate DB',pinfile='/etc/httpd/alias/pwdfile.txt'
certificate: 
type=NSSDB,location='/etc/httpd/alias',nickname='Server-Cert',token='NSS 
Certificate DB'
CA: IPA
issuer: CN=Certificate Authority,O=EXAMPLE.COM
subject: CN=ipa1.example.com,O=EXAMPLE.COM
expires: 2017-06-24 04:32:24 UTC
dns: ipa1.example.com
principal name: HTTP/ipa1.example@example.com
key usage: 
digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment
eku: id-kp-serverAuth,id-kp-clientAuth
pre-save command:
post-save command: /usr/libexec/ipa/certmonger/restart_httpd
track: yes
auto-renew: yes

- neither httpd nor pki-tomcatd will (re)start as a result, the former
  fails and the latter just spews stack traces into the logs every
  minute if forcibly started (even if httpd is band-aided first):

Jun 09 01:14:24 ipa1.example.com server[15236]: WARNING: Exception processing 
realm com.netscape.cms.tomcat.ProxyRealm@43523130 background process
Jun 09 01:14:24 ipa1.example.com server[15236]: 
javax.ws.rs.ServiceUnavailableException: Subsystem unavailable
Jun 09 01:14:24 ipa1.example.com server[15236]: at 
com.netscape.cms.tomcat.ProxyRealm.backgroundProcess(ProxyRealm.java:130)
Jun 09 01:14:24 ipa1.example.com server[15236]: at 
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1154)
Jun 09 01:14:24 ipa1.example.com server[15236]:   

[Freeipa-users] Re: Certificate renewals with external CA

2017-05-26 Thread Rob Crittenden via FreeIPA-users
Rob Foehl via FreeIPA-users wrote:
> On Fri, 26 May 2017, Fraser Tweedale wrote:
> 
>> What is the validity of the leaf certificates?  Is the notAfter time
>> of the leaf certificate pegged to the notAfter time of the CA
>> certificate?  If so, this is (IMO) a bug.
> 
> The leaf certs' expiration is pegged to that of the CA cert that was
> used to issue them -- the old one, in this case -- but that is expected
> behavior for any CA.  It wouldn't be semantically valid otherwise, and
> there's no guarantee that the CA cert will actually be renewed without
> changing the key.
> 
> The odd behavior here is that certmonger woke up, noticed that every IPA
> cert including the externally-signed IPA CA needed to be renewed, and
> immediately caused the CA to renew them all.  The IPA CA cert itself
> yielded a log entry like this:
> 
> May 25 00:25:21 ipa.example.com dogtag-ipa-ca-renew-agent-submit[868]:
> Certificate with subject 'CN=Certificate Authority,O=EXAMPLE.COM' is
> about to expire, use ipa-cacert-manage to renew it
> 
> The other 7 or so IPA-generated certificates (host, RA, OCSP, etc.) were
> renewed using the existing CA cert, with new validity periods tied to
> that cert.  As mentioned, certmonger would likely figure this out and
> renew them all again using the since-replaced CA cert within the ~2 week
> period until they all expire again, but this seems like unexpected
> behavior when the IPA CA cert is signed by an external CA and can't be
> auto-renewed.
> 
> (Actually, based on the order the renewals were submitted, this seems
> like it'd be an issue even if the CA cert were automatically renewed --
> it wasn't the first one to be submitted, either.  Incidentally, the
> certs which were renewed aren't a complete list -- both the
> "CN=ipa-ca-agent" and "CN=Object Signing Cert" certs weren't renewed and
> aren't tracked by certmonger.)

certmonger doesn't have the context to know internal vs external. It
just knows a cert is expiring within its window so it renews it. IMHO
this is completely expected.

I believe that certmonger will renew it again as the final day approaches.

The object signing cert is deprecated and not used (it was used to sign
a JAR file to automatically configure Firefox). The ipa-ca-agent cert
isn't used either, it is an artifact of the dogtag install.

rob
___
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org


[Freeipa-users] Re: Certificate renewals with external CA

2017-05-25 Thread Rob Foehl via FreeIPA-users

On Fri, 26 May 2017, Fraser Tweedale wrote:


What is the validity of the leaf certificates?  Is the notAfter time
of the leaf certificate pegged to the notAfter time of the CA
certificate?  If so, this is (IMO) a bug.


The leaf certs' expiration is pegged to that of the CA cert that was used 
to issue them -- the old one, in this case -- but that is expected 
behavior for any CA.  It wouldn't be semantically valid otherwise, and 
there's no guarantee that the CA cert will actually be renewed without 
changing the key.


The odd behavior here is that certmonger woke up, noticed that every IPA 
cert including the externally-signed IPA CA needed to be renewed, and 
immediately caused the CA to renew them all.  The IPA CA cert itself 
yielded a log entry like this:


May 25 00:25:21 ipa.example.com dogtag-ipa-ca-renew-agent-submit[868]: 
Certificate with subject 'CN=Certificate Authority,O=EXAMPLE.COM' is about to 
expire, use ipa-cacert-manage to renew it

The other 7 or so IPA-generated certificates (host, RA, OCSP, etc.) were 
renewed using the existing CA cert, with new validity periods tied to that 
cert.  As mentioned, certmonger would likely figure this out and renew 
them all again using the since-replaced CA cert within the ~2 week period 
until they all expire again, but this seems like unexpected behavior when 
the IPA CA cert is signed by an external CA and can't be auto-renewed.


(Actually, based on the order the renewals were submitted, this seems like 
it'd be an issue even if the CA cert were automatically renewed -- it 
wasn't the first one to be submitted, either.  Incidentally, the certs 
which were renewed aren't a complete list -- both the "CN=ipa-ca-agent" 
and "CN=Object Signing Cert" certs weren't renewed and aren't tracked by 
certmonger.)


-Rob
___
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org


[Freeipa-users] Re: Certificate renewals with external CA

2017-05-25 Thread Fraser Tweedale via FreeIPA-users
On Thu, May 25, 2017 at 10:59:11AM -0400, Rob Foehl via FreeIPA-users wrote:
> On Thu, 25 May 2017, Fraser Tweedale wrote:
> 
> > This is not correct.  The CA cert must be valid for the leaf cert to
> > be valid, but the CA cert *can* be renewed without requiring leaf
> > certificates to be reissued.  So long as the following conditions
> > are met, everything will be fine:
> > 
> > 1. The CA's key (and Subject Key Identifier) do not change
> > 2. The CA's Subject DN does not change
> > 3. The new CA certificate gets distributed to clients.
> 
> Huh?  The CA cert's validity wasn't in question -- it was still valid, and
> was used to issue a slew of new certificates, all of which expire in two
> weeks, at expiration of the original CA cert.  It has since been renewed,
> but that doesn't change the state of any of the leaf certs issued in the
> interim.  Also not sure what the list of conditions has to do with anything,
> when it's up to "ipa-cacert-manage renew" to get those right.
> 
> -Rob
>
What is the validity of the leaf certificates?  Is the notAfter time
of the leaf certificate pegged to the notAfter time of the CA
certificate?  If so, this is (IMO) a bug.

Thanks,
Fraser
___
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org


[Freeipa-users] Re: Certificate renewals with external CA

2017-05-25 Thread Rob Foehl via FreeIPA-users

On Thu, 25 May 2017, Fraser Tweedale wrote:


This is not correct.  The CA cert must be valid for the leaf cert to
be valid, but the CA cert *can* be renewed without requiring leaf
certificates to be reissued.  So long as the following conditions
are met, everything will be fine:

1. The CA's key (and Subject Key Identifier) do not change
2. The CA's Subject DN does not change
3. The new CA certificate gets distributed to clients.


Huh?  The CA cert's validity wasn't in question -- it was still valid, and 
was used to issue a slew of new certificates, all of which expire in two 
weeks, at expiration of the original CA cert.  It has since been renewed, 
but that doesn't change the state of any of the leaf certs issued in the 
interim.  Also not sure what the list of conditions has to do with 
anything, when it's up to "ipa-cacert-manage renew" to get those right.


-Rob
___
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org


[Freeipa-users] Re: Certificate renewals with external CA

2017-05-25 Thread Fraser Tweedale via FreeIPA-users
On Thu, May 25, 2017 at 01:34:16AM -0400, Rob Foehl via FreeIPA-users wrote:
> I've got a test instance of FreeIPA 4.4.4 running on F25 that was installed
> with --external-ca, and the resulting CSR signed with a validity period of
> 30 days to test behavior around expirations.
> 
> Upon booting that instance today, certmonger decided to preemptively renew
> every IPA cert -- which is a good thing -- but did so without waiting for
> renewal of the IPA CA cert first, which is less good.  Now that instance has
> a pile of certs that expire in two weeks, since they were signed with and
> thus tied to the expiration of the old IPA CA cert.
> 
This is not correct.  The CA cert must be valid for the leaf cert to
be valid, but the CA cert *can* be renewed without requiring leaf
certificates to be reissued.  So long as the following conditions
are met, everything will be fine:

1. The CA's key (and Subject Key Identifier) do not change
2. The CA's Subject DN does not change
3. The new CA certificate gets distributed to clients.

Cheers,
Fraser

> While I'm guessing certmonger will figure this out and do the right thing
> within a couple weeks -- and with the expectation that this would only
> happen once per IPA CA renewal with a "real" deployment -- is this the
> intended behavior?
> 
> Logs are a bit of a mess between this and a potentially-resolved SELinux
> issue with certmonger, but I'll wedge them all into a proper bug report if
> desired.
> 
> -Rob
> ___
> FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
> To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org
___
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org