PDA

View Full Version : Hỏi về cách chặn Yahoo Messenger trong ASA 5510



LeThanhTung
16-07-2008, 05:03 PM
Chào các anh chị,
Mọi người làm ơn cho em hỏi, hiện công ty em đang sử dụng ASA5510 và có set cho mọi người được vào internet từ 12h đến 1h. Nhưng riêng thằng Yahoo messenger nếu sign in rồi để đấy không sign out thì sau khi hết giờ truy cập internet nó vẫn cứ hoạt động. Mọi người chat chit làm ảnh hưởng đến công việc, em bị kêu ghê quá mà vẫn chưa biết cách nào để chặn cái thằng yahoo này lại. Mong các anh chị giúp đỡ cho em làm thế nào để chặn được nó trên ASA5510, em xin cảm ơn mọi người.

dangquangminh
16-07-2008, 05:37 PM
cấu hình dưới đây lấy trên site Cisco và đã thử nghiệm chạy tốt. Bạn xem các đoạn cấu hình highlight có liên quan đến YIM.

CiscoASA#show run
: Saved
:
ASA Version 7.1(1)
!
hostname CiscoASA
enable password 8Ry2YjIyt7RRXU24 encrypted
names
!
!−−− Output Suppressed
http−map inbound_http
content−length min 100 max 2000 action reset log
content−type−verification match−req−rsp action reset log
max−header−length request 100 action reset log
max−uri−length 100 action reset log
port−misuse p2p action drop
port−misuse im action drop
port−misuse default action allow

!−−− The http−map "inbound_http" inspects the http traffic
!−−− as per various parameters such as content length, header length,
!−−− url−length as well as matches the IM traffic and drops them.

!
class−map inspection_default
match default−inspection−traffic

class−map http−port
match port tcp eq www
!−−− The class map "http−port" matches
!−−− the http traffic which uses the port 80.
!
!
policy−map global_policy
class inspection_default
inspect dns maximum−length 512
inspect ftp
inspect h323 h225
inspect h323 ras
inspect netbios
inspect rsh
inspect rtsp
inspect skinny
inspect esmtp
inspect sqlnet
inspect sunrpc
inspect tftp
inspect sip
inspect xdmcp
policy−map inbound_policy
class http−port
inspect http inbound_http
!−−− The policy map "inbound_policy" matches
!−−− the http traffic using the class map "http−port"
!−−− and drops the IM traffic as per http map
!−−− "inbound_http" inspection.
!
service−policy global_policy global
service−policy inbound_policy interface outside
!−−− Apply the policy map "inbound_policy"
!−−− to the outside interface.
Cryptochecksum:d41d8cd98f00b204e9800998ecf8427e
: end
CiscoASA#

PIX/ASA 7.2 and Later Configuration

:
ASA Version 8.0(2)
!
hostname pixfirewall
enable password 8Ry2YjIyt7RRXU24 encrypted
names
!−−− Output Suppressed
class−map inspection_default
match default−inspection−traffic
class−map imblock
match any
!−−− The class map "imblock" matches
!−−− all kinds of traffic.
!
policy−map type inspect dns preset_dns_map
parameters
message−length maximum 512
policy−map type inspect im impolicy
parameters
match protocol msn−im yahoo−im
drop−connection
!−−− The policy map "impolicy" drops the IM
!−−− traffic such as msn−im and yahoo−im.
policy−map imdrop
class imblock
inspect im impolicy
!−−− The policy map "imdrop" drops the
!−−− IM traffic matched by the class map "imblock".
policy−map global_policy
class inspection_default
inspect dns preset_dns_map
inspect ftp
inspect h323 h225
inspect h323 ras
inspect netbios
inspect rsh
inspect rtsp
inspect skinny
inspect esmtp
inspect sqlnet
inspect sunrpc
inspect tftp
inspect sip
inspect xdmcp
!
service−policy global_policy global
service−policy imdrop interface outside
!−−− Apply the policy map "imdrop"
!−−− to the outside interface.
prompt hostname context
Cryptochecksum:d41d8cd98f00b204e9800998ecf8427e
: end
CiscoASA#

