Linux Netfilter discussions
 help / color / mirror / Atom feed
* rate limit SIP INVITES
@ 2020-09-26 19:10 sean darcy
  2020-09-26 20:26 ` sean darcy
  2020-09-27 13:54 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 10+ messages in thread
From: sean darcy @ 2020-09-26 19:10 UTC (permalink / raw)
  To: netfilter

nftables-0.9.6

I'm running a VOIP server. There are lots of script kiddies who will 
bang away with 10/sec SIP INVITES or REGISTERS .

In iptables you can match on the string:

-A SIP   -i eth0 -p udp -m udp --dport 5060 -m string   --string 
"INVITE" --algo bm --from 23 --to 28 -m comment --comment "Catch SIP 
INVITEs" -j SIPINVITE

-A SIP   -i eth0 -p udp -m udp --dport 5060 -m string   --string 
"REGISTER" --algo bm --from 23 --to 30 -m comment --comment "Catch SIP 
REGISTERs" -j SIPREGISTER

I'm looking at RAW to do the same:

meta l4proto udp udp dport 5060 @th,184,224 0x494e56495445 counter

where 184 = 23*8, and 224 = 28*8. INVITE is 0x494e56495445 in hex

I have a prerouting chain:

table ip filter-asterisk {
	chain output-asterisk {
		..................
	}

	chain prerouting {
		type filter hook prerouting priority raw; policy accept;
	}
}

but no joy when I try to add the rule:

nft add rule filter-asterisk prerouting meta l4proto udp udp dport 5060 
@th,184,224 0x494e56495445 counter
Error: Could not process rule: Value too large for defined data type
add rule filter-asterisk prerouting meta l4proto udp udp dport 5060 
@th,184,224 0x494e56495445 counter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Any help appreciated.

sean


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-28 18:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-26 19:10 rate limit SIP INVITES sean darcy
2020-09-26 20:26 ` sean darcy
2020-09-26 20:34   ` sean darcy
2020-09-26 20:45   ` sean darcy
2020-09-27 13:54 ` Pablo Neira Ayuso
2020-09-27 14:03   ` Pablo Neira Ayuso
2020-09-27 15:42     ` sean darcy
2020-09-27 19:12       ` Florian Westphal
2020-09-27 20:59       ` Pablo Neira Ayuso
2020-09-28 18:09         ` sean darcy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox