ā07-16-2016 03:34 AM - edited ā03-12-2019 01:01 AM
Please help me get this URL filter that uses class-maps work. I am connected to the firewall port e0/1 via a non-managed dlink switch. The firewall is connected to ISP router via its e0/0 port. ISP router port the firewall connects to (gateway) is 192.168.109.1. The intention is to drop all connections that match the URLs. Below is the present configuration...(I have scrambled some of the regular expressions)
ASA Version 8.2(4)4
!
firewall transparent
hostname R
names
!
interface Ethernet0/0
switchport access vlan 2
!
interface Ethernet0/1
switchport access vlan 3
!
interface Ethernet0/2
switchport access vlan 3
!
interface Ethernet0/3
shutdown
!
interface Ethernet0/4
shutdown
!
interface Ethernet0/5
shutdown
!
interface Ethernet0/6
shutdown
!
interface Ethernet0/7
shutdown
!
interface Vlan2
nameif outside
security-level 0
!
interface Vlan3
nameif inside
security-level 100
!
regex domainlist1 "\.facebook\.com"
regex domainlist2 "\.youtube\.com"
regex domainlist3 "\.aaaaaaa\.com"
regex domainlist4 "\.jjjjjjj\.com"
regex domainlist5 "\.bbbbbb\.co\.ke"
regex domainlist6 "\.uuuuuu\.com"
regex domainlist7 "\.uuuuuu\.com"
boot system disk0:/asa824-4-k8.bin
ftp mode passive
object-group network SUPER_USERS
network-object 192.168.109.128 255.255.255.192
access-list LIMIT_TRAFFIC extended deny tcp object-group SUPER_USERS any eq www
access-list LIMIT_TRAFFIC extended permit tcp any any eq www
pager lines 24
mtu outside 1500
mtu inside 1500
ip address 192.168.109.6 255.255.255.0
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
route outside 0.0.0.0 0.0.0.0 192.168.109.1 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 sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
timeout floating-conn 0:00:00
dynamic-access-policy-record DfltAccessPolicy
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart
crypto ipsec security-association lifetime seconds 28800
crypto ipsec security-association lifetime kilobytes 4608000
telnet 192.168.109.0 255.255.255.0 inside
telnet timeout 5
ssh 192.168.109.0 255.255.255.0 inside
ssh timeout 5
console timeout 0
dhcpd option 3 ip 192.168.109.1
!
dhcpd address 192.168.109.36-192.168.109.126 inside
dhcpd dns 212.22.161.2 212.22.161.3 interface inside
dhcpd enable inside
!
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
!
class-map block_users
match access-list LIMIT_TRAFFIC
class-map type inspect http match-any blocked_class
match request header host regex domainlist1
match request header host regex domainlist2
match request header host regex domainlist3
match request header host regex domainlist4
match request header host regex domainlist5
match request header host regex domainlist6
match request header host regex domainlist7
class-map inspection_default
match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
parameters
message-length maximum client auto
message-length maximum 512
policy-map type inspect http block_policy
parameters
class blocked_class
drop-connection log
policy-map block_users_policy
class block_users
inspect http block_policy
policy-map global_policy
class inspection_default
inspect dns preset_dns_map
inspect ftp
inspect h323 h225
inspect h323 ras
inspect rsh
inspect rtsp
inspect esmtp
inspect sqlnet
inspect skinny
inspect sunrpc
inspect xdmcp
inspect sip
inspect netbios
inspect tftp
inspect ip-options
!
service-policy global_policy global
service-policy block_users_policy interface inside
prompt hostname context
Cryptochecksum:2aac2b3cd1cf71199ff47c9b1956ac4c
: end
Solved! Go to Solution.
ā07-16-2016 02:21 PM
I hate using that method, it is always so painful. I prefer to use DNS inspection instead. Below is an example for one domain. This blocks the actual DNS request, so works for http, https, ftp - everything. Note that you will need to clear your DNS cache if you have already done the DNS lookup before putting this code in place.
regex domain_logmein.com ā\.logmein\.comā
!
class-map type regex match-any DomainBlockList
description Blocked Domains
match regex domain_logmein.com
!
policy-map type inspect dns PM-DNS-inspect
parameters
match domain-name regex class DomainBlockList
drop-connection log
!
policy-map global_policy
class inspection_default
inspect dns PM-DNS-inspect
!
service-policy global_policy global
ā07-18-2016 09:09 AM
It would be great if you could rate and mark helpful responses.
ā07-16-2016 02:21 PM
I hate using that method, it is always so painful. I prefer to use DNS inspection instead. Below is an example for one domain. This blocks the actual DNS request, so works for http, https, ftp - everything. Note that you will need to clear your DNS cache if you have already done the DNS lookup before putting this code in place.
regex domain_logmein.com ā\.logmein\.comā
!
class-map type regex match-any DomainBlockList
description Blocked Domains
match regex domain_logmein.com
!
policy-map type inspect dns PM-DNS-inspect
parameters
match domain-name regex class DomainBlockList
drop-connection log
!
policy-map global_policy
class inspection_default
inspect dns PM-DNS-inspect
!
service-policy global_policy global
ā07-17-2016 09:54 AM
Wow, thanks Philip for your response. I will try this first thing tomorrow morning and let you know how it will work. I appreciate your advice!
ā07-18-2016 09:09 AM
It would be great if you could rate and mark helpful responses.
ā07-20-2016 06:58 AM
already did! thanks again.
ā07-18-2016 05:30 AM
Thanks Philip. It worked like magic!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide