Proxy built with netcat not allowing http basic authentication -


i made simple proxy server using nc, here's one-liner:

mkfifo queueueue nc -l 8080 <queueueue | nc http://$jenkins_hostname 80 >queueueue 

it listens on port 8080 , forwards data connection our jenkins server. jenkins behind vpn, , machine running proxy on has vpn access.

on other machine (no vpn access), curl jenkins server, here's command initiate request through proxy:

http_proxy=10.1.10.10:8080 curl --user $jenkins_username:$jenkins_password http://$jenkins_hostname/api/json 

both client , proxy machine on same network, can ping , ssh between them, also, know client connecting proxy server, think failure arising when client trying authenticate, here's output when try curl:

$ http_proxy=10.1.10.10:8080 curl --user $jenkins_username:$jenkins_password http://$jenkins_hostname/api/json <!doctype html public "-//ietf//dtd html 2.0//en"> <html><head> <title>301 moved permanently</title> </head><body> <h1>moved permanently</h1> <p>the document has moved <a href="<some other url>">here</a>.</p> <hr> <address>apache server @ $jenkins_hostname port 80</address> </body></html> 

how can curl through proxy http basic authentication?

i use ssh instead of netcat.

just confusion out of way, referring node vpn access "server", , node without vpn access "client".

on server side should need install , have ssh server running (in test have openssh_5.9p1, openssl 0.9.8r 8 feb 2011).

on client side need following:

1) in /etc/hosts file add in address target url resolves on server. wasn't able curl run dns lookups through proxy, why necessary.

2) setup ssh keys between server , client. while not necessary, makes life easier.

3) run following ssh command have ssh act socks proxy:

user@host$ ssh -vnd 9999 <server> 

-v there can see going on ssh, -n tells ssh not execute remote command - useful simple port forwarding -d option forwards local requests server

4) should able run curl command have above, add in

---socks5 localhost:9999 

your full command this:

curl --user $user:$password --socks5 localhost:9999 http://$jenkins/api/json 

if can figure out how forward dns requests curl through ssh i'll update ticket.

edit: formatting, awful grammar.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -