2009년 6월 25일 목요일

AAA RADIUS에 관하여

AAA RADIUS에 관하여

 

1. AAA 개요

AAA 서버란 인증(Authentication), 권한검증(Authorization), 과금(Accounting)을 제공하는 서버를 말한다. 이러한 AAA를 구현하는 프로토콜로는 RADIUS(Remote Authentication Dial-In User Service)와 DIAMETER가 있다. 여기에서는 현재까지 AAA를 위해 대표적으로 사용되어온 RADIUS에 대해 설명하고자 한다.

RADIUS 서버가 사용될 수 있는 실제 망 구성의 간단한 예를 들어 설명을 시작하도록 하겠다.

 

예1) ADSL 접속.

일반적으로 ADSL은 아래와 같을 것이다.

PC --- ADSL modem --- 전화국의 NAS(Network Access Server) --- 인터넷 --- RADIUS server.

 

1. PC는 ADSL 접속을 위해 NAS 서버에 접속을 요청할 것이다. 이것은 layer 2에서 PPP 프로토콜에 의한 접속 요청이 된다.

 

2. 접속을 위한 PPP 핸드쉐이크가 끝난 후 인증을 위한 인증 패킷을 NAS에게 전달할 것이다(참고로, NAS가 받는 패킷은 PPP protocol에 의한 패킷이다).

 

3. 그러면, NAS는 PPP protocol에 의거해 받은 패킷을 실제 인증 데몬 및 DB를 가지고 있는 RADIUS 서버에게 유효한 사용자인지 물어보아야 한다. 이 때 NAS와 RADIUS 서버 사이에 패킷이 왔다갔다 하는데, 이 패킷은 RADIUS protocol(layer 3임)에 기반한 패킷 포맷을 가지고 왔다갔다 한다. 즉, NAS는 PPP protocol(Layer 2)에 기반한 패킷을 access 개체(PC)로부터 받아 이를 다시 RADIUS protocol(Layer 3)에 기반한 패킷으로 만들어 RADIUS 서버에게 물어보게 된다(결국 NAS는 RADIUS client가 됨).

 

4. 인증 확인 요청을 받은 RADIUS server는 해당 사용자에 대한 인증 확인 후 accept인지 reject인지의 답변을 NAS에게 주게된다.

 

5. NAS는 RADIUS 서버에세 받은 응답 패킷을 이용해 다시 PPP쪽에 적당한 응답을 주게 된다.

 

예2) 무선랜 접속.

일반적으로 무선랜 접속은 아래와 같을 것이다.

PC --- 무선 ------무선 AP ----- 인터넷 --- RADIUS server.

1. PC는 802.11에 기반한 무선 AP로의 접속 및 핸드쉐이크를 실시한다.

2. 그리고 나서 PC는 802.1x에 기반에 인증 데이터을 무선 AP에게 전송한다.

3. 무선 AP는 RADIUS 서버에게 이에 대한 인증 확인을 요청한다.

4. RADIUS 서버로 부터 인증 확인에 대한 응답이 오면 무선 AP는 다시 PC에게 인증 확인해 대한 패킷을

    802.1x에 기반해 전송해 준다.

5. 다음 과정을 실시한다..

 

다음으로 RADIUS 서버가 왜 필요한가에 대한 설명이다.

RADIUS 서버가 없다고 가정해 보면, 위의 예에서 NAS, 무선 AP 등  access 개체(일반적으로 PC라 생각하면 됨)로부터 연결 요청을 받는 장비는 모두 모든 사용자 정보를 각각 가지고 있어야만 한다. 이것은 간단한 NAS, 무선 AP 장비에  올리기도 어렵거니와 각각의 NAS, 무선 AP가 가지고 있는 사용자 정보도 동기화 시켜야 하는 엄청난 일이 발생할 것이다. 이것 말고도 문제가 더 많을 듯 하다. 그런데, AAA 역할을 해주는 서버를 따로 빼두면, NAS, 무선 AP 등은 AAA 역할의 서버에게만 이러한 질의를 해보면 될 것이다. 관리자 측면에서도 AAA 관련된 것은 모두 해당 RADIUS 서버를 이용하면 되므로 편리할 것이다..

 

