<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2769" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>One last check...won't ask again, promise 
:)</FONT></DIV>
<DIV><FONT face=Arial size=2>Does someone know a solution to my problem 
below?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Best Regards</FONT></DIV>
<DIV><FONT face=Arial size=2>Goran</FONT></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=goran@goran.aleborg.se href="mailto:goran@goran.aleborg.se">Goran 
  Tornqvist</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A 
  title=asterisk-users@lists.digium.com 
  href="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, October 26, 2005 10:33 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Asterisk iptables rules</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
  <DIV><FONT face=Arial size=2>I have trouble getting asterisk to work with my 
  new firewall script (see below).</FONT></DIV>
  <DIV><FONT face=Arial size=2>I used this info as base: </FONT><FONT face=Arial 
  size=2>'<A 
  href="http://www.voip-info.org/wiki-Asterisk+firewall+rules">http://www.voip-info.org/wiki-Asterisk+firewall+rules</A></FONT></DIV>
  <DIV><FONT face=Arial size=2>And then modified it to suit my 
  needs.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I use only SIP and the problem is that the calls 
  get in to asterisk when the firewall is activated.</FONT></DIV>
  <DIV><FONT face=Arial size=2>But my agents/phones cant register or receive any 
  calls. So all calls&nbsp;get stuck in queue on asterisk.</FONT></DIV>
  <DIV><FONT face=Arial size=2>So I believe Im missing some rule 
  perhaps?</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Can anyone help me sort&nbsp;this 
  out?</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Thanks...</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Best Regards</FONT></DIV>
  <DIV><FONT face=Arial size=2>Goran</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>/etc/init.d/firewall</FONT></DIV>
  <DIV><FONT face=Arial 
  size=2>======================================</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>#IPTables firewall configuration for 
  X</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>export PATH=$PATH:/sbin</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>case "$1" in<BR>&nbsp; start)</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; echo "Starting iptables 
  firewall..."</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; iptables 
  --flush<BR>&nbsp;&nbsp;&nbsp; iptables --delete-chain</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p icmp -i 
  eth0 -j ACCEPT</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; # START OPEN 
  PORTS<BR>&nbsp;&nbsp;&nbsp; #=================</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; #SSH 
  (22)<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -i eth0 --dport 22 -j 
  ACCEPT</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; #SAMBA: netbios (139) , 
  microsoft-ds (445)<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -i eth0 
  --dport 139 -j ACCEPT<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -i eth0 
  --dport 445 -j ACCEPT<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; 
  #ASTERISK</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # SIP (UDP 
  5060)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -m tcp -i 
  eth0 --dport 5060 -j ACCEPT<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iptables -A 
  INPUT -p udp -m udp -i eth0 --dport 5060 -j ACCEPT</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # IAX2/IAX 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iptables -A INPUT -p udp -m udp -i eth0 
  --dport 4569 -j ACCEPT<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iptables -A INPUT -p 
  udp -m udp -i eth0 --dport 5036 -j ACCEPT </FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # RTP - the media 
  stream <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iptables -A INPUT -p udp -m udp -i 
  eth0 --dport 10000:20000 -j ACCEPT </FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # MGCP - if you 
  use media gateway control protocol in your configuration 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iptables -A INPUT -p udp -m udp -i eth0 
  --dport 2727 -j ACCEPT </FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; #END 
  ASTERISK&nbsp;&nbsp;&nbsp; </FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; #MySQL 
  (3306)<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -i eth0 --dport 3306 -j 
  ACCEPT<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p udp -i eth0 --dport 3306 -j 
  ACCEPT</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; #SNMP (161) - Allow from cacti 
  server<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -i eth0 --dport 161 
  --source x.x.x.x -j ACCEPT<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p udp -i 
  eth0 --dport 161 --source x.x.x.x -j ACCEPT</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; #Ftp / Passive 
  ports<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -i eth0 --dport 21 -j 
  ACCEPT<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -i eth0 --dport 
  64785:64799 -j ACCEPT</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; #Http / 
  Web<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -i eth0 --dport 80 -j 
  ACCEPT</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; #Webmin 
  (10000)<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p tcp -i eth0 --dport 10000 
  -j ACCEPT</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; # END OPEN 
  PORTS<BR>&nbsp;&nbsp;&nbsp; #=================</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; #Deny everything 
  else<BR>&nbsp;&nbsp;&nbsp; iptables -A INPUT -p all -i eth0 -j 
  DROP</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; exit 0;<BR>&nbsp;&nbsp;&nbsp; 
  ;;</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp; stop)</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; echo "Stopping iptables 
  firewall..."<BR>&nbsp;&nbsp;&nbsp; iptables --flush<BR>&nbsp;&nbsp;&nbsp; 
  iptables --delete-chain</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; exit 0;<BR>&nbsp;&nbsp;&nbsp; 
  ;;</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp; *)<BR>&nbsp;&nbsp;&nbsp; echo "Valid 
  switches: firewall start , firewall stop";</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>esac;<BR></FONT></DIV></BLOCKQUOTE></BODY></HTML>