directing to specific outgoing port

This is a discussion on directing to specific outgoing port within the PHP General forums, part of the PHP Programming Forums category; I have a command line script which uses php curl to go out to the internet to retrieve some information. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-31-2006
howfuchs@gmail.com
 
Posts: n/a
Default directing to specific outgoing port

I have a command line script which uses php curl to go out to the
internet to retrieve some information. Now this works fine in most
situations except when trying to get of a network where the network
firewall is blocking a range of outgoing ports.I am told by the
'gatekeeper' that the script accesses different ports each time it
tries to get out to the internet. My question is: Can I programatically
direct my script to go out of a specific port that I know is open?

Appreciate any help.

Howard

Reply With Quote
  #2 (permalink)  
Old 08-31-2006
Mumia W.
 
Posts: n/a
Default Re: directing to specific outgoing port

On 08/31/2006 12:51 AM, howfuchs@gmail.com wrote:
> I have a command line script which uses php curl to go out to the
> internet to retrieve some information. Now this works fine in most
> situations except when trying to get of a network where the network
> firewall is blocking a range of outgoing ports.I am told by the
> 'gatekeeper' that the script accesses different ports each time it
> tries to get out to the internet. My question is: Can I programatically
> direct my script to go out of a specific port that I know is open?
>
> Appreciate any help.
>
> Howard
>


I can't see anything in the WWW::Curl::easy documentation that
shows how to specify the source port. You probably could
perform the change at the O/S level.

<OT>
For Linux, you could get the kernel source and read
Documentation/networking/ip-sysctl.txt; look at the
ip_local_port_range option.

For Windows, ?


Reply With Quote
  #3 (permalink)  
Old 08-31-2006
Dennis de Wit
 
Posts: n/a
Default Re: directing to specific outgoing port

Mumia W. wrote:
> On 08/31/2006 12:51 AM, howfuchs@gmail.com wrote:
>> I have a command line script which uses php curl to go out to the
>> internet to retrieve some information. Now this works fine in most
>> situations except when trying to get of a network where the network
>> firewall is blocking a range of outgoing ports.I am told by the
>> 'gatekeeper' that the script accesses different ports each time it
>> tries to get out to the internet. My question is: Can I programatically
>> direct my script to go out of a specific port that I know is open?
>>
>> Appreciate any help.
>>
>> Howard
>>

>
> I can't see anything in the WWW::Curl::easy documentation that shows how
> to specify the source port. You probably could perform the change at the
> O/S level.
>
> <OT>
> For Linux, you could get the kernel source and read
> Documentation/networking/ip-sysctl.txt; look at the ip_local_port_range
> option.
>
> For Windows, ?
>
>

I don't think this can be done on Windows. I also don't think your
fireawll is blocking your outgoing ports, but looks at the port you're
trying to connect to, and blocks it then. It doesn't make sense to block
traffic coming from random ports, without knowing what protocol is used.

But... I'm not a firewall expert, so I might be wrong.

Dennis
Reply With Quote
  #4 (permalink)  
Old 08-31-2006
how
 
Posts: n/a
Default Re: directing to specific outgoing port

Dennis de Wit wrote:
> Mumia W. wrote:
> > On 08/31/2006 12:51 AM, howfuchs@gmail.com wrote:
> >> I have a command line script which uses php curl to go out to the
> >> internet to retrieve some information. Now this works fine in most
> >> situations except when trying to get of a network where the network
> >> firewall is blocking a range of outgoing ports.I am told by the
> >> 'gatekeeper' that the script accesses different ports each time it
> >> tries to get out to the internet. My question is: Can I programatically
> >> direct my script to go out of a specific port that I know is open?
> >>
> >> Appreciate any help.
> >>
> >> Howard
> >>

> >
> > I can't see anything in the WWW::Curl::easy documentation that shows how
> > to specify the source port. You probably could perform the change at the
> > O/S level.
> >
> > <OT>
> > For Linux, you could get the kernel source and read
> > Documentation/networking/ip-sysctl.txt; look at the ip_local_port_range
> > option.
> >
> > For Windows, ?
> >
> >

> I don't think this can be done on Windows. I also don't think your
> fireawll is blocking your outgoing ports, but looks at the port you're
> trying to connect to, and blocks it then. It doesn't make sense to block
> traffic coming from random ports, without knowing what protocol is used.
>
> But... I'm not a firewall expert, so I might be wrong.
>
> Dennis