2. RADIUS 개요

RADIUS(Remote Authentication Dial-In User Service) 프로토콜은 다이얼업 네트워킹을 통해 본사 네트워크에 접속할 때, 보안을 위해 사용자 이름과 암호 그리고 가능한한 필요한 보호 조치들을 통해 외부 사용자들을 인증하는 프로토콜이다.


RADIUS 구성 요소
RADIUS 환경은 ▲RADIUS 서버 ▲RADIUS 클라이언트 ▲원격 액세스 클라이언트 ▲RADIUS 프록시 서버로 이뤄져 있다(www.ietf.org/rfc.html의 RFCs 2138과 2139를 참조). RADIUS 서버는 각 네트워크 액세스 서버가 아닌 중앙 원격 액세스 사용자 인증, 계정 데이터를 담당하며, 원격 사용자를 위한 정책을 중앙 관리할 수 있다.

 

RADIUS의 주요 특징

- Client/Server Model
NAS는 RADIUS의 client로서 동작함. RADIUS server는 사용자의 연결, 인증, 모든 configuration 구성 요청에 대해 응답함.

 

- Network Security
Client와 Radius server 사이의 transaction은 shared secret을 사용해 인증되어짐. shared secret은 network을 통해 보낼 수 없슴. 추가적으로 사용자 패스워드는 client와 RADIUS server 사이에 encrypt되어 보내짐.

 

- Flexible Authentication Mechanisms
RADIUS 서버는 사용자 인증을 위한 방법을 제공함. PPP PAP or CHAP, UNIX login, and other authentication mechanisms.

 

-Extensible Protocol
모든 transaction은 variable length Attribute-Length-Value 3-tuples를 포함한다. 새로운 Attribute 값은 기존 protocol에 영향없이 추가할 수 있다.

 

3. 표준 문서

RADIUS는 아래의 두 표준문서가 있다.

 

RFC 2138 - Remote Authentication Dial In User Service(RADIUS)

Authentication와 Authorization을 위한 RADIUS protocol을 설명함. 즉, 아래 패킷 포맷의 Code 4(Accounting-Request), 5(Accounting-Response)를 제외한 코드의 패킷을 설명함. UDP 1812 port를 사용(기존 1645 포트는 "datametrics" 서비스와 충돌).

 

RFC 2139 – RADIUS Accounting

Network Access Server(NAS)로부터 RADIUS accounting server로의 accounting 정보를 설명함. 즉, 아래 패킷 포맷의 Code 4(Accounting-Request), 5(Accounting-Response)번 코드의 패킷을 설명함. UDP 1813 port를 사용(기존 1646은 "sa- msg-port" 서비스와 충돌)

 

4. Packet Format

RADIUS client(NAS or 무선 AP)와 RADIUS Server 사이는 정해진 포맷에 의한 패킷을 주고 받아야 한다. 이 포맷을 아래와 같다.

 


    0                       1                        2                          3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Code      |  Identifier      |                  Length        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                                             |
   |                         Authenticator                                 |
   |                                                                             |
   |                                                                             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Attributes ...
   +-+-+-+-+-+-+-+-+-+-+-+-+-


Code :

Code field는 one octet이며, RADIUS packet의 타입을 식별한다.


RADIUS Codes(decimal)
        1       Access-Request  - RFC 2138
        2       Access-Accept  - RFC 2138
        3       Access-Reject  - RFC 2138
        4       Accounting-Request  - RFC 2139
        5       Accounting-Response  - RFC 2139
       11       Access-Challenge  - RFC 2138
       12       Status-Server (experimental)
       13       Status-Client (experimental)
      255       Reserved

 

Identifier : request, replies에 매칭되는 one octet이다.

Length : code, identifier, length, authenticator, attribute field를 포함하는 패킷의 길이.

             mininum length는 20, maximum length는 4096.

Authenticator : 16 octet으로 radius client와 server가 상호 인증하는데 사용하는 정보.

