I have a Ubuntu server where my SIP proxy server is currently running. I've configured iptables on my proxy server according to following statements:
*filter
# Allows all loopback traffic and drop all traffic to 127/8 that doesn't use lo
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
-A INPUT -i eth0 -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -i eth2 -p icmp --icmp-type 8 -s 0/0 -d 1.2.3.4 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
-A INPUT -i eth2 -d 1.2.3.4 -p udp -m multiport --dports 5060,5061 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i eth2 -d 1.2.3.4 -p tcp -m multiport --dports 5060,5061 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i eth2 -j REJECT
# Reject all other inbound from public (eth2) - default deny unless explicitly allowed policy
-A FORWARD -i eth0 -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -i eth2 -j REJECT
# Outbound traffic
-A OUTPUT -j ACCEPT
# Log
-I INPUT 5 -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
COMMIT
And by executing iptables -L -v -n
i can see that packets, that i have sent from my Jitsi (a audio/video and chat communicator that supports protocols such as SIP, XMPP/Jabber etc.) to my proxy sevrer to authenticate, are being ACCEPTED:
pkts bytes target prot opt in out source destination
14 7881 ACCEPT udp -- eth2 * 0.0.0.0/0 1.2.3.4 multiport dports 5060,5061 state NEW,ESTABLISHED
0 0 ACCEPT tcp -- eth2 * 0.0.0.0/0 1.2.3.4 multiport dports 5060,5061 state NEW,ESTABLISHED
0 0 REJECT all -- eth2 * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
But, iptables reports that these packets are being dropped!
Feb 5 16:55:25 sip kernel: [ 788.538025] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5381 PROTO=UDP SPT=2119 DPT=5060 LEN=546
Feb 5 16:55:26 sip kernel: [ 789.041576] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5387 PROTO=UDP SPT=2119 DPT=5060 LEN=546
Feb 5 16:55:27 sip kernel: [ 790.041679] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5388 PROTO=UDP SPT=2119 DPT=5060 LEN=546
Feb 5 16:55:29 sip kernel: [ 792.041974] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5390 PROTO=UDP SPT=2119 DPT=5060 LEN=546
Feb 5 16:55:33 sip kernel: [ 796.042401] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5391 PROTO=UDP SPT=2119 DPT=5060 LEN=546
Feb 5 16:55:41 sip kernel: [ 804.043009] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5393 PROTO=UDP SPT=2119 DPT=5060 LEN=546
Feb 5 16:55:53 sip kernel: [ 816.043858] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5410 PROTO=UDP SPT=2119 DPT=5060 LEN=546
Feb 5 16:58:18 sip kernel: [ 961.394041] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5785 PROTO=UDP SPT=1254 DPT=5060 LEN=546
Feb 5 16:58:18 sip kernel: [ 961.894736] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5786 PROTO=UDP SPT=1254 DPT=5060 LEN=546
Feb 5 16:58:19 sip kernel: [ 962.894533] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5787 PROTO=UDP SPT=1254 DPT=5060 LEN=546
Feb 5 16:58:21 sip kernel: [ 964.894617] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5788 PROTO=UDP SPT=1254 DPT=5060 LEN=546
Feb 5 16:58:25 sip kernel: [ 968.894651] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=566 TOS=0x00 PREC=0x00 TTL=127 ID=5789 PROTO=UDP SPT=1254 DPT=5060 LEN=546
Feb 5 16:58:32 sip kernel: [ 975.544611] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=614 TOS=0x00 PREC=0x00 TTL=127 ID=5793 PROTO=UDP SPT=1254 DPT=5060 LEN=594
Feb 5 16:58:44 sip kernel: [ 987.045243] iptables denied: IN=eth2 OUT= MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=4.3.2.1 DST=1.2.3.4 LEN=614 TOS=0x00 PREC=0x00 TTL=127 ID=5808 PROTO=UDP SPT=1254 DPT=5060 LEN=594
Why are my packets being dropped when they are being ACCEPTED by the rule -A INPUT -i eth2 -d 1.2.3.4 -p udp -m multiport --dports 5060,5061 -m state --state NEW,ESTABLISHED -j ACCEPT
?