<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 10, 2016 at 7:43 PM, Sumit Bose <span dir="ltr"><<a href="mailto:sbose@redhat.com" target="_blank">sbose@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">On Wed, Feb 10, 2016 at 12:07:45PM +1100, Nik Lam wrote:<br>
> On Wed, Feb 10, 2016 at 3:04 AM, Sumit Bose <<a href="mailto:sbose@redhat.com">sbose@redhat.com</a>> wrote:<br>
><br>
> > On Wed, Feb 10, 2016 at 02:08:55AM +1100, Nik Lam wrote:<br>
> > > On Mon, Feb 8, 2016 at 11:53 PM, Sumit Bose <<a href="mailto:sbose@redhat.com">sbose@redhat.com</a>> wrote:<br>
> > ><br>
> > > > On Thu, Feb 04, 2016 at 07:25:29PM +1100, Nik Lam wrote:<br>
> > > > > On Wed, Feb 3, 2016 at 8:08 PM, Sumit Bose <<a href="mailto:sbose@redhat.com">sbose@redhat.com</a>> wrote:<br>
> > > > ><br>
> > > > > > On Wed, Feb 03, 2016 at 10:29:49AM +1100, Nik Lam wrote:<br>
> > > > > > > Hello,<br>
> > > > > > ><br>
> > > > > > > I installed ipa-server on Centos 7.1 and later did and upgrade<br>
> > of the<br>
> > > > > > whole<br>
> > > > > > > system to Centos 7.2.<br>
> > > > > > ><br>
> > > > > > > I think the FreeIPA version changed from 4.1.0 to 4.2.0 between<br>
> > these<br>
> > > > > > > Centos/RHEL minor releases.<br>
> > > > > > ><br>
> > > > > > > We'd now like to try integrating with a 2FA provider via a radius<br>
> > > > proxy<br>
> > > > > > and<br>
> > > > > > > want to use anonymous PKINIT to secure the initial communications<br>
> > > > between<br>
> > > > > > > the client and the KDC.<br>
> > > > > > ><br>
> > > > > > > We've tried following the MIT Kerberos PKINIT configuration<br>
> > > > documentation<br>
> > > > > > ><br>
> > > > > > >     <a href="http://web.mit.edu/kerberos/krb5-1.14/doc/admin/pkinit.html" rel="noreferrer" target="_blank">http://web.mit.edu/kerberos/krb5-1.14/doc/admin/pkinit.html</a><br>
> > > > > > ><br>
> > > > > > > generating our own certs manually with openssl but haven't had<br>
> > any<br>
> > > > luck.<br>
> > > > > > > We're seeing this in the kdc log:<br>
> > > > > > ><br>
> > > > > > >     preauth pkinit failed to initialize: No realms configured<br>
> > > > correctly<br>
> > > > > > for<br>
> > > > > > > pkinit support<br>
> > > > > ><br>
> > > > > > Which changes did you apply to krb5.conf? Did you use the IPA CA to<br>
> > > > sign<br>
> > > > > > the certificate or some other CA?<br>
> > > > > ><br>
> > > > > > ><br>
> > > > > > > I've noticed there are many new pkinit-related options that have<br>
> > been<br>
> > > > > > added<br>
> > > > > > > to the ipa-server-install script in 4.2.0, so it looks like<br>
> > PKINIT is<br>
> > > > > > > available in this version of FreeIPA. Is that the case?<br>
> > > > > ><br>
> > > > > > Which options are you referring to?<br>
> > > > > ><br>
> > > > > > bye,<br>
> > > > > > Sumit<br>
> > > > > ><br>
> > > > > > ><br>
> > > > > > > And if it is, what is the recommended way to enable it given<br>
> > that it<br>
> > > > > > seems<br>
> > > > > > > to have been disabled in the original install that I did? Or<br>
> > would it<br>
> > > > > > just<br>
> > > > > > > be easier to start from scratch with a 4.2.0 ipa-server-install?<br>
> > > > (It's a<br>
> > > > > > > test instance that doesn't have too much in it - it will take a<br>
> > > > several<br>
> > > > > > > hours to rebuild from scratch.)<br>
> > > > > > ><br>
> > > > > > > Regards,<br>
> > > > > > ><br>
> > > > > > > Nik<br>
> > > > > ><br>
> > > > > ><br>
> > > > > ><br>
> > > > > Thanks Sumit.<br>
> > > > ><br>
> > > > > It sounds like PKINIT is available but clearly I'm doing it wrong.<br>
> > > > ><br>
> > > > >  > Which changes did you apply to krb5.conf? Did you use the IPA CA<br>
> > to<br>
> > > > sign<br>
> > > > > the certificate or some other CA?<br>
> > > > ><br>
> > > > > Actually, I modified the kdc.conf file - placed the kdc.pem,<br>
> > kdckey.pem<br>
> > > > and<br>
> > > > > cacert.pem files in /var/kerberos/krb5kdc/ that I generated via<br>
> > openssl<br>
> > > > > commands in the MIT Kerberos documentation. The only change to<br>
> > kdc.conf<br>
> > > > > file was to append the location of the kdckey.pem file to<br>
> > > > pkinit_identity.<br>
> > > > ><br>
> > > > >   pkinit_identity = FILE:/var/kerberos/krb5kdc/kdc.pem<br>
> > > > >   pkinit_anchors = FILE:/var/kerberos/krb5kdc/cacert.pem<br>
> > > > ><br>
> > > > > became<br>
> > > > ><br>
> > > > >   pkinit_identity =<br>
> > > > > FILE:/var/kerberos/krb5kdc/kdc.pem,/var/kerberos/krb5kdc/kdckey.pem<br>
> > > > >   pkinit_anchors = FILE:/var/kerberos/krb5kdc/cacert.pem<br>
> > > > ><br>
> > > > > Should I have been modifying krb5.conf instead? It aslo sounds like I<br>
> > > > need<br>
> > > ><br>
> > > > no, kdc.conf is the right place, I actually meant kdc.conf but<br>
> > > > accidentially types krb5.conf.<br>
> > > ><br>
> > > > > to use a certificate signed by the IPAs CA - is this something that<br>
> > > > should<br>
> > > > > be generated using ipa-getcert? Or do I just find the IPA CA's<br>
> > private<br>
> > > > key<br>
> > > > > and use openssl following the MIT Kerberos documentation?<br>
> > > > ><br>
> > > > >  > Which options are you referring to?<br>
> > > > ><br>
> > > > > When I looked at the --help text for 4.1.0 and 4.2.0 versions of<br>
> > > > > ipa-server-install, I noticed that 4.2.0 has these in the<br>
> > "certificate<br>
> > > > > system options":<br>
> > > > ><br>
> > > > >     --no-pkinit         disables pkinit setup steps<br>
> > > > ><br>
> > > > >     --pkinit-cert-file=FILE<br>
> > > > >                         File containing the Kerberos KDC SSL<br>
> > certificate<br>
> > > > and<br>
> > > > >                         private key<br>
> > > > ><br>
> > > > >     --pkinit-pin=PIN    The password to unlock the Kerberos KDC<br>
> > private<br>
> > > > key<br>
> > > > ><br>
> > > > >     --pkinit-cert-name=NAME<br>
> > > > >                         Name of the Kerberos KDC SSL certificate to<br>
> > > > install<br>
> > > > ><br>
> > > > ><br>
> > > > > Seeing that first one, I was a little hopeful that pkinit is enabled<br>
> > by<br>
> > > > > default in 4.2.0 but on a fresh install I just tried, I'm still<br>
> > seeing<br>
> > > > the<br>
> > > ><br>
> > > > no, unfortunately pkinit is currently disabled by default<br>
> > > ><br>
> > > > > following in krb5kdc.log when IPA is started up, so clearly it isn't.<br>
> > > > ><br>
> > > > >   (Error): preauth pkinit failed to initialize: No realms configured<br>
> > > > > correctly for pkinit support<br>
> > > ><br>
> > > > I get the same error when I put the certificate and the key into<br>
> > > > separate files. Can you try to put both into one and use this for the<br>
> > > > pkinit_identity option?<br>
> > > ><br>
> > > > HTH<br>
> > > ><br>
> > > > bye,<br>
> > > > Sumit<br>
> > > ><br>
> > ><br>
> > ><br>
> > > Thanks Sumit, it did!<br>
> > ><br>
> > > I concatenated the cert and the key into a single file and the error has<br>
> > > indeed gone away from krb5kdc.log<br>
> > ><br>
> > > The odd thing is that I can't reproduce the error by splitting into two<br>
> > > separate files and restarting ipa.service again.<br>
> > ><br>
> > > Ignoring that mystery, how do I go about setting up the<br>
> > WELLKNOWN/ANONYMOUS<br>
> > > principal?<br>
> > ><br>
> > > I'm pretty sure it's needed for anonymous pkinit:<br>
> > ><br>
> > > $ kinit<br>
> > > kinit: Generic preauthentication failure while getting initial<br>
> > credentials<br>
> > > $<br>
> > ><br>
> > > $ kinit -n<br>
> > > kinit: Client 'WELLKNOWN/<a href="mailto:ANONYMOUS@EXAMPLE.COM">ANONYMOUS@EXAMPLE.COM</a>' not found in Kerberos<br>
> > > database while getting initial credentials<br>
> > > $<br>
> > ><br>
> > > Using  kadmin per the MIT documentation doesn't seem to work<br>
> > (authenticated<br>
> > > as an IPA admin)<br>
> > ><br>
> > > # kadmin -q 'addprinc -randkey WELLKNOWN/ANONYMOUS'<br>
> > > Authenticating as principal admin/<a href="mailto:admin@EXAMPLE.COM">admin@EXAMPLE.COM</a> with password.<br>
> > > kadmin: Client not found in Kerberos database while initializing kadmin<br>
> > > interface<br>
> > > #<br>
> > ><br>
> > > # kadmin -q 'addprinc -randkey WELLKNOWN/ANONYMOUS' -p admin<br>
> > > Authenticating as principal admin with password.<br>
> > > Password for <a href="mailto:admin@EXAMPLE.COM">admin@EXAMPLE.COM</a>:<br>
> > > WARNING: no policy specified for WELLKNOWN/<a href="mailto:ANONYMOUS@EXAMPLE.COM">ANONYMOUS@EXAMPLE.COM</a>;<br>
> > > defaulting to no policy<br>
> > > add_principal: Operation requires ``add'' privilege while creating<br>
> > > "WELLKNOWN/<a href="mailto:ANONYMOUS@EXAMPLE.COM">ANONYMOUS@EXAMPLE.COM</a>".<br>
> > > #<br>
> ><br>
> > Please try<br>
> ><br>
> >     kadmin.local -x ipa-setup-override-restrictions<br>
> ><br>
> > bye,<br>
> > Sumit<br>
> ><br>
> ><br>
> Thanks Sumit.<br>
><br>
> That seems to have worked to get the principal created.<br>
><br>
> # kadmin.local -x ipa-setup-override-restrictions<br>
> Authenticating as principal admin/<a href="mailto:admin@EXAMPLE.COM">admin@EXAMPLE.COM</a> with password.<br>
> kadmin.local:  addprinc -randkey WELLKNOWN/ANONYMOUS<br>
> WARNING: no policy specified for WELLKNOWN/<a href="mailto:ANONYMOUS@EXAMPLE.COM">ANONYMOUS@EXAMPLE.COM</a>;<br>
> defaulting to no policy<br>
> Principal "WELLKNOWN/<a href="mailto:ANONYMOUS@EXAMPLE.COM">ANONYMOUS@EXAMPLE.COM</a>" created.<br>
> kadmin.local:  quit<br>
> #<br>
><br>
> I'm no longer seeing the error from the client about 'WELLKNOWN/<br>
> <a href="mailto:ANONYMOUS@EXAMPLE.COM">ANONYMOUS@EXAMPLE.COM</a>' not found in Kerberos database.<br>
><br>
> However, I'm being prompted for a password for the anonymous principal.<br>
><br>
> $ kinit -n<br>
> Password for WELLKNOWN/<a href="mailto:ANONYMOUS@EXAMPLE.COM">ANONYMOUS@EXAMPLE.COM</a>:<br>
> kinit: Password incorrect while getting initial credentials<br>
> $<br>
><br>
> That doesn't sound right to me - and indeed it doesn't provide an armor<br>
> cache that I can use for authenticating my client user.<br>
<br>
</div></div>Can you run<br>
<br>
    KRB5_TRACE=/dev/stdout kinit -n<br>