LeThanhTung
17-07-2008, 06:07 PM
Anh Minh thân mến,
Trước hết, em xin cảm ơn anh đã giúp đỡ em. Em muốn hỏi thêm anh một chút về chặn YM trong ASA. Cụ thể là hiện tại em có một giải access list, cho phép các IP nằm trong giải này được truy cập internet trong khoảng thời gian từ 12h đến 1h. Nếu các IP trong giải Access list sử dụng YM trong thời gian này và duy trì YM thì sau khi hết thời gian truy cập (sau 1h) họ vẫn tiếp tục chat được. Nhưng nếu họ sign out rồi sau 1h họ connect lại thì không vào được (Access list đã chặn lại, không cho phép truy cập). Em không hiểu tại sao lại như vậy, có cách nào để chặn YM chỉ trong khoảng thời gian từ 8h đến 12h, sau đó mở ra cho sử dụng đến sau 1h thì lại chặn lại không anh? Mong anh giúp em.
P/S: Em xin nói thêm là mạng bên em có hai giải địa chỉ, một giải được vào internet 24/24 và một giải chỉ được vào từ 12h đến 1h. Nếu sử dụng theo cấu hình anh đưa cho em thì nó sẽ chặn YM trên toàn bộ các giải, nhưng cty em thì lai cho phép giải vào internet 24/24 dược chat, còn giải chặn 12h-1h thì chỉ được dùng trong giờ quy định thôi. Vậy có cách nào để giải quyết không anh?
Em xin cảm ơn anh.

dangquangminh
17-07-2008, 10:35 PM
bạn có thể cấm YIM cho một subnet nào đó.

Cú pháp tổng quát để cấm YIM là:

asa1(config)#policy-map type inspect im MY_IM_MAP
asa1(config-pmap)# match ?

mpf-policy-map mode commands/options:
filename Match filename from IM file transfer service
ip-address Match client IP address for IM application or service
login-name Match client login-name from IM service
not Negate this match result
peer-ip-address Match peer (client or server) IP address for IM application or service
peer-login-name Match client peer login name from IM service
protocol Match an Instant Messenger Protocol
service Match an Instant Messenger Service
version Match version from IM file transfer service





Nếu bạn muốn chặn YIM theo một subnet, bạn có thể dùng ví dụ cấu hình giống như dưới đây:

asa1(config)# class-map type inspect im match-all IM_CLASS_MAP
asa1(config-cmap)# match protocol yahoo-im
asa1(config-cmap)# match ip-address 10.0.1.0 255.255.255.0
. . .
asa1(config)# policy-map type inspect im MY_IM_MAP
asa1(config-pmap)# class IM_CLASS_MAP
asa1(config-pmap-c)# reset

Nếu bạn muốn tìm hiểu thêm về cách ASA quản lý các protocols, xem thêm slide này:


http://www.4shared.com/file/55540056/7a7bc5b5/SNPA50SL10.html?

nguyenquocle
18-07-2008, 01:46 AM
cho em hỏi là anh LeThanhTung mún chặn giải địa chỉ ra internet tu 8h đến 12h hay anh mún cấm giải địa chỉ đó sử dụng yahoo chat từ 12h đến 1h còn lướt web thì bất cứ giờ nào cũng được pk?

LeThanhTung
18-07-2008, 10:31 AM
Em xin cảm ơn anh Minh.
To nguyenquocle: Mình có hai giải IP, một giải vào internet 24/24, lướt web+chat thoải mái vì giải này giành cho các sếp. Còn một giải thì cấm không cho vào internet, chat chit từ 8h sáng đến 12h, sau đó mở cho vào một tiếng đồng hồ lúc nghỉ ăn trưa. Sau một giờ thì lại cấm tiếp không cho vào internet nữa.
Kẹt cái nếu YM và login lúc 12h sau đó không logout thì dù cho hết giờ, web không truy cập được nữa thì thằng YM vẫn cứ tiếp tục kết nối và chat ngon lành. Thế nên mình mới phải đi tìm cách để fix cái lỗi đó.

nguyenquocle
18-07-2008, 12:37 PM
Chào các anh chị,
Mọi người làm ơn cho em hỏi, hiện công ty em đang sử dụng ASA5510 và có set cho mọi người được vào internet từ 12h đến 1h. Nhưng riêng thằng Yahoo messenger nếu sign in rồi để đấy không sign out thì sau khi hết giờ truy cập internet nó vẫn cứ hoạt động. Mọi người chat chit làm ảnh hưởng đến công việc, em bị kêu ghê quá mà vẫn chưa biết cách nào để chặn cái thằng yahoo này lại. Mong các anh chị giúp đỡ cho em làm thế nào để chặn được nó trên ASA5510, em xin cảm ơn mọi người.
thử cách xem thế nào!!!!
asa(config)#time-range deny-im
asa(config-time-range)#periordic 12:00 to 13:00
asa(config)#access-list 101 per ip hostname subnetmask any time-range deny-im
asa(config)#nat (inside) 1 access-list 101
asa(config)#global (outside) 1 interface