Attribute : RADIUS Attribute는 요청과 응답을 위한 특정 authentication, authorization, information

               and configuration을 포함한다.

 

4.1 Attributes

RADIUS Attribute는 요청과 응답을 위한 특정 authentication, authorization, information and configuration을 포함한다. 즉, ID, password 등의 정보가 attribute에 해당한다.

 

Attribute Format

 

    0                          1                         2

    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

   |     Type      |    Length     |  Value ...

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

 

      A RADIUS client MAY ignore Attributes with an unknown Type.

          1      User-Name

          2      User-Password

          3      CHAP-Password

          4      NAS-IP-Address

          5      NAS-Port

          6      Service-Type

          7      Framed-Protocol

          8      Framed-IP-Address

          9      Framed-IP-Netmask

         10      Framed-Routing

         11      Filter-Id

         12      Framed-MTU

         13      Framed-Compression

         14      Login-IP-Host

         15      Login-Service

         16      Login-TCP-Port

         17      (unassigned)

         18      Reply-Message

         19      Callback-Number

         20      Callback-Id

         21      (unassigned)

         22      Framed-Route

         23      Framed-IPX-Network

         24      State

         25      Class

         26      Vendor-Specific

         27      Session-Timeout

         28      Idle-Timeout

         29      Termination-Action

         30      Called-Station-Id

         31      Calling-Station-Id

         32      NAS-Identifier

         33      Proxy-State

         34      Login-LAT-Service

         35      Login-LAT-Node

         36      Login-LAT-Group

         37      Framed-AppleTalk-Link

         38      Framed-AppleTalk-Network

         39      Framed-AppleTalk-Zone

         40-59   (reserved for accounting)

         60      CHAP-Challenge

         61      NAS-Port-Type

         62      Port-Limit

         63      Login-LAT-Port

  

Length : 해당 Type, Length, Value fields를 포함하는 이 attribute의 길이를 가리킴.

Value : Value filed는 attribute에 정보 spec을 포함하며, 사이즈는 zero or more octets.

 

다음은 4가지의 data type에 대한 설명이다.

 string : 0-253 octets

 address : 32bit value, most significant octet first.

 integer : 32bit value, most significant octet first.

  

username format :

- monolithic : alphanumeric character로 구성됨.

- simple : printable ASCII characters로 구성됨

- name@fqdn : SMTP address.

- distinguished name : ASN.1 form의 이름.

  

4.1.1 Vendor-Specific Attribute

RADIUS 프로토콜은 fix 되어 있으므로, RADIUS를 구현하는 벤더에서 새로운 attribute를 넣을려면 이 attribute를 이용하면 된다.

 

0                  1                    2                 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |  Length       |            Vendor-Id
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      Vendor-Id (cont)      | Vendor type  | Vendor length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Attribute-Specific...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+-+-+-+-+-+-+-+-+-+-+-+
 
5. Example
 아직까지 설명해온 RADIUS protocol에 의해 주고 받는 패킷의 내용이다.


5.1 User Telnet to Specified Host
 The NAS at 192.168.1.16 sends an Access-Request UDP packet to the RADIUS Server for a user named nemo logging in on port 3.


      Code = 1        (Access-Request)
      ID = 0
      Length = 56
      Request Authenticator = {16 octet random number}
      Attributes:
          User-Name = "nemo"
          User-Password = {16 octets of Password padded at end with nulls,
                                      XORed with MD5(shared secret|Request Authenticator)}
          NAS-IP-Address = 192.168.1.16
          NAS-Port = 3
 
   The RADIUS server authenticates nemo, and sends an Access-Accept UDP
   packet to the NAS telling it to telnet nemo to host 192.168.1.3.
 
      Code = 2        (Access-Accept)
      ID = 0          (same as in Access-Request)
      Length = 38
      Response Authenticator = {16-octet MD-5 checksum of the code (2),
                                              id (0), Length (38), the Request Authenticator from
                                              above, the attributes in this reply, and the shared secret}
      Attributes:
          Service-Type = Login-User
          Login-Service = Telnet
          Login-Host = 192.168.1.3


 5.2.  Framed User Authenticating with CHAP

    The NAS at 192.168.1.16 sends an Access-Request UDP packet to the
   RADIUS Server for a user named flopsy logging in on port 20 with PPP,
   authenticating using CHAP.  The NAS sends along the Service-Type and
   Framed-Protocol attributes as a hint to the RADIUS server that this
   user is looking for PPP, although the NAS is not required to do so.
 
 
      Code = 1        (Access-Request)
      ID = 1
      Length = 71
      Request Authenticator = {16 octet random number also used as CHAP challenge}
      Attributes:
          User-Name = "flopsy"
          CHAP-Password = {1 octet CHAP ID followed by 16 octet
                           CHAP response}
          NAS-IP-Address = 192.168.1.16
          NAS-Port = 20
          Service-Type = Framed-User
          Framed-Protocol = PPP
 
