官网:https://web.mit.edu/kerberos/
What is Kerberos?
官网解释如下:
Kerberos is a network authentication protocol. It is designed to provide strong authentication for client/server applications by using secret-key cryptography. A free implementation of this protocol is available from the Massachusetts Institute of Technology. Kerberos is available in many commercial products as well.
The Internet is an insecure place. Many of the protocols used in the Internet do not provide any security. Tools to "sniff" passwords off of the network are in common use by malicious hackers. Thus, applications which send an unencrypted password over the network are extremely vulnerable. Worse yet, other client/server applications rely on the client program to be "honest" about the identity of the user who is using it. Other applications rely on the client to restrict its activities to those which it is allowed to do, with no other enforcement by the server.
Some sites attempt to use firewalls to solve their network security problems. Unfortunately, firewalls assume that "the bad guys" are on the outside, which is often a very bad assumption. Most of the really damaging incidents of computer crime are carried out by insiders. Firewalls also have a significant disadvantage in that they restrict how your users can use the Internet. (After all, firewalls are simply a less extreme example of the dictum that there is nothing more secure than a computer which is not connected to the network --- and powered off!) In many places, these restrictions are simply unrealistic and unacceptable.
Kerberos was created by MIT as a solution to these network security problems. The Kerberos protocol uses strong cryptography so that a client can prove its identity to a server (and vice versa) across an insecure network connection. After a client and server has used Kerberos to prove their identity, they can also encrypt all of their communications to assure privacy and data integrity as they go about their business.
Kerberos is freely available from MIT, under copyright permissions very similar those used for the BSD operating system and the X Window System. MIT provides Kerberos in source form so that anyone who wishes to use it may look over the code for themselves and assure themselves that the code is trustworthy. In addition, for those who prefer to rely on a professionally supported product, Kerberos is available as a product from many different vendors.
In summary, Kerberos is a solution to your network security problems. It provides the tools of authentication and strong cryptography over the network to help you secure your information systems across your entire enterprise. We hope you find Kerberos as useful as it has been to us. At MIT, Kerberos has been invaluable to our Information/Technology architecture.
什么是Kerberos
简单地说,Kerberos提供了一种单点登录 (Single Sign-On, SSO)的方法。考虑这样一个场景,在一个网络中有不同的服务器,比如,打印服务器、邮件服务器和文件服务器。这些服务器都有认证的需求。很自然的,不可能让每个服务器自己实现一套认证系统,而是提供一个中心认证服务器(Authentication Server, AS)供这些服务器使用。这样任何客户端就只需维护一个密码就能登录所有服务器。
Kerberos协议是一个基于票据(Ticket)的系统,在Kerberos系统中至少有三个角色:认证服务器(AS),客户端(Client)和普通服务器(Server)。
认证服务器对用户进行验证,并发行供用户用来请求会话票据的TGT(票据授予票据)。票据授予服务(TGS)在发行给客户的TGT的基础上,为网络服务发行ST(会话票据)。
在Kerberos系统中,客户端和服务器都有一个唯一的名字,叫做Principal。同时,客户端和服务器都有自己的密码,并且它们的密码只有自己和认证服务器AS知道。
名词解释
Principal(安全个体):被认证的个体,有一个名字(name)和口令(password)
Client:客户端(发送请求的机器)
Server:服务端(被请求的服务)
KDC (Key Distribution Center):密钥分发中心,提供ticket和临时的会话密钥的网络服务
AS (Authentication Server):认证服务器,通过 long-term key 认证用户AS 给予用户 ticket granting ticket 和 short-term key认证服务
TGS(Ticket Granting Server ):票据授予服务器,通过 short-term key 和 Ticket Granting Ticket 认证用户TGS 发放 tickets 给用户以访问其他的服务器授权和访问控制服务
AD(Account Database):账户数据库,存储所有Client的白名单
Ticket:一个记录,用户可以用它来向服务器证明自己的身份,其中包括用户的标识、会话密钥、时间戳,以及其他一些信息。Ticket 中的大多数信息都被加密,密钥为服务器的密钥
Authenticator:一个记录,其中包含一些最近产生的信息,产生这些信息需要用到用户和服务器之间共享的会话密钥
Credentials:一个ticket加上一个秘密的会话密钥
认证流程
图一:
Kerberos协议可以分为三个过程
身份验证服务 (AS) 交换 (KRB_AS*)
票证授予服务 (TGS) 交换 (KRB_TGS*)
客户端/服务器 (AP) 交换 (KRB_AP*)
注:其中的*便代表着REQ(request请求)和REP(response响应)两部分
图二:
KRB_AS*
KRB_AS_REQ
客户端向KDC中的AS发起请求,请求中携带了自己的用户名、主机IP和当前时间戳
AS收到请求之后会向AD查询请求的用户名是否存在,此时只会查找是否有相同用户名的用户,并不会判断身份的可靠性
如果没有该用户名,则认证失败。如果存在该用户名,则会进行下一步的AS_REP
KRB_AS_REP
当AS_REQ在KDC认证成功后,会给Client返回两部分内容
TGT(Ticket Granting Ticket),它是由AS认证服务器颁发,其包含该客户端的Name、IP、当前时间戳、客户端即将访问的TGS的Name、TGT的有效时间以及一个用CT_SK
Session Key,此内容由客户端的哈希加密
第一阶段结果:客户端成功获取了 TGT 和用于与 TGS 通信的会话密钥 CT_SK。
KRB_TGS*
客户端利用在AS_REP中拿到的信息向KDC中的TGS发起请求,请求的目的是为了获取能够访问目标网络服务的服务授予票据(Server Ticket,即ST)
KRB_TGS_REQ
客户端使用CT_SK加密将自己的客户端信息发送给KDC,其中包括客户端名、IP、时间戳
客户端将自己想要访问的Server服务以明文的方式发送给KDC
客户端将使用TGS密钥加密的TGT也原封不动的也携带给KDC
KRB_TGS_REP
KDC中的TGS会根据请求中的信息检查时间是否超时、请求的服务是否存在以及用于请求的用户是否合法,如果条件都符合则会返回两部分数据。
ST(Server Ticket),其中包括客户端的Name,IP,需要访问的网络服务的地址Server IP,ST的有效时间,时间戳以及用于客户端和服务端之间通信的CS_SK
使用CT_SK加密的内容,其中包括CS_SK和时间戳,还有ST的有效时间
第二阶段结果:客户端成功获得服务票据 (ST) 和客户端-服务端会话密钥 CS_SK。
KRB_AP*
在前面两步成功后,以后每次获取Http服务,在Ticket没有过期,或者无更新的情况下,都可直接进行这一步。省略前面两个步骤
KRB_AP_REQ
客户端通过Http Service Session Key加密将自己的客户端信息发送给KDC,其中包括客户端名、IP、时间戳
客户端将使用TGS密钥加密的TGT也原封不动的也携带给KDC
KRB_AP_REP
通过Http Service Session Key加密的Http服务name/ID,时间戳信息。
第三阶段结果:客户端与服务端成功完成双向认证,基于 CS_SK 的安全通信通道建立。至此,第三阶段通信完成,到这里整个 kerberos 认证也就完成了,接下来客户端与服务端就能放心的进行通信了
精简版流程
第一阶段:客户端与认证服务器 (AS) 交互 结果:客户端成功获取了 TGT 和用于与 TGS 通信的会话密钥 CT_SK
第二阶段:客户端与票据授予服务 (TGS) 交互 结果:客户端成功获得服务票据 (ST) 和客户端-服务端会话密钥 CS_SK
第三阶段:客户端与目标服务交互 结果:客户端与服务端成功完成双向认证,基于 CS_SK 的安全通信通道建立。
至此,第三阶段通信完成,到这里整个 kerberos 认证也就完成了,接下来客户端与服务端就能放心的进行通信了
参考:
Kerberos简介,概述,协议内容,3次通信_keeberos-CSDN博客
Kerberos: The Network Authentication Protocol
Kerberos协议认证原理/过程(详细易理解)_kerberos认证-CSDN博客