LeThanhTung
21-07-2008, 01:01 PM
thử cách xem thế nào!!!!
asa(config)#time-range deny-im
asa(config-time-range)#periordic 12:00 to 13:00
asa(config)#access-list 101 per ip hostname subnetmask any time-range deny-im
asa(config)#nat (inside) 1 access-list 101
asa(config)#global (outside) 1 interface



Cấu hình này của NguyenQuocLe mình không dùng đựoc rồi vì Version 7.2 của mình không support, có cách nào khác không? Vì mình không thể đưa time-range vào lenh Nat được. Làm ơn giúp mình với.

LeThanhTung
22-07-2008, 10:06 AM
Anh Minh ơi, làm ơn cho emhỏi với.
Trong bộ lệnh cấu hình chặn Yahoo theo subnet của anh, sau khi tạo class-map và policy-map xong có cần phải sử dụng lệnh service-map để gán policy đó cho port outside không hả anh?
!Service-policy "Special-policy-map name" interface outside
Vì khi em dùng lệnh này thì ASA báo là lệnh này không thể áp dụng với trường "inspect im" được anh ạ.
Anh giúp em với.

nguyenquocle
22-07-2008, 12:24 PM
bạn phải sử dụng kỹ thuật lồng class-map thi mới apply cấu hình được:
asa1(config)# class-map type inspect im match-all IM_CLASS_MAP
asa1(config-cmap)# match protocol yahoo-im
asa1(config-cmap)# match ip-address 10.0.1.0 255.255.255.0
. . .
asa1(config)# policy-map type inspect im MY_IM_MAP
asa1(config-pmap)# class IM_CLASS_MAP
asa1(config-pmap-c)# reset
....
asa(config)#policy-map global_policy
asa(config-pmap)# class inspection_default
asa(config-pmap-c)#inspect im MY_IM_MAP
....
asa(config)#service-policy global_policy global
CHÚC BẠN THÀnh Công!!!

LeThanhTung
22-07-2008, 05:33 PM
bạn phải sử dụng kỹ thuật lồng class-map thi mới apply cấu hình được:
asa1(config)# class-map type inspect im match-all IM_CLASS_MAP
asa1(config-cmap)# match protocol yahoo-im
asa1(config-cmap)# match ip-address 10.0.1.0 255.255.255.0
. . .
asa1(config)# policy-map type inspect im MY_IM_MAP
asa1(config-pmap)# class IM_CLASS_MAP
asa1(config-pmap-c)# reset
....
asa(config)#policy-map global_policy
asa(config-pmap)# class inspection_default
asa(config-pmap-c)#inspect im MY_IM_MAP
....
asa(config)#service-policy global_policy global
CHÚC BẠN THÀnh Công!!!


NguyenQuocLe ơi mình hỏi bạn chút, khi mình nhập lệnh:
asa(config-pmap)# class inspection_default
Thì bị báo lỗi là : class-map inspection not configured

Vậy nghĩa là sao hả bạn?

nguyenquocle
22-07-2008, 11:43 PM
bạn show running-config coi có dòng "class inspection_default" ko?
nếu ko bạn fải :
asa(config)#class-map deny-im
asa(config)#policy-map global_policy
asa(config-pmap)#class deny-im
asa(config-pmap-c)#inspect im MY_IM_MAP
asa(config)#service-policy global_policy global

LeThanhTung
24-07-2008, 05:59 PM
bạn show running-config coi có dòng "class inspection_default" ko?
nếu ko bạn fải :
asa(config)#class-map deny-im
asa(config)#policy-map global_policy
asa(config-pmap)#class deny-im
asa(config-pmap-c)#inspect im MY_IM_MAP
asa(config)#service-policy global_policy global



Cảm ơn bạn NguyenQuocLe nhiều nhiều. Mình muốn hỏi thêm chút nhé, mình chỉ thay thế lệnh reset của bạn bằng lệnh Drop-connection trong tập lệnh trên. Theo mình nghĩ thì không có vấn đề gì cả. Nhưng không hiểu sao hiện tại thì ASA cấm luôn toàn bộ internet, không thể vào được bất kỳ website nào cả. Mình ping thử ra ngoài (Vd: dantri.com.vn hoặc vnexpress.net) thì thấy báo request timeout. Đúng ra nó chỉ kiểm tra thằng IM thôi chứ nhỉ? Mình dò mãi mà không biết lỗi tại đâu, NguyenQuocLe có thể giúp mình được không?
Thanks.

