25
Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari [email protected]

Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

  • Upload
    others

  • View
    26

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Kerberos in Your JVM

An Introduction to Apache Kerby

Kiran [email protected]

Page 2: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Kiran Ayyagari

• Apache Member

• Chairman of Apache Directory Project

• Involved with ApacheDS since 2008

• Independent Consultant

Page 3: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

What is Kerberos?

• An authentication protocol

• Designed to work over untrusted networks

• Passwords are NOT sent over wire

continued…

Page 4: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

What is Kerberos?

• A classical Single SignOn solution

• Authorization at OS host level

Page 5: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

How Does it Work?

Page 6: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Participants

Alice Authentication Server

Ticket Granting Server Bob

Kerberos Server

+

Page 7: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

General Payload Structure

Data in plain text

Ticket

Encrypted Data

Data in plain text

Encrypted Data

TicketGeneral Request/Response Payload

Page 8: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Part - IAuth Request for a Ticket Granting Ticket

Session Key 1 along with a Ticket Granting TicketAlice Authentication

Server

Page 9: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Part - IIRequest for a Ticket to communicate with Bob

Session Key 2 along with a Ticket to communicate with BobAlice Ticket Granting

Server

Page 10: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Part - IIIRequest with the session Ticket to Bob

(Optional) Response to verify that it is Bob indeed (mutual verification)

Alice Bob

Page 11: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Where it is Used?

• on workstations

• in network services like SSH, FTP

In authenticating users

and in Apache Hadoop

Page 12: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Kerberos at Apache?• Part of ApacheDS since 2004

• Written by one person, Enrique Rodriguez

• Tightly coupled with LDAP backend

• Totally reviewed in 2010

• Client implementation was added in 2011

Page 13: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

ApacheDS Kerberos Status?• Functional

• Tightly coupled with Directory Server

• Lacks many features (cross-realm, pkinit, FAST etc..)

• Complex codebase

• Not enough maintainers

Page 14: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

What’s Next?• Zheng Kai from Intel started working on a simplified

codec

• Proposed to bring his effort to Apache Directory Project

• Jiajia Li, Lin Chen and Xu Yanning, all from Intel joined the effort

• Development was apace and resulted in release of a fully functional server and client with several features

Page 15: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Apache Kerby• http://directory.apache.org/kerby

• A Kerberos v5 server written in java

• Can run standalone or in-process

• supports transient and numerous persistent storage options

• Bundled with a client, kadmin and other utilities

• An excellent choice for unit testing kerberized clients and servers

Page 16: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Embedding Kerby KdcServer kdc = new KdcServer(); NettyKdcServerImpl network = new NettyKdcServerImpl(kdc.getKdcSetting()); kdc.setXXX(); // set the basic settings, host, port, protocol and realm kdc.init(); kdc.start();

kadmin = new Kadmin( kdc.getKdcSetting(), kdc.getIdentityService() ); kadmin.createBuiltinPrincipals(); kadmin.addPrincipal( "elecharny", "sha1024" );

// THAT IS ALL ;)

Page 17: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Kerby in Unit Tests @BeforeClass public static void setup() throws Exception { // start KDC // initialize client }

@AfterClass public static void stop() throws Exception { // stop KDC }

@Test public void testGetTGTicket() throws Exception { TgtTicket tgt = client.requestTgtWithPassword("[email protected]", "secret"); assertNotNull(tgt); }

Page 18: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Using Kerberos over HTTP?

• SPNEGO works but won’t work out of box everywhere

• JWT seems promising

Page 19: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

JSON Web Token• A compact URL-safe means of representing

claims to be transferred between two parties

• Contains a Header, Claims and Signature <header>.<claims>.<signature>

• All parts are Base64 encoded individually

• Header: {"typ":"JWT", “alg”:”HS256"}

• Claims: {“iss”:"elecharny", "exp":1300819380}

Page 20: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Example App

https://github.com/kayyagari/krb2jwt

Page 21: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Kerberos Ticket to JWTJWT Header : { "srvtkt": <base64-encoded-Ticket>, "keytype": “aes128-cts-hmac-sha1-96", "alg": “HS512” }

JWT Claims : { "aud": "[email protected]", "exp": "1443706562444", "iat": "1443706262444", "iss": "krb2jwt", "sub": "[email protected]" }

Page 22: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Usecases of Krb2JWT

• HTTP clients communicating via backchannel

• Hadoop nodes

Page 23: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Roadmap

• PKINIT

• Cross-Realm

• OTP based ticket granting

Page 24: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Questions?

http://directory.apache.org/kerby

Page 25: Kerberos in Your JVM - Apache Directorydirectory.apache.org/conference-materials.data/kerberos... · 2015-10-03 · Kerberos in Your JVM An Introduction to Apache Kerby Kiran Ayyagari

Thank You!Zheng Kai and his band at Intel

Emmanuel Lecharny ([email protected])

Stefan Seelmann ([email protected])