Tác giả: Nguyễn Thị Băng Tâm
Chương 4 : CẤU HÌNH AAA TRÊN PIX FIREWALL
Bài Lab cấu hình AAA với PIX
Scenario :
Địa chỉ của các interface :
Device |
Interface |
Address |
PIX |
E0
E1 |
209.162.1.1/24
172.16.1.2/24 |
Router |
E0 |
209.162.1.2/24 |
PC |
|
172.16.1.1/24 |
Cấu hình toàn bộ :
- Cấu hình của PIX :
Pix(config)# sh run
: Saved
PIX Version 6.2(2)
nameif ethernet0 outside security0
nameif ethernet1 inside security100
nameif ethernet2 intf2 security10
enable password 8Ry2YjIyt7RRXU24 encrypted
passwd 2KFQnbNIdI.2KYOU encrypted
hostname Pix
fixup protocol ftp 21
fixup protocol http 80
fixup protocol h323 h225 1720
fixup protocol h323 ras 1718-1719
fixup protocol ils 389
fixup protocol rsh 514
fixup protocol rtsp 554
fixup protocol smtp 25
fixup protocol sqlnet 1521
fixup protocol sip 5060
fixup protocol skinny 2000
names
pager lines 24
logging console debugging
interface ethernet0 auto
interface ethernet1 auto
interface ethernet2 auto shutdown
mtu outside 1500
mtu inside 1500
mtu intf2 1500
ip address outside 209.162.1.1 255.255.255.0
ip address inside 172.16.1.2 255.255.255.0
ip address intf2 127.0.0.1 255.255.255.255
ip audit info action alarm
ip audit attack action alarm
global (outside) 1 209.162.1.30
nat (inside) 1 0.0.0.0 0.0.0.0 0 0
route outside 0.0.0.0 0.0.0.0 209.162.1.2 1
no failover
failover timeout 0:00:00
failover poll 15
failover ip address outside 0.0.0.0
failover ip address inside 0.0.0.0
failover ip address intf2 0.0.0.0
pdm history enable
arp timeout 14400
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 rpc 0:10:00 h323 0:05:00 sip 0:30:00 sip_media 0:02:00
timeout uauth 0:05:00 absolute
aaa-server TACACS+ protocol tacacs+
aaa-server RADIUS protocol radius
aaa-server LOCAL protocol local
aaa-server ccsp protocol tacacs+
aaa-server ccsp (inside) host 172.16.1.1 pixfirewall timeout 10
aaa authentication telnet console ccsp
aaa authentication http console ccsp
aaa authentication enable console ccsp
aaa authentication include http inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authentication include telnet inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authentication include tcp/49 inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authentication include tcp/49 outside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authorization include telnet inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authorization include 1/8 inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
no snmp-server location
no snmp-server contact
snmp-server community public
no snmp-server enable traps
floodguard enable
no sysopt route dnat
auth-prompt prompt Please Authentication
auth-prompt accept Authentication successful
telnet 172.16.1.1 255.255.255.255 inside
telnet timeout 5
telnet timeout 5
ssh timeout 5
terminal width 80
Cryptochecksum:d41d8cd98f00b204e9800998ecf8427e
: end
Cấu hình router :
2530#sh run
Building configuration...
Current configuration : 546 bytes
!
version 12.1
no service single-slot-reload-enable
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname 2530
!
enable password cisco
!
!
!
ip subnet-zero
!
!
!
interface Ethernet0
ip address 209.162.1.2 255.255.255.0
!
interface Serial0
no ip address
shutdown
no fair-queue
!
interface Serial1
no ip address
shutdown
!
interface BRI0
no ip address
shutdown
!
ip classless
ip route 0.0.0.0 0.0.0.0 209.162.1.1
ip http server
!
!
line con 0
line aux 0
line vty 0 4
no login
!
end
Cấu hình từng bước :
- Cấu hình security level cho các interface e0 và e1
Pix(config)#nameif ethernet0 outside security0
Pix(config)#nameif ethernet1 inside security100
- cấu hình địa chỉ cho các interface trong PIX
Pix(config)#ip address outside 209.162.1.1 255.255.255.0
Pix(config)#ip address inside 172.16.1.2 255.255.255.0
- Up 2 interface e0 và e1 lên :
Pix(config)#interface ethernet0 auto
Pix(config)#interface ethernet1 auto
- Cấu hình tầm địa chỉ được nat ra ngoài :
PIX(config)# nat (inside) 1 0 0 0
PIX(config)# global (outside) 1 209.162.1.30
Global 209.162.1.30 will be Port Address Translated
- Cấu hình định tuyến cho mạng inside ra outside :
PIX(config)# route outside 0.0.0.0 0.0.0.0 209.162.1.1
- Kiểm tra địa chỉ đã cấu hình :
Pix# sh ip add
System IP Addresses:
ip address outside 209.162.1.1 255.255.255.0
ip address inside 172.16.1.2 255.255.255.255.0
ip address intf2 127.0.0.1 255.255.255.255
Current IP Addresses:
ip address outside 209.162.1.1 255.255.255.0
ip address inside 172.16.1.2 255.255.255.0
ip address intf2 127.0.0.1 255.255.255.255
- Cấu hình cho router 2530 :
router(config)# hostname 2530
2530(config)#enable password cisco
2530(config)#int e0
2530(config-if)#ip add 209.162.1.2 255.255.255.0
2530(config-if)#no shut
2530(config-if)#exit
2530(config)#ip http server ß Router đóng vai trò như là web server
2530(config)#ip route 0.0.0.0 0.0.0.0 209.162.1.1
- Thực hiện ping để kiểm tra kết nối :
Pix# ping 172.16.1.1
172.16.1.1 response received -- 0ms
172.16.1.1 response received -- 0ms
172.16.1.1 response received -- 0ms
Pix# ping 209.162.1.2
209.162.1.2 response received -- 0ms
209.162.1.2 response received -- 0ms
209.162.1.2 response received -- 0ms
- Cấu hình để các mạng inside có thể ping thấy các mạng outside :
Pix(config)# static (inside,outside) 209.162.1.5 172.16.1.2
Pix(config)# conduit permit icmp any any
- Trên PC mở command-prompt và thực hiện ping ra mạng ngoài , ta thấy ping thành công :
- Cấu hình cho phép host ở mạng inside được phép telnet vào pix :
Pix(config)# telnet 172.16.1.1 255.255.255.255 inside
- Bật tính năng AAA server trên PIX :
Pix(config)# aaa-server ccsp protocol tacacs+
Pix(config)# aaa-server ccsp (inside) host 172.16.1.1 pixfirewall
ð 172.16.1.1 chính là địa chỉ của AAA server , với key mã hóa là pixfirewall . Tạo ra một group tag được gọi là ccsp và đăng kí giao thức TACACS + đến nó .
- Để kiểm tra chi tiết cấu hình aaa-server trên pix , sử dụng câu lệnh sau :
Pix(config)# sh aaa-server
aaa-server TACACS+ protocol tacacs+
aaa-server RADIUS protocol radius
aaa-server LOCAL protocol local
aaa-server ccsp protocol tacacs+
aaa-server ccsp (inside) host 172.16.1.1 pixfirewall timeout 10
- Cấu hình xác thực user truy cập vào PIX .
Như ta đã nói trong phần lý thuyết , có tất cả 4 option để xác thực user khi user truy cập vào PIX . Cấu hình như sau :
Pix(config)# aaa authentication telnet console ccsp
Pix(config)# aaa authentication http console ccsp
Pix(config)# aaa authentication enable console ccsp
Ngoài ra ta cũng có thể cấu hình một vài option cho việc kiểm tra trở nên dễ dàng :
Pix(config)# auth-prompt prompt Please Authentication
Pix(config)# auth-prompt accept Authentication successful
Bật logging trên PIX để quan sát quá trình xác thực :
Pix(config)# logging console debug
- Cấu hình thông tin xác thực trên AAA server sử dụng phần mềm CSACS :
Install CSACS cho win server , trong quá trình cài đặt ta cần thêm một số thông tin sau :
- authentication user : TACACS + (Cisco IOS)
- Access server name : Pix ( tên của AAA client , trong trường hợp này là PIX)
- Access server address : 172.16.1.2 (địa chỉ của interface nối trực tiếp với AAA server)
- TACACS + or RADIUS key : pixfirewall (key được cấu hình trên PIX và AAA server là phải giống nhau )
Thêm user vào CSACS database :
- vào user setup , thêm user với thông tin sau :
username : aaauser
password : aaapass
- Kiểm tra quá trình xác thực khi user truy cập vào pix với username là aaauser và password là aaapass bằng các option sau :
- bằng telnet :
Pix(config)# aaa authentication telnet console ccsp
Trên PC bật command-prompt :
Khi telnet vào pix , xuất hiện prompt yêu cầu nhập username và password .
ð Xác thực thành công , user được phép truy cập vào pix bằng telnet .
Quan sát debug xuất hiện trên pix , ta có thể kiểm tra được điều này :
Pix(config)# 307002: Permitted Telnet login session from 172.16.1.1
111006: Console Login from aaauser at console
- bằng enable console :
Pix(config)# aaa authentication enable console ccsp
Để xác thực user bằng enable console , trên CSACS ta cấu hình thêm như sau :
- Tại interface configuration , chọn TACACS + (cisco IOS) .
- tại cửa sổ TACACS + (cisco IOS) , chọn advanced configuration options , tại đây chọn Advanced TACACS+ features . Sau khi thao tác xong , click Submit để bật tính năng advanced features .
- tại cửa sổ user setup => Advanced TACACS+ setting => TACACS +enable Control => max privileged for any AAA client , tại đây chọn level 15 . Sau đó đến TACACS +enable password , nhập password mà ta muốn xác thực enable console , trong bài này password được nhập vào là cisco . Sau khi hoàn tất , click Submit .
Tại PIX , ta thoát ra ngoài mode unprivileged ,
Pix#exit
Pix> 611103: User logged out: Uname: enable_15
Để vào lại mode privileged , xuất hiện dấu nhắc đòi nhập username và password
Pix>en
Username: aaauser
Password: *******
Username:
Access denied.
=> bị deny là do ta nhập password aaapass
Pix> 308001: PIX console enable password incorrect for 3 tries (from PIX console)
Pix> en
Username: aaauser
Password: *****
Pix# 502103: User priv level changed: Uname: enable_1 From: 1 To: 15
111008: User 'enable_1' executed the 'enable' command.
ð Vào được mode enable là do nhập password enable mà ta đã cấu hình phía trước trong ACS server .
15. Cấu hình xác thực traffic đi qua PIX :
Pix(config)# aaa authentication include http outbound 0 0 0 0 ccsp
Pix(config)# aaa authentication include telnet outbound 0 0 0 0 ccsp
ð Cấu hình xác thực cho các traffic đi từ inside đến outside với group tag là ccsp .
Kiểm tra cấu hình :
Pix(config)# sh aaa authentication
aaa authentication telnet console ccsp
aaa authentication http console ccsp
aaa authentication enable console ccsp
aaa authentication include http inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authentication include telnet inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
Tại PC command-prompt , telnet vào router 2530 :
Quan sát debug :
Pix# 305011: Built dynamic TCP translation from inside:172.16.1.1/2522 to outside:209.162.1.30/1056
109001: Auth start for user '???' from 172.16.1.1/2522 to 209.162.1.2/23
109011: Authen Session Start: user 'aaauser', sid 3
109005: Authentication succeeded for user 'aaauser' from 172.16.1.1/2522 to 209.162.1.2/23 on interface inside => /23 cho biết ta đang telnet .
302013: Built outbound TCP connection 16 for outside:209.162.1.2/23 (209.162.1.2/23) to inside:172.16.1.1/2522 (209.162.1.30/1056) (aaauser)
Sau khi xác thực thành công , sử dụng command show uauth để xem thống kê của quá trình này :
Pix(config)# sh aaa uauth
Current Most Seen
Authenticated Users 1 1
Authen In Progress 0 1
user 'aaauser' at 172.16.1.1, authenticated
absolute timeout: 0:05:00
inactivity timeout: 0:00:00
Muốn xác thực lại ta cần phải refresh lại quá trình này :
Pix(config)# clear uauth
?NOTE : Đối với inbound traffic ta cũng thực hiện tương tự .
Như ta đã biết sử dụng virtual telnet để xác thực các traffic không hỗ trợ quá trình này . Trong bài này giả sử user muốn truy cập đến dịch vụ có port 49 .
· Đối với inbound traffic , địa chỉ virtual telnet phải là địa chỉ được định tuyến đến pix . Trong bài này , PIX được cấu hình để yêu cầu xác thực cho việc outbound access đến TCP port 49 . Client inside muốn sử dụng dịch vụ này , sẽ telnet đến địa chỉ virtual telnet 209.162.1.4
Pix(config)# virtual telnet 209.162.1.4
Pix(config)# aaa authenticaton include tcp/49 outbound 0 0 0 0 ccsp
Kiểm tra tương tự như lần trước , nhưng ở command-prompt của PC , thay vì telnet đến địa chỉ 209.162.1.2 ta sẽ telnet đến địa chỉ 209.162.1.4 sẽ thành công .
Quan sát debug để kiểm tra kết quả :
Pix(config)# 305011: Built dynamic TCP translation from inside:172.16.1.1/2878 to outside:209.162.1.30/1065
109001: Auth start for user '???' from 172.16.1.1/2878 to 209.162.1.4/23
109011: Authen Session Start: user 'aaauser', sid 6
109005: Authentication succeeded for user 'aaauser' from 172.16.1.1/2878 to 209.162.1.4/23 on interface inside
· Đối với inbound traffic ta cũng tiến hành tương tự nhưng thông thường người ta thường không cấu hình cho các host outside được phép telnet đến các host inside .
Cấu hình virtual telnet inbound :
Pix(config)# aaa authentication include tcp/49 inbound 0 0 0 0 ccsp
Pix(config)#conduit permit tcp host 209.162.1.4 eq telnet any
Pix(config)#conduit permit tcp host 209.162.1.5 eq 49 any
PIX(config)# sh aaa authentication
aaa authentication telnet console ccsp
aaa authentication http console ccsp
aaa authentication enable console ccsp
aaa authentication include http inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authentication include telnet inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authentication include tcp/49 inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authentication include tcp/49 outside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
Cấu hình authorization :
Kiểm tra lại cấu hình :
Pix(config)# sh conduit
conduit permit tcp host 209.162.1.4 eq telnet any (hitcnt=0)
conduit permit tcp host 209.162.1.5 eq tacacs any (hitcnt=0)
conduit permit icmp any any (hitcnt=0)
Như ta đã thực hiện phía trước , các host inside và outside có thể ping thấy nhau , các host inside có thể telnet vào host ở outside . Sau đây ta bật tính năng authorization trên pix , thì ping và telnet sẽ không thành công .
Pix(config)# aaa authorization include telnet outbound 0 0 0 0 ccsp
Pix(config)# aaa authorization include icmp/8 outbound 0 0 0 0 ccsp
ð Cấu hình PIX yêu cầu cấp quyền cho tất cả các outbound traffic ICMP và telnet .
Kiểm tra lại cấu hình :
PIX(config)# sh aaa autho
aaa authorization include telnet inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
aaa authorization include 1/8 inside 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 ccsp
Thực hiện Ping và telnet :
Từ PC telnet vào router 2530 , tại command-prompt ta thấy telnet không thành công:
Từ PC ping router 2530 cũng không thành công :
Quan sát debug :
PIX(config)# 109001: Auth start for user '???' from 172.16.1.1/3719 to 209.162.1.2/23
109011: Authen Session Start: user 'aaauser', sid 9
109005: Authentication succeeded for user 'aaauser' from 172.16.1.1/3719 to 209.162.1.2/23 on interface inside
109008: Authorization denied for user 'aaauser' from 172.16.1.1/3719 to 209.162.1.2/23 on interface inside
109001: Authen start for user 'aaauser' from 172.16.1.1/0 to 209.162.1.2/0
109008: Authorization denied for user 'aaauser' from 172.16.1.1/0 to 209.162.1.2/0 on interface inside
Authorization bị từ chối là vì trên CSACS server ta chưa có cấu hình cấp quyền cho user :
Trên CSACS :
- click vào Group Setup để mở Group Setup interface
- Chọn Default Group (1user) từ group drop-down menu
- Kiểm tra rằng user thuộc về group đã được chọn . Click vào Users in Group để kiểm tra thông tin về user như sau :
User : aaauser
Status : Enabled
Group : Default Group (1 user)
- Click vào Edit Settings , vào group setting , cấu hình như hình sau :
Sau khi cấu hình authorization cho telnet traffic xong , click Submit để cấp quyền cho các traffic khác , mà cụ thể là ICMP traffic .
- Click submit+restart để lưu cấu hình và restart lại CSACS .
Kiểm tra telnet và ping lại như sau :
Từ PC telnet vào router sẽ thành công . Quan sát debug :
PIX(config)# 109001: Auth start for user 'aaauser' from 172.16.1.1/3791 to 209.162.1.2/23
109011: Authen Session Start: user 'aaauser', sid 9
109005: Authentication succeeded for user 'aaauser' from 172.16.1.1/3719 to 209.162.1.2/23 on interface inside
109007: Authorization permitted for user 'aaauser' from 172.16.1.1/3791 to 209.162.1.2/23 on interface inside
302013: Built outbound TCP connection 27 for outside:209.162.1.2/23 (209.162.1.2/23) to inside:172.16.1.1/3791 (209.162.1.5/3791) (aaauser)
Kiểm tra ping :
Quan sát debug :
109001: Auth start for user 'aaauser' from 172.16.1.1/0 to 209.162.1.2/0
109011: Authen Session Start: user 'aaauser', sid 9
109007: Authorization permitted for user 'aaauser' from 172.16.1.1/0 to 209.162.1.2/0 on interface inside