<br>
this will show the list of preauthentication methods offered to the<br>
client and I would suspect that pkinit is not among of them.<br>
<br>
My guess is that there is something wrong with the certificate or the<br>
configuration, e.g. did you try to set pkinit_kdc_hostname to the<br>
hostname matching the one in the KDC certificate? Maybe<br>
pkinit_eku_checking = none might help as well?.<br>
<br>
To analyse this further the most easy way is an instrumented build of<br>
the pkinit module with debugging enabled. If you can tell me the exact<br>
version of your krb5-pkinit package I can prepare a build for you.<br>
<br>
HTH<br>
<br>
bye,<br>
Sumit<br>
</blockquote><div><br></div><div>Thank you Sumit.<br><br></div><div>I've checked that the hostname in the KDC's cert matches what I've put in the client's krb.conf's pkinit_hostname.<br><br></div><div>I've also tried setting pkinit_eku_checking = none in there. <br></div><div><br>$ KRB5_TRACE=/dev/stdout kinit -n<br>[9199] 1455105392.574916: Getting initial credentials for WELLKNOWN/<a href="mailto:ANONYMOUS@EXAMPLE.COM">ANONYMOUS@EXAMPLE.COM</a><br>[9199] 1455105392.575132: Sending request (186 bytes) to <a href="http://EXAMPLE.COM">EXAMPLE.COM</a><br>[9199] 1455105392.575314: Initiating TCP connection to stream <a href="http://10.93.178.73:88">10.93.178.73:88</a><br>[9199] 1455105392.576513: Sending TCP request to stream <a href="http://10.93.178.73:88">10.93.178.73:88</a><br>[9199] 1455105393.370873: Received answer (483 bytes) from stream <a href="http://10.93.178.73:88">10.93.178.73:88</a><br>[9199] 1455105393.370885: Terminating TCP connection to stream <a href="http://10.93.178.73:88">10.93.178.73:88</a><br>[9199] 1455105393.370956: Response was from master KDC<br>[9199] 1455105393.370977: Received error from KDC: -1765328359/Additional pre-authentication required<br>[9199] 1455105393.371014: Processing preauth types: 16, 15, 14, 136, 19, 147, 2, 133<br>[9199] 1455105393.371040: Selected etype info: etype aes256-cts, salt "EXAMPLE.COMWELLKNOWNANONYMOUS", params ""<br>[9199] 1455105393.371046: Received cookie: MIT<br>Password for WELLKNOWN/<a href="mailto:ANONYMOUS@EXAMPLE.COM">ANONYMOUS@EXAMPLE.COM</a>: <br>[9199] 1455105400.912468: AS key obtained for encrypted timestamp: aes256-cts/09BF<br>[9199] 1455105400.912546: Encrypted timestamp (for 1455105400.914484): plain 301AA011180F32303136303231303131353634305AA10502030DF434, encrypted DD840BC3D6F697529D987E73EDD1C9FF82FEC91A0FB408179E6FA9AF49627912BEF49BA4E4EE8FF469BED5672943592A1E7DFBBF781C1E5B<br>[9199] 1455105400.912576: Preauth module encrypted_timestamp (2) (real) returned: 0/Success<br>[9199] 1455105400.912581: Produced preauth for next request: 133, 2<br>[9199] 1455105400.912601: Sending request (281 bytes) to <a href="http://EXAMPLE.COM">EXAMPLE.COM</a><br>[9199] 1455105400.912674: Initiating TCP connection to stream <a href="http://10.93.178.73:88">10.93.178.73:88</a><br>[9199] 1455105400.913894: Sending TCP request to stream <a href="http://10.93.178.73:88">10.93.178.73:88</a><br>[9199] 1455105400.937778: Received answer (197 bytes) from stream <a href="http://10.93.178.73:88">10.93.178.73:88</a><br>[9199] 1455105400.937788: Terminating TCP connection to stream <a href="http://10.93.178.73:88">10.93.178.73:88</a><br>[9199] 1455105400.937835: Response was from master KDC<br>[9199] 1455105400.937852: Received error from KDC: -1765328353/Decrypt integrity check failed<br>kinit: Password incorrect while getting initial credentials<br>$<br><br></div><div>The module package we're using right now is krb5-pkinit-1.13.2-10.el7.x86_64.<br><br></div><div>Regards,<br><br></div><div>Nik<br></div><div> </div></div><br></div></div>