RE: IP Filtering Patch

"Moser, Robert L. II" <[email protected]> Thu, 20 Feb 2003 07:24:34 -0800
Newsgroups gmane.music.equipment.slimp3.dev
Message-ID <8F76CAB2F77CE542B4B6CCEDD9B03CCB01B2D528@vhapalexce.v21.med.va.gov>
------=_NextPartTM-000-62aebbe4-8968-496e-8ce5-5185738ad74e
Content-Type: multipart/alternative;
 boundary="----_=_NextPart_001_01C2D8F4.2C6D36D0"

------_=_NextPart_001_01C2D8F4.2C6D36D0
Content-Type: text/plain;
	charset="iso-8859-1"

In HTTP.pm in the init() portion we could look up the address corresponding
to the host name and store it in a package variable.  Then the validation
could add that address to the acceptible addresses.
 
To get the address - in HTTP.pm
+my $hostaddr;
sub init {
+    my $host = hostname();
+   $hostaddr = inet_ntoa(scalar gethostbyname($host || 'localhost'));
    idle();
}
+ sub hostaddr {
+    return $hostaddr;
+}
 
and in Misc.pm
 
sub isAllowedHost {	
 
 	         

    my $host = shift;
	    my @rules = split /\,/, SliMP3::Prefs::get('allowedHosts');	
 
 		
+    unshift @rules,SliMP3::HTTP::hostaddr();
 
 
Robert
 
 
 
 

-----Original Message-----
From: Metzger, Michael [mailto:[email protected]]
Sent: Thursday, February 20, 2003 6:55 AM
To: '[email protected]'
Subject: RE: [slimp3-dev] IP Filtering Patch


I unfortunately don't have any access to OSX.  I've noticed on Windows if
you type in the machine name or the IP address, it will use the NIC address
as the source and block the IP.  If you type something like
http://localhost:9000/ <http://localhost:9000/>  it will use the localhost
as the source and it works.
 
The only option I can think of to work around this is grab the source IP
from the request and add it in accordingly, but I'm not sure this is what is
actually needed, especially if there are multiple NICs in the system.  
 
Any ideas?
 
Thanks
 
Mike

-----Original Message-----
From: dean blackketter [mailto:[email protected]]
Sent: Thursday, February 20, 2003 12:57 AM
To: [email protected]
Subject: Re: [slimp3-dev] IP Filtering Patch



I've checked in this patch (with some rewriting of the strings for clarity.)



On my OS X machine, incoming connections from the same machine are blocked
unless I explicitly put in the IP address for that machine, that is, even if
127.0.0.1 is allowed, I need to add 10.0.1.204 to make it work. I'd love a
fix for this. 


-dean 


------_=_NextPart_001_01C2D8F4.2C6D36D0
Content-Type: text/html; charset=US-ASCII
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE></TITLE>

<META content="MSHTML 5.50.4922.900" name=GENERATOR></HEAD>
<BODY>


<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff size=2>In 
HTTP.pm in the init() portion we could look up the address corresponding to the 
host name and store it in a package variable.&nbsp; Then the validation could 
add that address to the acceptible addresses.</FONT></SPAN></DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff size=2>To get 
the address - in HTTP.pm</FONT></SPAN></DIV>
<DIV><SPAN class=621071615-20022003><!--StartFragment -->+my 
$hostaddr;</SPAN></DIV>
<DIV><SPAN class=621071615-20022003>sub init {</SPAN></DIV>
<DIV><SPAN class=621071615-20022003>+&nbsp;&nbsp;&nbsp; my $host = 
hostname();<BR>+&nbsp;&nbsp; $hostaddr = inet_ntoa(scalar gethostbyname($host || 
'localhost'));</SPAN></DIV>
<DIV><SPAN class=621071615-20022003>&nbsp;&nbsp;&nbsp; idle();</SPAN></DIV>
<DIV><SPAN class=621071615-20022003>}</SPAN></DIV>
<DIV><SPAN class=621071615-20022003>+ sub hostaddr {</SPAN></DIV>
<DIV><SPAN class=621071615-20022003>+&nbsp;&nbsp;&nbsp; return 
$hostaddr;</SPAN></DIV>
<DIV><SPAN class=621071615-20022003>+}</SPAN></DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff size=2>and in 
Misc.pm</FONT></SPAN></DIV>
<DIV><SPAN class=621071615-20022003><!--StartFragment -->&nbsp;<TR><TD 
bgcolor="#aaffaa"><FONT face=Helvetica,Arial size=-1>sub isAllowedHost 
{</FONT></TD></TR>&nbsp;<TR><TD bgcolor="#cccccc">&nbsp;</TD><TD 
bgcolor="#aaffaa"><FONT face=Helvetica,Arial 
size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Helvetica,Arial 
size=-1>&nbsp;&nbsp;&nbsp; my $host = shift;</FONT></SPAN></DIV>
<DIV><SPAN class=621071615-20022003><TR><TD bgcolor="#cccccc"></TD><TD 
bgcolor="#aaffaa"><FONT face=Helvetica,Arial size=-1>&nbsp;&nbsp;&nbsp; my 
@rules = split /\,/, 
SliMP3::Prefs::get('allowedHosts');</FONT></TD></TR>&nbsp;<TR><TD 
bgcolor="#cccccc">&nbsp;</TD><TD bgcolor="#aaffaa"><FONT face=Helvetica,Arial 
size=-1></FONT></TD></TR> </SPAN></DIV>
<DIV><SPAN class=621071615-20022003>+&nbsp;&nbsp;&nbsp; unshift 
@rules,SliMP3::HTTP::hostaddr();</SPAN></DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff 
size=2>Robert</FONT></SPAN></DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=621071615-20022003><FONT face=Arial color=#0000ff 
size=2></FONT>&nbsp;</DIV>
<P><FONT face=Arial color=#0000ff size=2></FONT></P></SPAN>
<BLOCKQUOTE 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Metzger, Michael 
  [mailto:[email protected]]<BR><B>Sent:</B> Thursday, February 20, 2003 
  6:55 AM<BR><B>To:</B> '[email protected]'<BR><B>Subject:</B> RE: 
  [slimp3-dev] IP Filtering Patch<BR><BR></FONT></DIV>
  <DIV><SPAN class=829364714-20022003><FONT face=Arial color=#0000ff size=2>I 
  unfortunately don't have any access to OSX.&nbsp; I've noticed on Windows if 
  you type in the machine name or the IP address, it will use the NIC address as 
  the source and block the IP.&nbsp; If you type something like <A 
  href="http://localhost:9000/">http://localhost:9000/</A> it will use the 
  localhost as the source and it works.</FONT></SPAN></DIV>
  <DIV><SPAN class=829364714-20022003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=829364714-20022003><FONT face=Arial color=#0000ff size=2>The 
  only option I can think of to work around this is grab the source IP from the 
  request and add it in accordingly, but I'm not sure this is what is actually 
  needed, especially if there are multiple NICs in the system.&nbsp; 
  </FONT></SPAN></DIV>
  <DIV><SPAN class=829364714-20022003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=829364714-20022003><FONT face=Arial color=#0000ff size=2>Any 
  ideas?</FONT></SPAN></DIV>
  <DIV><SPAN class=829364714-20022003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=829364714-20022003><FONT face=Arial color=#0000ff 
  size=2>Thanks</FONT></SPAN></DIV>
  <DIV><SPAN class=829364714-20022003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=829364714-20022003><FONT face=Arial color=#0000ff 
  size=2>Mike</FONT></SPAN></DIV>
  <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
    <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
    size=2>-----Original Message-----<BR><B>From:</B> dean blackketter 
    [mailto:[email protected]]<BR><B>Sent:</B> Thursday, February 20, 2003 
    12:57 AM<BR><B>To:</B> [email protected]<BR><B>Subject:</B> Re: 
    [slimp3-dev] IP Filtering Patch<BR><BR></FONT></DIV>
    <P>I've checked in this patch (with some rewriting of the strings for 
    clarity.) </P><BR>
    <P>On my OS X machine, incoming connections from the same machine are 
    blocked unless I explicitly put in the IP address for that machine, that is, 
    even if 127.0.0.1 is allowed, I need to add 10.0.1.204 to make it work. I'd 
    love a fix for this. </P><BR>
    <P>-dean </P></BLOCKQUOTE></BLOCKQUOTE>
<br>

<!-- |**|begin egp html banner|**| -->

<table border=0 cellspacing=0 cellpadding=2>
<tr bgcolor=#FFFFCC>
<td align=center><font size="-1" color=#003399><b>Yahoo! Groups Sponsor</b></font></td>
</tr>
<tr bgcolor=#FFFFFF>
<td align=center width=470><table border=0 cellpadding=0 cellspacing=0> <tr> <td align=center><font face=arial size=-2>ADVERTISEMENT</font><br><a href="http://rd.yahoo.com/M=245454.2994396.4323964.2848452/D=egroupweb/S=1708298795:HM/A=1457554/R=0/*http://ipunda.com/clk/beibunmaisuiyuiwabei"><img src="http://us.a1.yimg.com/us.yimg.com/a/qu/quinstreet/uofpoff_300_250_0001.gif" alt="" width="300" height="250" border="0"></a></td></tr></table></td>
</tr>
<tr><td><img alt="" width=1 height=1 src="http://us.adserver.yahoo.com/l?M=245454.2994396.4323964.2848452/D=egroupmail/S=:HM/A=1457554/rand=680828485"></td></tr>
</table>

<!-- |**|end egp html banner|**| -->


<br>
<tt>
To unsubscribe from this group, send an email to:<BR>
[email protected]<BR>
<BR>
</tt>
<br>

<br>
<tt>Your use of Yahoo! Groups is subject to the <a href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</a>.</tt>
</br>

</BODY></HTML>

------_=_NextPart_001_01C2D8F4.2C6D36D0--

------=_NextPartTM-000-62aebbe4-8968-496e-8ce5-5185738ad74e--