L7 - Skype regexp blocking Microsoft Outlook SMTP

I have problem with my RB450G (v3.26 OS). I have VPN server, some 20-30 basic firewall rules and web proxy.
After I set-up L7 filtering for Skype service all outgoing messages form Microsoft Outlook 2007 are blocked.
I use to l7 Protocol: Skype and Skype-to-Phone. Only when Skype-to-Phone is enabled I have a problem. I try to disable other protocols and leave Skype-to-Phone active, but nothing.

this is regexp:

^(\x01.?.?.?.?.?.?.?.?\x01|\x02.?.?.?.?.?.?.?.?\x02|\x03.?.?.?.?.?.?.?.?\x03|\x04.?.?.?.?.?.?.?.?\x04|\x05.?.?.?.?.?.?.?.?\x05|\x06.?.?.?.?.?.?.?.?\x06|\x07.?.?.?.?.?.?.?.?\x07|\x08.?.?.?.?.?.?.?.?\x08|\x09.?.?.?.?.?.?.?.?\x09|\x0a.?.?.?.?.?.?.?.?\x0a|\x0b.?.?.?.?.?.?.?.?\x0b|\x0c.?.?.?.?.?.?.?.?\x0c|\x0d.?.?.?.?.?.?.?.?\x0d|\x0e.?.?.?.?.?.?.?.?\x0e|\x0f.?.?.?.?.?.?.?.?\x0f|\x10.?.?.?.?.?.?.?.?\x10|\x11.?.?.?.?.?.?.?.?\x11|\x12.?.?.?.?.?.?.?.?\x12|\x13.?.?.?.?.?.?.?.?\x13|\x14.?.?.?.?.?.?.?.?\x14|\x15.?.?.?.?.?.?.?.?\x15|\x16.?.?.?.?.?.?.?.?\x16|\x17.?.?.?.?.?.?.?.?\x17|\x18.?.?.?.?.?.?.?.?\x18|\x19.?.?.?.?.?.?.?.?\x19|\x1a.?.?.?.?.?.?.?.?\x1a|\x1b.?.?.?.?.?.?.?.?\x1b|\x1c.?.?.?.?.?.?.?.?\x1c|\x1d.?.?.?.?.?.?.?.?\x1d|\x1e.?.?.?.?.?.?.?.?\x1e|\x1f.?.?.?.?.?.?.?.?\x1f|\x20.?.?.?.?.?.?.?.?\x20|\x21.?.?.?.?.?.?.?.?\x21|\x22.?.?.?.?.?.?.?.?\x22|\x23.?.?.?.?.?.?.?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9|\xfa.?.?.?.?.?.?.?.?\xfa|\xfb.?.?.?.?.?.?.?.?\xfb|\xfc.?.?.?.?.?.?.?.?\xfc|\xfd.?.?.?.?.?.?.?.?\xfd|\xfe.?.?.?.?.?.?.?.?\xfe|\xff.?.?.?.?.?.?.?.?\xff)

all firewall rules:

 0   ;;; Accept established connections
     chain=input action=accept connection-state=established 

 1   ;;; Accept related connections
     chain=input action=accept connection-state=related 

 2   ;;; Drop invalid connections
     chain=input action=drop connection-state=invalid 

 3   ;;; UDP
     chain=input action=accept protocol=udp 

 4   ;;; Allow limited pings
     chain=input action=accept protocol=icmp limit=50/5s,2 

 5   ;;; Drop excess pings
     chain=input action=drop protocol=icmp 

 6   ;;; SSH for secure shell
     chain=input action=accept protocol=tcp dst-port=22 

 7   ;;; winbox
     chain=input action=accept protocol=tcp dst-port=8291 

 8   ;;; From Mikrotikls network
     chain=input action=accept src-address=159.148.172.192/28 

 9   ;;; From our private LAN
     chain=input action=accept src-address=192.168.10.0/24 

10   ;;; Log everything else
     chain=input action=log log-prefix="DROP INPUT" 

11   chain=output action=accept protocol=tcp content=530 Login incorrect dst-limit=1/1m,9,dst-address/1m 

12   chain=output action=add-dst-to-address-list protocol=tcp address-list=ftp_blacklist address-list-timeout=3h content=530 Login incorrect 

13   ;;; drop ssh brute forcers
     chain=input action=drop protocol=tcp src-address-list=ssh_blacklist dst-port=22 

14   chain=input action=add-src-to-address-list connection-state=new protocol=tcp src-address-list=ssh_stage3 address-list=ssh_blacklist 
     address-list-timeout=1w3d dst-port=22 