nguyenquocle
24-07-2008, 11:00 PM
Drop-connection: Drop the packet and closes the connection
reset: Drop the packet and closes the connection, and sends a TCP reset to the server and client
neu ban thay lenh lai thì cũng ko sao!!!!

LeThanhTung
25-08-2008, 01:15 PM
Dear anh Minh,
em đang chặn yahoo chat theo một subnet, nhưng không hiểu sao khi em chặn yahoo thi ca cai subnet đó không vào internet được luôn. Em xin gửi lại toàn bộ cấu hình của ASA 5510 em đã làm, anh xem giúp em là sai ở chỗ nào? Trước nếu không chặn Yahoo thì các cái subnet áp dụng time-range có thể vào internet lúc 12h trưa cho đến 1h chiều. Nhưng nếu áp dụng chặn Yahoo chat vào thì nó tịt luôn, không còn vào internet được nữa.

ASA Version 7.2(3)
!
hostname ASA5510-TTM
domain-name
enable password 2KFQnbNIdI.2KYOU encrypted
names
!
interface Ethernet0/0
description Noi Internet
nameif outside
security-level 0
ip address 10.1.1.2 255.255.255.252
!
interface Ethernet0/1
description Noi GB0/1 SW3560
nameif inside
security-level 100
ip address 10.1.2.1 255.255.255.252
!
interface Ethernet0/2
shutdown
no nameif
no security-level
no ip address
!
interface Ethernet0/3
shutdown
no nameif
no security-level
no ip address
!
interface Management0/0
shutdown
no nameif
no security-level
no ip address
!
passwd 2KFQnbNIdI.2KYOU encrypted
!
time-range internet_access
periodic daily 12:00 to 13:00
!
ftp mode passive
dns server-group DefaultDNS
domain-name architec.com
access-list acl_outside extended permit icmp any any
access-list acl_outside extended permit tcp any host 10.1.1.2 eq smtp
access-list acl_outside extended permit tcp any host 10.1.1.2 eq pop3
access-list acl_outside extended permit tcp any host 10.1.1.2 eq imap4
access-list acl_outside extended permit tcp any host 10.1.1.2 eq www
access-list acl_outside extended permit tcp any host 10.1.1.2 eq https
access-list acl_outside extended permit tcp any host 10.1.1.2 eq ftp

access-list acl_inside extended permit ip 172.16.1.0 255.255.255.128 any
access-list acl_inside extended permit ip 172.16.2.0 255.255.255.128 any
access-list acl_inside extended permit ip 172.16.3.0 255.255.255.128 any
access-list acl_inside extended permit ip 172.16.4.0 255.255.255.128 any
access-list acl_inside extended permit ip 172.16.5.0 255.255.255.128 any
access-list acl_inside extended permit ip 172.16.6.0 255.255.255.128 any
access-list acl_inside extended permit ip 172.16.7.0 255.255.255.128 any
access-list acl_inside extended permit ip 192.168.4.0 255.255.255.0 any

access-list acl_inside extended permit ip 172.16.1.128 255.255.255.128 any time-range internet_access
access-list acl_inside extended permit ip 172.16.2.128 255.255.255.128 any time-range internet_access
access-list acl_inside extended permit ip 172.16.3.128 255.255.255.128 any time-range internet_access
access-list acl_inside extended permit ip 172.16.4.128 255.255.255.128 any time-range internet_access
access-list acl_inside extended permit ip 172.16.5.128 255.255.255.128 any time-range internet_access
access-list acl_inside extended permit ip 172.16.6.128 255.255.255.128 any time-range internet_access
access-list acl_inside extended permit ip 172.16.7.128 255.255.255.128 any time-range internet_access

access-list outside_1_cryptomap extended permit ip 192.168.4.0 255.255.255.0 172.17.1.0 255.255.255.0
access-list inside_nat0_outbound extended permit ip 192.168.4.0 255.255.255.0 172.17.1.0 255.255.255.0

access-list im_deny extended permit ip 172.16.1.128 255.255.255.128 any
access-list im_deny extended permit ip 172.16.2.128 255.255.255.128 any
access-list im_deny extended permit ip 172.16.3.128 255.255.255.128 any
access-list im_deny extended permit ip 172.16.4.128 255.255.255.128 any
access-list im_deny extended permit ip 172.16.5.128 255.255.255.128 any
access-list im_deny extended permit ip 172.16.6.128 255.255.255.128 any
access-list im_deny extended permit ip 172.16.7.128 255.255.255.128 any