On my home network where this works fine, as far as I can from my
firewall window, it seems to be going out of a tight range of ports.
Where the problem is occurring I am told it trying to go out of a wide
range of ports. They are prepared to open one specific port for me. I
know the orginating computer ( where the program will be run) is a
Windows machine, but I have no other information about the network.

Any further information, would be appreaciated.

Howard

Reply With Quote
  #5 (permalink)  
Old 08-31-2006
Dennis de Wit
 
Posts: n/a
Default Re: directing to specific outgoing port

how wrote:
> Dennis de Wit wrote:
>> Mumia W. wrote:
>>> On 08/31/2006 12:51 AM, howfuchs@gmail.com wrote:
>>>> I have a command line script which uses php curl to go out to the
>>>> internet to retrieve some information. Now this works fine in most
>>>> situations except when trying to get of a network where the network
>>>> firewall is blocking a range of outgoing ports.I am told by the
>>>> 'gatekeeper' that the script accesses different ports each time it
>>>> tries to get out to the internet. My question is: Can I programatically
>>>> direct my script to go out of a specific port that I know is open?
>>>>
>>>> Appreciate any help.
>>>>
>>>> Howard
>>>>
>>> I can't see anything in the WWW::Curl::easy documentation that shows how
>>> to specify the source port. You probably could perform the change at the
>>> O/S level.
>>>
>>> <OT>
>>> For Linux, you could get the kernel source and read
>>> Documentation/networking/ip-sysctl.txt; look at the ip_local_port_range
>>> option.
>>>
>>> For Windows, ?
>>>
>>>

>> I don't think this can be done on Windows. I also don't think your
>> fireawll is blocking your outgoing ports, but looks at the port you're
>> trying to connect to, and blocks it then. It doesn't make sense to block
>> traffic coming from random ports, without knowing what protocol is used.
>>
>> But... I'm not a firewall expert, so I might be wrong.
>>
>> Dennis

>
> On my home network where this works fine, as far as I can from my
> firewall window, it seems to be going out of a tight range of ports.
> Where the problem is occurring I am told it trying to go out of a wide
> range of ports. They are prepared to open one specific port for me. I
> know the orginating computer ( where the program will be run) is a
> Windows machine, but I have no other information about the network.
>
> Any further information, would be appreaciated.
>
> Howard
>


As outgoing ports are randomly chosen, it sounds weird to me that they
block those ports. It would mean that that machine cannot establish an
outgoing connection for _any_ protocol.

