SSH를 통해 HTTP 프록시 제공

1 개요[ | ]

SSH를 통해 HTTP 프록시 제공

2 로컬 프록시 사용[ | ]

            +-----------+             +---------+
            |     A     +-----SSH----->    B    |
            | +-------+ |             |         |
 Internet <---+ PROXY <---SSH Tunnel--+         |
            | +-------+ |             |         |
            +-----------+             +---------+
root@ServerA:~# docker run -d --name squid -p 3128:3128 ubuntu/squid:4.13-21.04_edge
42638a3371a5e58f8508103148e3ac58d16a0ddd1425ed8971d1b4fa30318f02
root@ServerA:~# docker ps
CONTAINER ID   IMAGE                          COMMAND                  CREATED          STATUS          PORTS                                       NAMES
42638a3371a5   ubuntu/squid:4.13-21.04_edge   "entrypoint.sh -f /e…"   5 seconds ago    Up 4 seconds    0.0.0.0:3128->3128/tcp, :::3128->3128/tcp   squid
root@ServerA:~# ssh -R 3128:127.0.0.1:3128 ServerB
...
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Oct 27 20:02:17 2021 from 10.178.0.56
root@ServerB:~#
root@ServerB:~# http_proxy=http://127.0.0.1:3128 curl http://google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
root@ServerA:~# docker logs squid
1635332677.599      0 172.18.0.1 TCP_MEM_HIT/301 672 GET http://google.com/ - HIER_NONE/- text/html

3 별도 프록시 사용[ | ]

                          +-------+         +-------+
            11.22.33.44   |   A   +---SSH--->   B   |
             +-------+    |       |         |       |
 Internet <--+ PROXY <---------SSH Tunnel---+       |
             +-------+    |       |         |       |
                          +-------+         +-------+
root@ServerA:~# ssh -R :3128:11.22.33.44:8080 ServerB
...
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Oct 27 20:02:17 2021 from 10.178.0.56
root@ServerB:~#
root@ServerB:~# http_proxy=http://127.0.0.1:3128 curl http://google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.

4 같이 보기[ | ]

5 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}