Radius – Ldap 연동

By | 2020년 3월 31일

+ 환경

  • Ubuntu 18.04
  • FreeIPA (LDAP)
  • FreeRadius 3.x

필요한 프로그램 설치

모든 작업은 root 권한으로.

$ sudo -i
# apt install -y freeradius freeradius-ldap freeradius-config freeradius-utils freeradius-krb5

FreeRadius LDAP 모듈 enable

# /etc/freeradius/3.0/mods-enabled
# ln -s ../mods-available/ldap ./

LDAP 설정

# vi ldap

server = 'ldap.aaaa.com'
port = 389
# 전에 작성되었던 freeipa 설치부분에 manager dn 참조
identity = 'uid=admin,cn=users,cn=compat,dc=aaaa,dc=com'
password = 'adminpassword'
base_dn = 'cn=users,cn=accounts,dc=aaaa,dc=com'

FreeRadius LDAP Enable and Client Config

# cd /etc/freeradius/3.0
# vi clients.conf

## freeipa 와 freeradius가 같은 서버에 있어서 localhost에 작업
## 다른 호스트에 있을 경우 ipaddr 부분을 수정하면 됨.
client localhost {
        ipaddr = 127.0.0.1
        proto = *
        secret = 12345678 (radius 접속을 위한 비번)
        nas_type = other
        limit {
                max_connections = 16
                lifetime = 0
                idle_timeout = 30
        }
}

## IPv6 Client
client localhost_ipv6 {
        ipv6addr        = ::1
        secret          = 12345678 (radius 접속을 위한 비번)
}


## -ldap 이라고 되어 있는 부분을 아래와 같이 수정
ldap
if ((ok || updated) && User-Password) {
    update {
        control:Auth-Type := ldap
    }
}

## 코멘트 제거
Auth-Type LDAP {
    ldap
}

freeradius 서버 시작 및 자동시작 설정

# systemctl start freeradius.service
# systemctl enable freeradius.service

접속 테스트

# radtest test test1234 127.0.0.1 1812 12345678 (secret비번)
Sent Access-Request Id 32 from 0.0.0.0:39334 to 127.0.0.1:1812 length 74
	User-Name = "test"
	User-Password = "test1234"
	NAS-IP-Address = x.x.x.x
	NAS-Port = 1812
	Message-Authenticator = 0x00
	Cleartext-Password = "test1234"
Received Access-Accept Id 32 from 127.0.0.1:1812 to 0.0.0.0:0 length 20

위와 같이 나오면 테스트 성공. 설정 끝.