15   chain=input action=add-src-to-address-list connection-state=new protocol=tcp src-address-list=ssh_stage2 address-list=ssh_stage3 address-list-timeout=1m 
     dst-port=22 

16   chain=input action=add-src-to-address-list connection-state=new protocol=tcp src-address-list=ssh_stage1 address-list=ssh_stage2 address-list-timeout=1m 
     dst-port=22 

17   chain=input action=add-src-to-address-list connection-state=new protocol=tcp address-list=ssh_stage1 address-list-timeout=1m dst-port=22 

18   chain=input action=drop protocol=tcp src-address=0.0.0.0/0 in-interface=ether1 dst-port=8080 

19   ;;; Skype
     chain=forward action=drop layer7-protocol=Skype 
20 X ;;; Skype-to-Phone
     chain=forward action=drop layer7-protocol=Skype-to-Phone 

21 X ;;; MSN
     chain=forward action=drop layer7-protocol=MSN 

22 X ;;; MSN FT
     chain=forward action=drop layer7-protocol=MSN FT 

23 X ;;; Yahoo
     chain=forward action=drop layer7-protocol=Yahoo 

24 X ;;; AIM
     chain=forward action=drop layer7-protocol=AIM 

25 X ;;; ICQ
     chain=forward action=drop layer7-protocol=ICQ 

26 X ;;; IRC
     chain=forward action=drop layer7-protocol=IRC

Please HELP!!!

well that is the problem with l7. There are no 100% guarantee that matcher will match only skype, if outlook has the same signature then it will be matched.

So is it any other way to forbid Skype on MT?

skype can’t be 100% blocked by any solution in any software.

Thanks a lot!!!

“Outgoing messages form Microsoft Outlook 2007” are SMTP traffic to port TCP 25 right? Then add one rule that allows (accept) all traffic to tcp:25 or your outgoing mail server IP and that’s it.

Yancho

I already try with putting rule for port25, but without success. But please write me a full command rule, and I’ll try again.

have you unchecked passtrough box in that rule?

I tried various combination, but please write whole rule for me, and then I’ll try again.

tcp:25 accept rule should be on the top of l7 rule.

I just try some various rules and any of them doesn’t work

tried rules

ip firewall filter add chain=input port=25 action=accept protocol=tcp
ip firewall filter add chain=forward port=25 action=accept protocol=tcp
ip firewall filter add chain=output port=25 action=passthrough protocol=tcp
ip firewall filter add chain=output port=25 action=accept protocol=tcp

I tried to put the rule to the top of the list.

I also try to use different port for mail communication (2525), and problem is the same.

I fallowed the traffic on my problematic Skype-to-Phone rule and traffic is moving every time I try to send email (with or without uper rules).

Modify yhe folowing lines…

19 ;;; Skype
chain=forward action=drop layer7-protocol=Skype
20 X ;;; Skype-to-Phone
chain=forward action=drop layer7-protocol=Skype-to-Phone


Add a “! mail server address” in the source field…

IE exclude the mail server from the “test”…

IE drop all traffic that IS NOT comming from the mail server that matches the L7 payload test…

I tried with this configuration, but no real success. After this mail works, but then Skype works to.

I use this modification:

19   ;;; Skype
     chain=forward action=drop src-address-list="smtp.ruzavjetrova.me" layer7-protocol=Skype 

20   ;;; Skype-to-Phone
     chain=forward action=drop src-address-list="smtp.ruzavjetrova.me" layer7-protocol=Skype-to-Phone

This is going to sound stupid… but I have to ask…

  1. Is the mail server running ANY form of skype? (Could creata a “super node”)
  2. What addresses are in the list? Just the mail server(s) or is it a local “net”?

What addresses are “skyping”… ?

I believe you should add the “not” indicator (!) before the src-address list. IE “drop everything that does not come from this src-address”

Yep… he has it… I didnt see a “NOT” eather…

In winbox, set the flag infront of the address box.. it will put a “!” in the small box..

This is a NOT flag…

I think now is OK. I just tried with this ! NOT flag and it’s work.
I’ll test it for some time.

Thanks!!!

Hi, can I have the regex for skype and actionvoip?
I need to block these two using L7 protocol but it is not working for me.
I used this in Layer 7:
^.+(skype.com|actionvoip.com).*$
and then in ip firewall filter:
For VoIP
chain=forward action=drop src-address-list=BlockedVoIP layer7-protocol=VoIP

I think the regex are wrong or something is missing.
Please help.