DeleGate de Proxy!
-----------------------------------------------------------------------
著者 :鈴木 雄 <setter AT i-red DOT info>
-----------------------------------------------------------------------
DeleGateってなに?
                   @ @  
┬─┐─┬─┌   //\^^   ( - )  <URL:http://www.etl.go.jp/~ysato/>
├─  │ │ / 876m\  _<   >_ <URL:http://www.delegate.org/delegate/>
┴── ┴ ┴──────────────────────────────┘
佐藤豊@情報アーキテクチャ部.電子技術総合研究所.工業技術院.通商産業省.日本

さんが、開発している、Free! な、超多機能、プロキシサーバです。
プロキシなどには、Socksや、ProxyHttpdなどがありますが、私が知っているのは、
DeleGateだけです。(^^;

ぜひ、 
ftp://ftp.etl.go.jp/pub/DeleGate/Manual.txt
http://www.delegate.jp/delegate/tutorial/tutorial-jp.html
を、ご一読ください。

参考として(あくまでも)、マニュアルの和訳  もあります。

ここで使用しているDeleGateは、バージョン6.0.8です。

なお、この内容を利用したことによる、損害、障害などに関しては、
一切責任をもちませんので、御自身の責任においてご使用ください。

------------- 一般的な設定 --------------
1.LANユーザがブラウザから、DeleGate(8080)経由で、httpなどのサービスを使用する場合。

構成:
[Client] -> [DeleGate<Proxy:8080>] -> [Internet]

Client(Netscape 等)の設定
Proxy Server [<Proxy>]
Port         [8080]

DeleGateの起動シェルスクリプトファイル
file:delegated.sh
----------
#!/bin/sh
PATH="/usr/local/etc/:$PATH"
DELE="delegated"
$DELE -P8080 DGROOT="/home/delegate" +=/usr/local/etc/delegated.conf
#End of Script
----------

DeleGateの設定ファイル
file:delegated.conf
----------
#Config. Start
SERVER=http
RELIABLE=localhost,192.168.[0-255]
LOGFILE=''
PROTOLOG='${LOGDIR}/${PORT}/[date+%d].${PROTO}'
CRON='0 3 * * * -expire 5'
CONNECT=c,d:*:*
#REMITTABLE=http,https   # http/httpsしか使わせたくない場合。
#Config. End
----------

delegated.conf 変更後の再起動:
kill -HUP [delegated's PID]

---------------------------------------------------------------------------
2.多段httpプロキシ

構成
[Client] -> [DeleGate(http Specialist)<Proxy:10080> W/Cache]
-> [DeleGate(Generalist)<Master:8080> W/O-Cache] -> [Internet]

Client(Netscape 等)の設定
Proxy Server [<Proxy>]
Port         [10080]

DeleGate<Proxy:10080>の起動シェルスクリプトファイル
file:delegated-http.sh
----------
#!/bin/sh
PATH="/usr/local/etc/:$PATH"
DELE="delegated"
$DELE -P10080 DGROOT="/home/delegate" +=/usr/local/etc/delegated-http.conf
#End of Script
----------

DeleGateの設定ファイル
file:delegated-http.conf
----------
#Config. Start
SERVER=http
MASTER=Master:8080
RELIABLE=localhost,192.168.[0-255]
LOGFILE=''
PROTOLOG='${LOGDIR}/${PORT}/[date+%d].${PROTO}'
CRON='0 3 * * * -expire 5'
CONNECT=c,d,m:*:*
#Config. End
------------

DeleGate<Master:8080>の起動シェルスクリプト。
file:delegated-gene.sh
----------
#!/bin/sh
PATH="/usr/local/etc/:$PATH"
DELE="delegated"
$DELE -P8080 DGROOT="/home/delegate" +=/usr/local/etc/delegated-gene.conf
#End of Script
----------

DeleGateの設定ファイル
file:delegated-gene.conf
----------
#Config. Start
CACHE=no
RELIABLE=Proxy
LOGFILE=''
PROTOLOG='${LOGDIR}/${PORT}/[date+%d].${PROTO}'
CONNECT=d:*:*
#Config. End
----------
------------------------------------------------------------------------------
3.LANユーザが、DeleGate(8021)経由で、non-anonymous-ftpサービスを使用する場合。

構成:
[Client] -> [DeleGate<Proxy:8021>] -> [Internet]

Client(Root FTP 等)の設定
FireWall Host [<Proxy>]
FireWall Port [8021]
FireWall Type [USER ER@RH -> RP]

DeleGateの起動シェルスクリプトファイル
file:delegated-ftp.sh
----------
#!/bin/sh
PATH="/usr/local/etc/:$PATH"
DELE="delegated"
$DELE -P8021 DGROOT="/home/delegate" +=/usr/local/etc/delegated-ftp.conf
#End of Script
----------

DeleGateの設定ファイル
file:delegated-ftp.conf
----------
#Config. Start
SERVER=ftp
RELIABLE=localhost,192.168.[0-255]
LOGFILE=''
REACHABLE=*
PROTOLOG='${LOGDIR}/${PORT}/[date+%d].${PROTO}'
CONNECT=c,d:*:*
#Config. End
----------
-------------------------------------------------------------------
4.LANユーザが、DeleGate(8110)経由で、外部 popサービスを使用する場合。

構成:
[Client] -> [DeleGate<Proxy:8110>] -> [Internet]

Client(Netscape Messenger 等)の設定
Host          [<Proxy:8110>]
User          [User%pop.hoge.com]

DeleGateの起動シェルスクリプトファイル
file:delegated-pop.sh
----------
#!/bin/sh
PATH="/usr/local/etc/:$PATH"
DELE="delegated"
$DELE -P8110 DGROOT="/home/delegate" +=/usr/local/etc/delegated-pop.conf
#End of Script
----------

DeleGateの設定ファイル
file:delegated-pop.conf
----------
#Config. Start
SERVER=pop
RELIABLE=localhost,192.168.[0-255]
REACHABLE=*
LOGFILE=''
PROTOLOG='${LOGDIR}/${PORT}/[date+%d].${PROTO}'
CONNECT=d:*:*
#Config. End
----------

-------------------------------------------------------------------
5.内部WWWサーバ Apache を hoge.hoge.com として外に見せたい場合

構成
[Internet] -> [DeleGete<hoge.hoge.com:80> -> [http Server<Apache:80>]

hoge.hoge.com上で動かすスクリプト。
DeleGateの起動シェルスクリプトファイル
file:delegated-rev-http.sh
----------
#!/bin/sh
PATH="/usr/local/etc/:$PATH"
DELE="delegated"
$DELE -P80 DGROOT="/home/delegate" +=/usr/local/etc/delegated-rev-http.conf
#End of Script
----------

DeleGateの設定ファイル
file:delegated-rev-http.conf
----------
#Config. Start
SERVER=http://Apache
RELIABLE=*
REACHABLE=Apache
REMITTABLE=http/80
DELEGATE=hoge.hoge.com
LOGFILE=''
PROTOLOG='${LOGDIR}/${PORT}/[date+%d].${PROTO}'
CONNECT=d:*:*
#Config. End
----------
------------------------------------------------------------------
おまけ

・DeleGateのデフォルトエラーメッセージやアイコンを、カスタマイズしたい。

元のデータをコピー
cp -r delegate6.0.8/src/builtin /usr/local/etc

delegated.conf に以下の行を追加

MOUNT="/-/builtin/* /usr/local/etc/builtin/*"
REMITTABLE="+,file"

Forbidden メッセージを編集
/usr/local/etc/builtin/mssgs/403-forbidden.dhtml
を適当なものに書き換える。

・DeleGate にサイトアクセス制限をさせたい。
delegated.confに以下のような行を追加

REACHABLE=!*xxx*.com
REACHABLE=!www.porn.com