<div dir="ltr"><div><div>Martin, this was extremely helpful. I got it to work manually, now all I need to do is automate the process :-)<br></div><div><br>The only thing "missing" from this is that I needed to do "ipa host-add san.host.example.test" before your other "ipa service-add" commands . You mentioned it, but not shown the command, so for those who will want to follow the script, it is an essential part of the process.<br></div><div><br></div>Thank you so much,<br><br></div>-M<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 15, 2014 at 7:53 AM, Martin Kosek <span dir="ltr"><<a href="mailto:mkosek@redhat.com" target="_blank">mkosek@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 09/12/2014 09:19 PM, Dmitri Pal wrote:<br>
> On 09/12/2014 02:43 PM, Michael Lasevich wrote:<br>
>> That is awesome, but I am clearly missing some insight as to how this is<br>
>> supposed to work. Can you point me to some more specific info on how to<br>
>> accomplish this.<br>
>><br>
>> I tried using the ipa-getcert request with multiple -D's from the client, but<br>
>> got :<br>
>><br>
>> ** Insufficient access: You need to be a member of the serviceadmin role to<br>
>> add services<br>
>><br>
>> Unless I am missing something,  I should probably not add each host to<br>
>> "serviceadmins" for security reasons.<br>
><br>
> 4.0 has a new permissions system this might yet to be another use case that we<br>
> might have overlooked.<br>
<br>
</span>Not, not really - this part works well with 4.0.<br>
<span class=""><br>
> I will leave to developers to review this situation on Monday morning.<br>
><br>
>><br>
>> So I then I tried generating a csr via openssl with SANs on the client and<br>
>> then adding it using "ipa cert-request file.csr --prinicple<br>
>> host/${client_hostname}@DOMAIN"  from ipa server as admin (just to be sure)<br>
>> and got this error (where <ALIAS> is the first SAN):<br>
>><br>
>> ** ipa: ERROR: The service principal for subject alt name <ALIAS> in<br>
>> certificate request does not exist<br>
>><br>
>> It sounds like I need to create service principal for each SAN, but I can't<br>
>> seem to figure out how to do it (only allows me to create service prinicpals<br>
>> for existing hosts)<br>
<br>
</span>You need to create an (unused) host for the SAN service first. After that you<br>
can create the service. Dummy service/host entries with appropriate managedby<br>
attribute are used to authorize which host/service.<br>
<br>
I did a quick test with latest FreeIPA 4.0.3 and it worked for me:<br>
<br>
# ipa-getcert request -d /etc/httpd/nssdb -n Server-Cert -K test/`hostname` -N<br>
CN=`hostname`,O=<a href="http://EXAMPLE.COM" target="_blank">EXAMPLE.COM</a> -D san.host.example.test -g 2048<br>
New signing request "20140915143901" added.<br>
<br>
# ipa-getcert list -i 20140915143901<br>
Number of certificates and requests being tracked: 8.<br>
Request ID '20140915143901':<br>
        status: CA_REJECTED<br>
        ca-error: Server at <a href="https://ipa.mkosek-fedora20.test/ipa/xml" target="_blank">https://ipa.mkosek-fedora20.test/ipa/xml</a> denied our<br>
request, giving up: 2100 (RPC failed at server.  Insufficient access: You need<br>
to be a member of the serviceadmin role to add services).<br>
        stuck: yes<br>
        key pair storage:<br>
type=NSSDB,location='/etc/httpd/nssdb',nickname='Server-Cert',token='NSS<br>
Certificate DB'<br>
        certificate: type=NSSDB,location='/etc/httpd/nssdb',nickname='Server-Cert'<br>
        CA: IPA<br>
        issuer:<br>
        subject:<br>
        expires: unknown<br>
        pre-save command:<br>
        post-save command:<br>
        track: yes<br>
        auto-renew: yes<br>
<br>
<br>
This is expected, now the authorization needs to be added:<br>
<br>
# ipa service-add test/`hostname`<br>
# ipa service-add test/san.host.example.test --force<br>
# ipa service-add-host test/san.host.example.test --host `hostname`<br>
  Principal: test/san.host.example.test@MKOSEK-FEDORA20.TEST<br>
  Managed by: san.host.example.test, ipa.mkosek-fedora20.test<br>
-------------------------<br>
Number of members added 1<br>
-------------------------<br>
<br>
<br>
# ipa-getcert resubmit -i 20140915143901<br>
Resubmitting "20140915143901" to "IPA".<br>
<br>
# ipa-getcert list -i 20140915143901<br>
Number of certificates and requests being tracked: 8.<br>
Request ID '20140915143901':<br>
        status: MONITORING<br>
        stuck: no<br>
        key pair storage:<br>
type=NSSDB,location='/etc/httpd/nssdb',nickname='Server-Cert',token='NSS<br>
Certificate DB'<br>
        certificate:<br>
type=NSSDB,location='/etc/httpd/nssdb',nickname='Server-Cert',token='NSS<br>
Certificate DB'<br>
        CA: IPA<br>
        issuer: CN=Certificate Authority,O=MKOSEK-FEDORA20.TEST<br>
        subject: CN=ipa.mkosek-fedora20.test,O=MKOSEK-FEDORA20.TEST<br>
        expires: 2016-09-15 14:48:01 UTC<br>
        dns: san.host.example.test<br>
        principal name: test/ipa.mkosek-fedora20.test@MKOSEK-FEDORA20.TEST<br>
        key usage: digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment<br>
        eku: id-kp-serverAuth,id-kp-clientAuth<br>
        pre-save command:<br>
        post-save command:<br>
        track: yes<br>
        auto-renew: yes<br>
<br>
# certutil -L -d /etc/httpd/nssdb -n Server-Cert<br>
Certificate:<br>
    Data:<br>
        Version: 3 (0x2)<br>
        Serial Number: 11 (0xb)<br>
        Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption<br>
        Issuer: "CN=Certificate Authority,O=MKOSEK-FEDORA20.TEST"<br>
        Validity:<br>
            Not Before: Mon Sep 15 14:48:01 2014<br>
            Not After : Thu Sep 15 14:48:01 2016<br>
        Subject: "CN=ipa.mkosek-fedora20.test,O=MKOSEK-FEDORA20.TEST"<br>
...<br>
            Name: Certificate Subject Alt Name<br>
            DNS name: "san.host.example.test"<br>
...<br>
<br>
<br>
I also updated<br>
<a href="http://www.freeipa.org/page/PKI#Automated_certificate_requests_with_Certmonger" target="_blank">http://www.freeipa.org/page/PKI#Automated_certificate_requests_with_Certmonger</a><br>
with couple hints how that works.<br>
<br>
HTH,<br>
Martin<br>
</blockquote></div><br></div>