Besides, I don't think you can manipulate the outgoing port on windows.
(I also don't think you should want to)

what kind of access do you have to this specific windows machine? Can
you use telnet or a remote desktop of some kind?

Do you know whether or not this system is able to connect anything from
the inside? (can it start internet explorer and browse the web?)

Dennis
Reply With Quote
  #6 (permalink)  
Old 08-31-2006
how
 
Posts: n/a
Default Re: directing to specific outgoing port


Dennis de Wit wrote:
> how wrote:
> > Dennis de Wit wrote:
> >> Mumia W. wrote:
> >>> On 08/31/2006 12:51 AM, howfuchs@gmail.com wrote:
> >>>> I have a command line script which uses php curl to go out to the
> >>>> internet to retrieve some information. Now this works fine in most
> >>>> situations except when trying to get of a network where the network
> >>>> firewall is blocking a range of outgoing ports.I am told by the
> >>>> 'gatekeeper' that the script accesses different ports each time it
> >>>> tries to get out to the internet. My question is: Can I programatically
> >>>> direct my script to go out of a specific port that I know is open?
> >>>>
> >>>> Appreciate any help.
> >>>>
> >>>> Howard
> >>>>
> >>> I can't see anything in the WWW::Curl::easy documentation that shows how
> >>> to specify the source port. You probably could perform the change at the
> >>> O/S level.
> >>>
> >>> <OT>
> >>> For Linux, you could get the kernel source and read
> >>> Documentation/networking/ip-sysctl.txt; look at the ip_local_port_range
> >>> option.
> >>>
> >>> For Windows, ?
> >>>
> >>>
> >> I don't think this can be done on Windows. I also don't think your
> >> fireawll is blocking your outgoing ports, but looks at the port you're
> >> trying to connect to, and blocks it then. It doesn't make sense to block
> >> traffic coming from random ports, without knowing what protocol is used.
> >>
> >> But... I'm not a firewall expert, so I might be wrong.
> >>
> >> Dennis

> >
> > On my home network where this works fine, as far as I can from my
> > firewall window, it seems to be going out of a tight range of ports.
> > Where the problem is occurring I am told it trying to go out of a wide
> > range of ports. They are prepared to open one specific port for me. I
> > know the orginating computer ( where the program will be run) is a
> > Windows machine, but I have no other information about the network.
> >
> > Any further information, would be appreaciated.
> >
> > Howard
> >

>
> As outgoing ports are randomly chosen, it sounds weird to me that they
> block those ports. It would mean that that machine cannot establish an
> outgoing connection for _any_ protocol.
>
> Besides, I don't think you can manipulate the outgoing port on windows.
> (I also don't think you should want to)
>
> what kind of access do you have to this specific windows machine? Can
> you use telnet or a remote desktop of some kind?
>
> Do you know whether or not this system is able to connect anything from
> the inside? (can it start internet explorer and browse the web?)
>
> Dennis


Thanks for your help.

The inside machine can access the Internet via browser,email and we had
a gotomypc(sp) session ( from my offsite pc to the machine in
question). Can we conclude something from that?

Howard

Reply With Quote
  #7 (permalink)  
Old 08-31-2006
Dennis de Wit
 
Posts: n/a
Default Re: directing to specific outgoing port

how wrote:
>>> know the orginating computer ( where the program will be run) is a
>>> Windows machine, but I have no other information about the network.
>>>
>>> Any further information, would be appreaciated.
>>>
>>> Howard
>>>

>> As outgoing ports are randomly chosen, it sounds weird to me that they
>> block those ports. It would mean that that machine cannot establish an
>> outgoing connection for _any_ protocol.
>>
>> Besides, I don't think you can manipulate the outgoing port on windows.
>> (I also don't think you should want to)
>>
>> what kind of access do you have to this specific windows machine? Can
>> you use telnet or a remote desktop of some kind?
>>
>> Do you know whether or not this system is able to connect anything from
>> the inside? (can it start internet explorer and browse the web?)
>>
>> Dennis

>
> Thanks for your help.
>
> The inside machine can access the Internet via browser,email and we had
> a gotomypc(sp) session ( from my offsite pc to the machine in
> question). Can we conclude something from that?
>
> Howard
>


Yes.. We can. I think your system is not blocking outgoing traffic. If
Internet Explorer can connect to the internet, your php application
should be able to do so too. You can easily try this by executing the
following commands (make a php file and get it executed):

<?
echo file_get_contents('http://www.google.com');
?>

It should output the google website or an error of some kind.

Tell us wether or not this works.
Reply With Quote
  #8 (permalink)  
Old 08-31-2006
how
 
Posts: n/a
Default Re: directing to specific outgoing port


Dennis de Wit wrote:
> how wrote:
> >>> know the orginating computer ( where the program will be run) is a
> >>> Windows machine, but I have no other information about the network.
> >>>
> >>> Any further information, would be appreaciated.
> >>>
> >>> Howard
> >>>
> >> As outgoing ports are randomly chosen, it sounds weird to me that they
> >> block those ports. It would mean that that machine cannot establish an
> >> outgoing connection for _any_ protocol.
> >>
> >> Besides, I don't think you can manipulate the outgoing port on windows.
> >> (I also don't think you should want to)
> >>
> >> what kind of access do you have to this specific windows machine? Can
> >> you use telnet or a remote desktop of some kind?
> >>
> >> Do you know whether or not this system is able to connect anything from
> >> the inside? (can it start internet explorer and browse the web?)
> >>
> >> Dennis

> >
> > Thanks for your help.
> >
> > The inside machine can access the Internet via browser,email and we had
> > a gotomypc(sp) session ( from my offsite pc to the machine in
> > question). Can we conclude something from that?
> >
> > Howard
> >

>
> Yes.. We can. I think your system is not blocking outgoing traffic. If
> Internet Explorer can connect to the internet, your php application
> should be able to do so too. You can easily try this by executing the
> following commands (make a php file and get it executed):
>
> <?
> echo file_get_contents('http://www.google.com');
> ?>
>
> It should output the google website or an error of some kind.
>
> Tell us wether or not this works.


One thing I think I should add is the at the php file in question has
been processed by PriadoBlender which basically 'compiles' the php into
an exe, along with necessary supporting files. Suffice to say, I put
the above script through this process and ran it successfully on my
local machine. I have asked the person in charge of machine behind the
firewall to run it as well but have not heard back yet.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:03 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0