Issue with Kerberos

Khapare Joshi khapare77 at gmail.com
Fri Dec 28 12:13:38 CET 2012


Hello all,

Freeradius with MIT kerberos Authentication
===========================================

I have successfully installed and configured MIT kerberos and Freeradius
Authentication. This might be helpful for some people who are interested in
doing this. Perhaps FR guys will add this into their wiki.

Why I am doing this ?
=====================
I have been running Eduroam service on freeradius and Active Directory for
user authentication. In order to use Active Directory, I had
to configure samba and winbind. Lately, I had too many problems
with winbind and samba which require frequent restart the daemon both smb
and winbind. I ended up writing some cron to do this for me. I feel this is
not reliable and looked for alternative solution. I came up
with four different solution.

1. Continue using Freeradius with Active directory for user authentication
and maintain ill winbind plus samba
2. Customize the LDAP (openLdap) so that password can be stored in NT-HASH
or LMHASH or whatever is compatible, so you do not have to worry about SMB,
Winbind
3. Forget about FreeRadius and choose Microsoft IAS or their $ application
so that you do not have to worry samba,winbind freeradius :)
4. Deploy kerberos, integrate with OpenLDAP, configure FreeRadius to use
Kerberos for user authentication.

I preferred point number 4. and implemented, Now since it is working fine I
am thinking of going in production. Here is what I did:

I assume you have already working Kerberos server if not here are the
instruction how to install MIT kerberos in LINUX
http://www.linux-mag.com/id/4738/


1. Add the hostprincipal and service principal for your Freeradius server
kadmin$ ank -randkey radius/radiusserver.example.com at EXAMPLE.COM
kadmin$ ank -randkey host/radiusserver.example.com at EXAMPLE.COM


2. Add user principal for testing:
kadmin$ add_principal krbtesting # this will prompt you a password - just
type whatever you want, in my case I typed krbtesting as my password
your userprincipal will be krbtesting at EXAMPLE.COM

3. you need to dump the keytab file,

kadmin$ ktadd -k /tmp/krb5.keytab host/radiusserver.example.com at EXAMPLE.COM
kadmin$ ktadd -k /tmp/krb5.keytab radius/
radiusserver.example.com at EXAMPLE.COM

4. so you have the keytab file, if you like test it. This can be done as
this :

test15$ kinit -k -t /tmp/krb5.keytab radius/
radiusserver.example.com at EXAMPLE.COM
test15$ kinit -k -t /tmp/krb5.keytab host/
radiusserver.example.com at EXAMPLE.COM


5. Copy krb5.keytab file to your freeradius server

You are done with Kerberos. let install the freeradius

On Centos you can do :
=================
test15# yum install freeradius freeradius-krb5 freeradius-utils -y

For basic kerberos authentication test you just need to configure few files
under /etc/raddb
1. Edit /etc/raddb/modules/krb5.conf and add the following
krb5 {
      keytab = /etc/krb5.keytab # make sure this keytab file is readble by
radius daemon change the path where your keytab file is
      service_principal = radius/radiusserver.example.com
}

2. Add Auth-Type kerberos in /etc/raddb/sites-enabled/default right after
the PAP like this:
Auth-Type Kerberos {
     krb5
}
PS: Kerberos only works with PAP

3. Add DEFAULT AUTH-Type = kerberos (without quote "") on top of your
/etc/raddb/users file

4. Now, start your freeradius in debug mode, radiusd -X

Lets test the authentication, open another terminal and issue the following
command:

test15$ radtest krbtesting krbtesting localhost 0 testing123

Where, username is krbtesting and password is krbtesting, radiusserver is
localhost and seceret is testing123. The aim here is to get Accept-Accept,
here is what I get:

Fri Dec 28 10:50:57 2012 : Info: ++[expiration] returns noop
Fri Dec 28 10:50:57 2012 : Info: ++[logintime] returns noop
Fri Dec 28 10:50:57 2012 : Info: [pap] WARNING! No "known good" password
found for the user.  Authentication may fail because of this.
Fri Dec 28 10:50:57 2012 : Info: ++[pap] returns noop
Fri Dec 28 10:50:57 2012 : Info: Found Auth-Type = Kerberos
Fri Dec 28 10:50:57 2012 : Info: # Executing group from file
/etc/raddb/sites-enabled/default
Fri Dec 28 10:50:57 2012 : Info: +- entering group kerberos {...}
Fri Dec 28 10:50:57 2012 : Debug: rlm_krb5: verify_krb_v5_tgt: host key not
found : Permission denied
Fri Dec 28 10:50:57 2012 : Info: ++[krb5] returns ok
Fri Dec 28 10:50:57 2012 : Auth: Login OK: [krbtesting] (from client
localhost port 0)
Fri Dec 28 10:50:57 2012 : Info: # Executing section post-auth from file
/etc/raddb/sites-enabled/default
Fri Dec 28 10:50:57 2012 : Info: +- entering group post-auth {...}
Fri Dec 28 10:50:57 2012 : Info: [reply_log] expand:
/var/log/radius/radacct/%{Client-IP-Address}/reply-detail-%Y%m%d ->
/var/log/radius/radacct/127.0.0.1/reply-detail-20121228
Fri Dec 28 10:50:57 2012 : Info: [reply_log]
/var/log/radius/radacct/%{Client-IP-Address}/reply-detail-%Y%m%d expands to
/var/log/radius/radacct/127.0.0.1/reply-detail-20121228
Fri Dec 28 10:50:57 2012 : Info: [reply_log] expand: %t -> Fri Dec 28
10:50:57 2012
Fri Dec 28 10:50:57 2012 : Info: ++[reply_log] returns ok
Fri Dec 28 10:50:57 2012 : Info: ++[exec] returns noop
Sending Access-Accept of id 248 to 127.0.0.1 port 34456

The key thing here is to get Login OK and krb5 returns ok, if you see those
you have successfully authenticated against your freeradius with kerberos
server. There is warning and permission denied messages,
see earlier post and Alan's reply.

on your terminal you will see output as this :

[test at test15]# radtest krbtesting krbtesting localhost 0 testing123
Sending Access-Request of id 248 to 127.0.0.1 port 1812
User-Name = "krbtesting"
User-Password = "krbtesting"
NAS-IP-Address = 192.168.1.25
NAS-Port = 0
Message-Authenticator = 0x00000000000000000000000000000000
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=248,
length=20


I have tested EAP-TTLS - PAP with wpa_supplicant and it works well too.
Also I tested following devices that allows EAP-TTLS and PAP:
Sonny Ericksson mobile
samsung galaxy s II
samsung galaxy note
windows 8 (thank you Dr. Bill you enabled other selection apart from PEAP)
Fedora 17
windows 7 requries securew2 to make it work (it works though)

Hope this helps.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20121228/6744fa14/attachment.html>


More information about the Freeradius-Users mailing list