Eric McCoy wrote:
> Some nicknames changed to protect the innocent.  The
> puppetmaster/hostname cert is nominally unrelated, though its creation
> was contemporaneous with the disappearance of server-cert so I can't
> entirely rule it out.
> 
> Certificate Nickname                                         Trust
> Attributes
>                                                             
> SSL,S/MIME,JAR/XPI
> 
> puppetmaster/hostname                     u,u,u
> REALMNAME IPA CA                                             CT,C,C
> ipaCert                                                      u,u,u
> Signing-Cert                                                 u,u,u

Ok, this is good. If we have ipaCert we can get a cert directly from the
CA like we do during installation.

The attached python script should fix things up for you.

Save it, modify it and replace subjectbase with what matches your
environment. You can get the base from an existing cert with:

# certutil -L -d /etc/dirsrv/slapd-REALM -n Server-Cert |grep Subject

Unless you changed it during installation it should be O=<REALM>

Then just run the script:

# python newcert.py
Initializing API
Setting up NSS databases
Untracking existing Apache Server-Cert
Issuing new cert
Tracking Server-Cert

# service httpd start

The only thing this script doesn't do is put this updated certificate in
the service record's LDAP entry.

rob

> 
> 
> On Thu, Oct 23, 2014 at 12:53 PM, Rob Crittenden <rcrit...@redhat.com
> <mailto:rcrit...@redhat.com>> wrote:
> 
>     Eric McCoy wrote:
>     > Hi all,
>     >
>     > I somehow destroyed my primary IPA server's Server-Cert in
>     > /etc/httpd/alias.  I don't understand how or why it happened, all
>     I know
>     > is that I went to restart Apache and it was gone.  Apache won't start,
>     > of course, because the cert is missing.  I can't issue a new cert
>     on the
>     > primary because Apache is down.  I tried using the secondary, but it
>     > fails saying that it can't connect to the web server on the primary
>     > (it's the same error message I get when I try to issue a cert from the
>     > primary).  I can't figure out how to tell ipa-getcert et al. to
>     talk to
>     > the secondary and not the primary.  I'm not using DNS for service
>     > discovery, so I'm not sure how the various tools figure out where
>     things
>     > are.
>     >
>     > This is all on CentOS 6.5 with IPA 3.0.0-37.
>     >
>     >
> 
>     What certs do you have in the database?
> 
>     # certutil -L -d /etc/httpd/alias
> 
>     rob
> 
> 

from ipalib import api
from ipaserver.install import certs
from ipaserver.install.installutils import get_fqdn

# SET THIS TO YOUR ENVIRONMENT
subject_base="O=EXAMPLE.COM"

print "Initializing API"
api.bootstrap(context='fixup')
api.finalize()

fqdn = get_fqdn()
principal = "HTTP/%s@%s" % (fqdn, api.env.realm)

print "Setting up NSS databases"
ca_db = certs.CertDB(api.env.realm, host_name=fqdn, subject_base=subject_base)

db = certs.CertDB(api.env.realm, subject_base=subject_base)

print "Untracking existing Apache Server-Cert"
db.untrack_server_cert("Server-Cert")

print "Issuing new cert"
dercert = db.create_server_cert("Server-Cert", fqdn, ca_db)

print "Tracking Server-Cert"
db.track_server_cert("Server-Cert", principal, db.passwd_fname, 'restart_httpd')
-- 
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go To http://freeipa.org for more info on the project

Reply via email to