LoginSignup
0
0

More than 5 years have passed since last update.

Tinyproxyとcorkscrew

Last updated at Posted at 2015-06-18

ポート443以外でhttp CONNECTが通じないファイアウォールの後ろにいると、サバーにsshできない状態になります。corkscrewというソフトを使ってhttp proxyでsshできるけど、http proxyが必要です。下記のスクリプトでtinyproxyをすぐインストールできます。

install_tinyproxy.rb
$ brew update && brew upgrade 
$ brew install tinyproxy
$# 会社のファイアウォールは大体httpsプロトコールの為にポート443でhttp CONNECTを許可するから、リモートサバーにおいてポート443でtinyproxyを動作しよう。
$# Most firewalls allow http CONNECT over port 443 to allow https, so run tinyproxy on 443
$ cat > /usr/local/Cellar/tinyproxy/1.8.3/etc/tinyproxy.conf <<EOF
User nobody
Group nobody
Port 443
Timeout 600
DefaultErrorFile "/usr/local/Cellar/tinyproxy/1.8.3/share/tinyproxy/default.html"
StatFile "/usr/local/Cellar/tinyproxy/1.8.3/share/tinyproxy/stats.html"
LogLevel Info
MaxClients 5
MinSpareServers 1
MaxSpareServers 2
StartServers 1
MaxRequestsPerChild 0

Allow 127.0.0.1
Allow $specific_ip_of_client
Allow 192.168.1.0/24
ConnectPort 22
ConnectPort 23
ConnectPort 443
ConnectPort 563
EOF
$ mkdir -p /usr/local/Cellar/tinyproxy/1.8.3/var/log/tinyproxy/ /usr/local/Cellar/tinyproxy/1.8.3/var/run/tinyproxy/
$ chown -R nobody:nobody /usr/local/Cellar/tinyproxy/1.8.3/var/log/ /usr/local/Cellar/tinyproxy/1.8.3/var/run/

$ #add app to allowed apps in firewall to allow binding socket
$ /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/local/Cellar/tinyproxy/1.8.3/sbin/tinyproxy
$ /usr/local/Cellar/tinyproxy/1.8.3/sbin/tinyproxy
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0