cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Using curl to setup TCP connection through squid proxy

From: PenguinWhispererThe . <th3penguinwhisperer_at_gmail.com>
Date: Wed, 11 Jun 2014 11:35:47 +0200

Thanks for your quick answer! Really appreciated!

2014-06-11 11:22 GMT+02:00 Daniel Stenberg <daniel_at_haxx.se>:

> On Wed, 11 Jun 2014, PenguinWhispererThe . wrote:
>
> I'm setting up a nagios machine and it's behind a proxy.
>> For this machine the connect method is allowed to all ports.
>>
>> The idea is to use curl with the proxytunnel option and open a TCP
>> connection like that to other protocols: SMTP, IMAP, ... I would be happy
>> if I already could do a TCP check (so the proxy being able to connect). Is
>> this possible using curl?
>>
>
> curl is not a generic check-your-TCP tool. It does transfers using
> internet protocols, most of them using TCP.

I'm aware of that. I want to actually talk the protocol of the destination
server. It's more sort of a workaround.

>
>> curl -x x.x.x.x:3128 --proxytunnel target.com:25 -v
>>
>
> This command line tells curl to tunnel HTTP through the proxy to the host
> on port 25 and do a GET /.
>
>
> However I see the proxy sending HTTP requests (or that is what it looks
>> like).
>>
>
> Yes, as that's actually what you ask for there.
>
>
> When I use SMTP as the protocol (so in the proxytunnel part): curl: (1)
>> Protocol smtp not supported or disabled in libcurl
>>
>
> So your libcurl doesn't suport SMTP...

The error message on that is very clear ;) The man page mentions SMTP so I
would have to recompile from source on my RHEL system.
But as I mentioned, I want to use it more generic.

>
>
> Is there a generic way where curl only sets up the connection through the
>> proxy and the protocol is handled by me?
>>
>
> That would possibly be telnet:// but I'm not sure we support that properly
> tunnelled through a proxy.
>
>
Just quickly tried this and it seems like I'm just talking to the proxy
host then.

>
> Are there alternatives to accomplish this?
>>
>
> I don't know. libcurl has a CONNECT_ONLY feature that probably could be
> used for this, but it isn't exposed/used by the command line tool.
>

Good you mention it. IIRC it is exposed in the curl extension of php so I
could have a look there.

> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-users
> FAQ: http://curl.haxx.se/docs/faq.html
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-06-11