Community discussions

MikroTik App
 
bennyh
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Fri Mar 03, 2017 12:37 pm

How to block URL-s contains IP address (Proxy)

Thu May 17, 2018 12:02 pm

I'd like to block in Mikrotik web proxy to the proxy clients use URL-s contains direct IP address of remote (web,ftp) servers. I want to allow only domain names, because i'd like to filter web access by DNS service.

Example:
Allowed by proxy: https://www.mikrotik.com
Blocked by proxy: https://159.148.147.196
 
msatter
Forum Guru
Forum Guru
Posts: 2912
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: How to block URL-s contains IP address (Proxy)

Thu May 17, 2018 12:47 pm

I use the content filter in RAW to drop the direct IP traffic. You have to disable fast tracking for that direction or only engage fast tracking after 1100bytes. It was in a recent MUM presentation if I remember that correctly.
This is for a known IP and if you want to filter all direct IP address on port 80 you can use a regex.
 
bennyh
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Fri Mar 03, 2017 12:37 pm

Re: How to block URL-s contains IP address (Proxy)

Thu May 17, 2018 12:55 pm

I use the content filter in RAW to drop the direct IP traffic. You have to disable fast tracking for that direction or only engage fast tracking after 1100bytes. It was in a recent MUM presentation if I remember that correctly.
This is for a known IP and if you want to filter all direct IP address on port 80 you can use a regex.
Could you show me the filter?
I dont want to block in forward chain. I only want to block between proxy and client, or proxy and remote host (http/ftp server). The direct connection is blocked. Almost everything have to go trough the webproxy.
 
bennyh
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Fri Mar 03, 2017 12:37 pm

Re: How to block URL-s contains IP address (Proxy)

Thu May 17, 2018 4:13 pm

Can the Layer 7 filter check the clients connections to the proxy? Maybe can somebody send me regexp code, to filter if a client sand an url to the proxy which url contains ip address and not domain name?
 
bennyh
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Fri Mar 03, 2017 12:37 pm

Re: How to block URL-s contains IP address (Proxy)

Fri May 18, 2018 10:03 am

Somebody?
 
bennyh
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Fri Mar 03, 2017 12:37 pm

Re: How to block URL-s contains IP address (Proxy)

Tue May 22, 2018 10:49 am

Any idea?
 
bennyh
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Fri Mar 03, 2017 12:37 pm

Re: How to block URL-s contains IP address (Proxy)

Wed May 23, 2018 11:08 am

Any idea?
Meanwhile, I made a proxy auto config script, wich check if hostname is IP address with very simple regexp:
"var ip_regexp=/\d+\.\d+\.\d+\.\d+$/"

and check the logical value of this method call:
"ip_regexp.test(host)"

But would be better If I could block in the Mikrotik proxy or firewall, not on the client side.
Any idea?
 
reinerotto
Long time Member
Long time Member
Posts: 520
Joined: Thu Dec 04, 2008 2:35 am

Re: How to block URL-s contains IP address (Proxy)

Wed May 23, 2018 11:34 pm

Yes: Use a full-featured proxy, like squid.

Your usage case is one more argument against using MT for hotspots
with above-basic requirements.
As in openwrt, I often integrated squid. Also to implement
your requested functionality :-)
 
bennyh
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Fri Mar 03, 2017 12:37 pm

Re: How to block URL-s contains IP address (Proxy)

Thu May 24, 2018 8:47 am

Yes: Use a full-featured proxy, like squid.

Your usage case is one more argument against using MT for hotspots
with above-basic requirements.
As in openwrt, I often integrated squid. Also to implement
your requested functionality :-)
Ha-ha, verry funny

Now I use an IPFire proxy, and I want to get rid of it, because I can use blocklists and safe DNS with the MT box (3011) what is strong enough to serve all of my users (30) and neither the IPfire cant do ssl intercept, so unnecessary a seperate proxy server, and because IPFire run on a very loaded Hyper-V server, I can save some memory and CPU resource.

There is a Layer7 filter, it really doesnt use for this? I am very unfamiliar with Layer7 filter and regular expressions. I tought, there is somebody who can help me.
 
reinerotto
Long time Member
Long time Member
Posts: 520
Joined: Thu Dec 04, 2008 2:35 am

Re: How to block URL-s contains IP address (Proxy)

Thu May 24, 2018 9:11 am

Dump IPFire, install a small/old x86-PC running squid as local proxy within your network. This can do, what you want.
It is always strange, to read some questions, having already a supposed-to-work answer included :-)
 
bennyh
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Fri Mar 03, 2017 12:37 pm

Re: How to block URL-s contains IP address (Proxy)

Thu May 24, 2018 12:49 pm

Dump IPFire, install a small/old x86-PC running squid as local proxy within your network. This can do, what you want.
It is always strange, to read some questions, having already a supposed-to-work answer included :-)
This isnt the answer. I asked, how to do this with Mikrotik, you wrote how to do with other device/software. Thats the strange.
 
bennyh
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Fri Mar 03, 2017 12:37 pm

Re: How to block URL-s contains IP address (Proxy)

Mon May 28, 2018 12:38 pm

Up?

Who is online

Users browsing this forum: keithy, scoobyn8 and 111 guests