The RADIUS server authenticates flopsy, and sends an Access-Accept UDP packet to the NAS telling it to start PPP service and assign an address for the user out of its dynamic address pool.
 
      Code = 2        (Access-Accept)
      ID = 1          (same as in Access-Request)
      Length = 56
      Response Authenticator = {16-octet MD-5 checksum of the code (2), id (1),

                                              Length (56), the Request Authenticator from above,

                                              the attributes in this reply, and the shared secret}
      Attributes:
          Service-Type = Framed-User
          Framed-Protocol = PPP
          Framed-IP-Address = 255.255.255.254
          Framed-Routing = None
          Framed-Compression = 1      (VJ TCP/IP Header Compression)
          Framed-MTU = 1500
 
5.3  User with Challenge-Response card
    The NAS at 192.168.1.16 sends an Access-Request UDP packet to the
   RADIUS Server for a user named mopsy logging in on port 7.
 
      Code = 1        (Access-Request)
      ID = 2
      Length = 57
      Request Authenticator = {16 octet random number}
      Attributes:
          User-Name = "mopsy"
          User-Password = {16 octets of Password padded at end with nulls, XORed with MD5

                                      (shared secret|Request Authenticator)}
          NAS-IP-Address = 192.168.1.16
          NAS-Port = 7
  
The RADIUS server decides to challenge mopsy, sending back a challenge string and looking

for a response.  The RADIUS server therefore and sends an Access-Challenge UDP packet to the NAS.
 
      Code = 11       (Access-Challenge}
      ID = 2          (same as in Access-Request)
      Length = 78
      Response Authenticator = {16-octet MD-5 checksum of the code (11), id (2),

                                              length (78), the Request Authenticator from above,

                                              the attributes in this reply, and the shared secret}
      Attributes:
          Reply-Message = "Challenge 32769430.  Enter response at prompt."
          State =     {Magic Cookie to be returned along with user's response; in this example

                           8 octets of data}
 
The user enters his response, and the NAS send a new Access-Request with that response, and includes the State Attribute.
 
      Code = 1        (Access-Request)
      ID = 3          (Note that this changes)
      Length = 67
      Request Authenticator = {NEW 16 octet random number}
      Attributes:
          User-Name = "mopsy"
          User-Password = {16 octets of Response padded at end with nulls, XORed with MD5

                                      checksum of shared secret plus above Request Authenticator}
          NAS-IP-Address = 192.168.1.16
          NAS-Port = 7
          State =     {Magic Cookie from Access-Challenge packet, unchanged}
 
The Response was incorrect, so the RADIUS server tells the NAS to reject the login attempt.
 
      Code = 3        (Access-Reject)
      ID = 3          (same as in Access-Request)
      Length = 20
      Response Authenticator = {16-octet MD-5 checksum of the code (3), id (3),

                                              length(20), the Request Authenticator from above,

                                              the attributes in this reply if any, and the shared secret}
      Attributes:
              (none, although a Reply-Message could be sent)

 

ps> 위의 문서는 syleenet 블로그의 문서를 참조한것입니다.

 

댓글 없음:

댓글 쓰기