วันพฤหัสบดีที่ 14 กรกฎาคม พ.ศ. 2554

Network, Security : การสร้าง TACACS+ Server สำหรับใช้กับ Cisco AAA

บทความนี้เป็นการปูพื้นไว้ก่อนที่จะลืมวิธีทำ
ซึ่งบทความนี้จะว่าด้วยเรื่องการทำ Authentication อย่างเดียวก่อน ส่วน Authorization และ Accounting เอาไว้คราวหน้า

ระบบที่ใช้
Cisco Device: Cisco PIX-525
Software Version 8.0(4)28

TACACS+ Server
OS: FreeBSD 8.2 amd64
TACACS+ Server:
tac_plus4

ข้อกำหนด
- TACACS+ Server ที่ทดสอบ ติดตั้งหลัง Zone "Inside" ของ Firewall
- ให้ Inside Interface ของ Firewall = 172.17.12.5
- ให้ TACACS+ Server = 172.17.12.54

เริ่มต้นจาการติดตั้ง TACACS+ Server ดังนี้

Server# cd /usr/ports/net/tac_plus4
Server# make install
Server# rehash

Server# vi /etc/rc.conf

tac_plus_enable="YES"

จากนั้นทำการ Configure

อันดับแรกสร้าง password ที่เข้ารหัสแล้วก่อน เพื่อเอาไปใช้ใน Config โดยใช้คำสั่ง tac_pwd ดังตัวอย่าง

Server# tac_pwd
Password to be encrypted: nosecure
FWpfWvyThlezE

Server# tac_pwd
Password to be encrypted: 3Com
pKvE0HIV2X.z6

จากตัวอย่างจะได้ Password ที่ผ่านการเข้ารหัสแล้ว ซึ่งให้ทำการ Copy ส่วนนี้ไว้

จากนั้นทำการสร้าง Configuration file ดังตัวอย่าง

Server# vi /usr/local/etc/tac_plus.conf

key = "authen_by_komkit"

user = komkit {
login = des "FWpfWvyThlezE"
}

user = cisco {
login = des "pKvE0HIV2X.z6"
}

จากนั้นทำการ save file แล้วทำการ restart service

Server# /usr/local/etc/rc.d/tac_plus restart
Stopping tac_plus.
Starting tac_plus.

ตรวจสอบว่า Service ทำงานแล้ว

Server# netstat -anL
Proto Listen Local Address
tcp4 0/0/128 *.49


ต่อไปทำการเพิ่ม Configuration บน Cisco PIX-525

- กำหนดค่า parameter เบื้องต้นเกี่ยวกับ TACACS+ Server

aaa-server aaa-172.17.12.54 protocol tacacs+
aaa-server aaa-172.17.12.54 (inside) host 172.17.12.54
timeout 30
key authen_by_komkit


- นำค่าที่กำหนดไว้มาใช้งานกับ SSH

aaa authentication ssh console aaa-172.17.12.54

จากนั้นทดสอบการ remote ไปยัง Cisco Firewall โดยผ่าน SSH

login as: cisco
cisco@172.17.12.5's password: 3Com <--- ขณะที่พิมพ์จะมองไม่เห็น
Type help or '?' for a list of available commands.
pixfirewall>

หากมีการพยายามเข้าถึง แต่ไม่มี Username นั้นๆ หรือใส่ Password ผิด จะเกิด Log ที่ TACACS+ Server ดังนี้

Jul 14 19:53:19 Server tac_plus[1054]: login failure: root 172.17.12.5 (172.17.12.5) 5
Jul 14 19:53:26 Server tac_plus[1055]: login failure: cisco 172.17.12.5 (172.17.12.5) 6

หลังจากทดสอบว่าสามารถใช้งานได้แล้ว ก็ทำการ save config ของ Cisco Firewall ให้เรียบร้อย

คำสั่งอื่นๆ ที่น่าสนใจ

pixfirewall# show aaa-server aaa-172.17.12.54
Server Group: aaa-172.17.12.54
Server Protocol: tacacs+
Server Address: 172.17.12.54
Server port: 49
Server status: ACTIVE, Last transaction at 13:16:40 UTC Thu Jul 14 2011
Number of pending requests 0
Average round trip time 0ms
Number of authentication requests 8
Number of authorization requests 0
Number of accounting requests 0
Number of retransmissions 0
Number of accepts 4
Number of rejects 4
Number of challenges 1
Number of malformed responses 0
Number of bad authenticators 0
Number of timeouts 0
Number of unrecognized responses 0