LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   https over ssh problem (https://www.linuxquestions.org/questions/linux-networking-3/https-over-ssh-problem-943903/)

lekhtuz 05-08-2012 10:34 AM

https over ssh problem
 
Hello,

I will highly appreciate if somebody could help me sort out the following issue:

The following command works normally when I run it on host1:

curl -k -d param=value https://webhost/path (-k is necessary because the webhost does not have correct certificate installed)

I receive whatever web page is returned.

If I do the following while working on host2:

ssh -f -L 14141:webhost:443 host1 -N
curl -k -d param=value https://host1:14141/path

the result is always 301 Moved Permanently.

In all other respects, ssh between host1 and host2 works flawlessly.

The desired result is that webhost thinks that http request comes from host1 which IP is whitelisted as opposed to host2. Is there a simpler way to achieve it?

Thank you for your help.
Dmitry

acid_kewpie 05-09-2012 03:09 AM

you probably have issues with the Host header, as it will be asking the web server for the "host1" website instead of "webhost" So you could add '-H "Host: webhost"' to the curl command OR use putty for a SOCKS proxy / Dynamic forward, not a static, using "-D 1234" on ssh and "--sock5-hostname localhost:1234" on the curl command and using the original full hostname as you currently do from host1.

lekhtuz 05-09-2012 07:39 AM

Chris,

Thank you for your reply. I will try it later today.

Also, the second curl command is actually localhost:14141, not host1:14141.

Dmitry

lekhtuz 05-09-2012 12:20 PM

Unfortunately -H did not help. I provided -H "Host: <whitelisted IP address>". I don't think it is that easy to fool the web server.


All times are GMT -5. The time now is 09:24 PM.