pager lines 24
logging enable
logging monitor debugging
logging asdm informational
logging class vpn console debugging
mtu outside 1500
mtu inside 1500
icmp unreachable rate-limit 1 burst-size 1
asdm image disk0:/asdm-522.bin
no asdm history enable
arp timeout 14400

global (outside) 1 interface
nat (inside) 0 access-list inside_nat0_outbound
nat (inside) 1 192.168.4.0 255.255.255.0
nat (inside) 1 172.16.0.0 255.255.0.0

static (inside,outside) tcp interface 3389 192.168.4.1 3389 netmask 255.255.255.255
static (inside,outside) tcp interface https 192.168.4.1 https netmask 255.255.255.255
static (inside,outside) tcp interface ftp 192.168.4.3 ftp netmask 255.255.255.255
static (inside,outside) tcp interface smtp 192.168.4.5 smtp netmask 255.255.255.255
static (inside,outside) tcp interface pop3 192.168.4.5 pop3 netmask 255.255.255.255
static (inside,outside) tcp interface www 192.168.4.5 www netmask 255.255.255.255
static (inside,outside) tcp interface imap4 192.168.4.5 imap4 netmask 255.255.255.255

access-group acl_outside in interface outside
access-group acl_inside in interface inside

route outside 0.0.0.0 0.0.0.0 10.1.1.1 1
route inside 172.16.0.0 255.255.0.0 10.1.2.2 1
route inside 192.168.4.0 255.255.255.0 10.1.2.2 1
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout uauth 0:05:00 absolute
http server enable
http 172.16.0.0 255.255.0.0 inside
http 192.168.4.0 255.255.255.0 inside
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart
crypto ipsec transform-set ESP-3DES-SHA esp-3des esp-sha-hmac
crypto map outside_map 1 match address outside_1_cryptomap
crypto map outside_map 1 set pfs
crypto map outside_map 1 set peer 210.245.33.153
crypto map outside_map 1 set transform-set ESP-3DES-SHA
crypto map outside_map interface outside
crypto isakmp identity address
crypto isakmp enable outside
crypto isakmp policy 10
authentication pre-share
encryption 3des
hash sha
group 2
lifetime 28800
crypto isakmp nat-traversal 20
telnet 192.168.4.0 255.255.255.0 inside
telnet timeout 5
ssh timeout 5
console timeout 0
!

class-map imdeny
match access-list im_deny
!
!
policy-map type inspect im IM-policy-map
parameters
match protocol msn-im yahoo-im
drop-connection
policy-map imdrop
class imdeny
inspect im IM-policy-map
!
service-policy imdrop interface outside

ssl encryption des-sha1 rc4-md5
username cisco password 3USUcOPFUiMCO4Jk encrypted privilege 15
tunnel-group 210.245.33.153 type ipsec-l2l
tunnel-group 210.245.33.153 ipsec-attributes
pre-shared-key *
prompt hostname context
Cryptochecksum:5e3b033edb3769a34031abe399caebd3
: end

LeThanhTung
08-09-2008, 02:52 PM
Em post cấu hình ASA của em lên đây, anh vui lòng xem giúp em có chỗ nào sai không ạ. Em cảm ơn anh nhiều.

mtflower
21-04-2009, 07:16 PM
Kính thưa anh Minh;

Anh vui lòng hướng dẫn chi tiết cho em làm cách nào chặn yahoo messenger, MSN messenger tren ASA 5510 nha anh.

Cam on anh nhieu,
Minh Tri

convoi
06-10-2009, 09:14 AM
Chào các anh chị,
Mọi người làm ơn cho em hỏi, hiện công ty em đang sử dụng ASA5510 và có set cho mọi người được vào internet từ 12h đến 1h. Nhưng riêng thằng Yahoo messenger nếu sign in rồi để đấy không sign out thì sau khi hết giờ truy cập internet nó vẫn cứ hoạt động. Mọi người chat chit làm ảnh hưởng đến công việc, em bị kêu ghê quá mà vẫn chưa biết cách nào để chặn cái thằng yahoo này lại. Mong các anh chị giúp đỡ cho em làm thế nào để chặn được nó trên ASA5510, em xin cảm ơn mọi người.
Bạn có thể tham khảo hướng dẫn sau: http://www.cisco.com/en/US/products/ps6120/products_configuration_example09186a00808c38a6.sht ml