ubuntuusers.de

HTTP Forwarding over ssh

Status: Gelöst | Ubuntu-Version: Ubuntu 16.04 (Xenial Xerus)
Antworten |

ency79

(Themenstarter)

Anmeldungsdatum:
23. August 2019

Beiträge: 17

curl -v -k 8.8.8.8

* Rebuilt URL to: 8.8.8.8/
*   Trying 10.4.103.143...
* Connected to proxy.firma.com (11.5.100.143) port 8080 (#0)
* Proxy auth using Basic with user 'user01'
> GET http://8.8.8.8/ HTTP/1.1
> Host: 8.8.8.8
> Proxy-Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxx
> User-Agent: curl/7.47.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>


curl -v -k www.rubygems.org
* Rebuilt URL to: www.rubygems.org/
*   Trying 10.4.103.143...
* Connected to proxy.firma.com (11.5.100.143) port 8080 (#0)
* Proxy auth using Basic with user 'user01'
> GET http://www.rubygems.org/ HTTP/1.1
> Host: www.rubygems.org
> Proxy-Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxx
> User-Agent: curl/7.47.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 301 Moved Permanently
< Content-Type: text/html
< Location: https://www.rubygems.org/
< X-Backend: F_Rails 54.186.104.15:443
< Content-Length: 0
< Accept-Ranges: bytes
< Date: Mon, 26 Aug 2019 11:03:14 GMT
< Via: 1.1 varnish
< Age: 0
< X-Served-By: cache-fra19139-FRA
< X-Cache: MISS
< X-Cache-Hits: 0
< X-Timer: S1566817393.319076,VS0,VE685
< Vary: Fastly-SSL
< Server: RubyGems.org
< Proxy-Connection: Keep-Alive
< Connection: Keep-Alive
< X-BlueCoat-Authorization: 9a3f232851038ea3=2C5C662D00000102HGeQBTSu+JRNjKg+CreDQX1B9k6OCAAAAgEAADgyIACEAwAAAAAAACdbuQAAAAAA
<
* Connection #0 to host proxy.firma.com left intact



wget https://google.com
--2019-08-26 11:04:40--  https://google.com/
Resolving rbins.bosch.com (tuzot.firma.com)... 11.25.49.11
Connecting to rbins.bosch.com (tuzot.firma.com)|11.25.49.11|:80... connected.
Proxy tunneling failed: Bad RequestUnable to establish SSL connection.



Bearbeitet von sebix:

Bitte verwende in Zukunft Codeblöcke, um die Übersicht im Forum zu verbessern!

Bearbeitet von misterunknown:

Authentifizierung anonymisiert

ency79

(Themenstarter)

Anmeldungsdatum:
23. August 2019

Beiträge: 17

Nachdem ich die file /etc/wgetrc

editiert habe ging auch wget

root@vm: wget rubygems.org
URL transformed to HTTPS due to an HSTS policy
--2019-08-26 11:10:53--  https://rubygems.org/
Resolving proxy.firma.com (proxy.firma.com)... 11.5.100.143
Connecting to proxy.firma.comm (proxy.firma.com)|11.5.100.143|:8080... connected.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html.4’

index.html.4                                    [ <=>                                                                                       ]  11.06K  --.-KB/s    in 0s

2019-08-26 11:10:53 (116 MB/s) - ‘index.html.4’ saved [11322]

Bearbeitet von sebix:

Bitte verwende in Zukunft Codeblöcke, um die Übersicht im Forum zu verbessern!

sebix Team-Icon

Ehemalige

Anmeldungsdatum:
14. April 2009

Beiträge: 5582

Dann siehe manpage von ssh (wie oft habe ich darauf schon verwiesen?):

     -R [bind_address:]port:host:hostport
     -R [bind_address:]port:local_socket
     -R remote_socket:host:hostport
     -R remote_socket:local_socket
     -R [bind_address:]port
             Specifies that connections to the given TCP port or Unix socket on the remote (server) host are to be forwarded to the local side.

             This works by allocating a socket to listen to either a TCP port or to a Unix socket on the remote side.  Whenever a connection is made to this port or Unix socket, the connection is forwarded over the secure channel, and a connection is made from the local machine to either an explicit destination specified by host port
             hostport, or local_socket, or, if no explicit destination was specified, ssh will act as a SOCKS 4/5 proxy and forward connections to the destinations requested by the remote SOCKS client.

             Port forwardings can also be specified in the configuration file.  Privileged ports can be forwarded only when logging in as root on the remote machine.  IPv6 addresses can be specified by enclosing the address in square brackets.

             By default, TCP listening sockets on the server will be bound to the loopback interface only.  This may be overridden by specifying a bind_address.  An empty bind_address, or the address ‘*’, indicates that the remote socket should listen on all interfaces.  Specifying a remote bind_address will only succeed if the server's
             GatewayPorts option is enabled (see sshd_config(5)).

             If the port argument is ‘0’, the listen port will be dynamically allocated on the server and reported to the client at run time.  When used together with -O forward the allocated port will be printed to the standard output.

Ungetestet:

-R localhost:8080:proxy.firma.com:8080
-R localhost:8081:special-proxy.firma.com:8080

Damit sollten alle Verbindungen auf Port 8080 in der VM an den bestehenden Proxy weitergeleitet werden. Wie das in Putty genau geht, weiss ich nicht, aber es wird wohl intuitiv sein.

Und dann in der VM die Umgebungsvariablen http_proxy und https_proxy nutzen:

export http_proxy=http://localhost:8080
export https_proxy=http://localhost:8081

ency79

(Themenstarter)

Anmeldungsdatum:
23. August 2019

Beiträge: 17

alles geklappt:-)

viiiielen lieben Dank!!!

sebix Team-Icon

Ehemalige

Anmeldungsdatum:
14. April 2009

Beiträge: 5582

ency79 schrieb:

alles geklappt:-)

viiiielen lieben Dank!!!

Dann bitte das Thema als geloest markieren. Danke

Antworten |