Scientific LinuxでSquid

ちょっと用事があったので、プロキシサーバとして
Squidを入れて見ました。

簡単に行くだろ〜〜
とか思ってましたが、意外な所でハマった。。

OS・・・Scientific Linux6.1
Proxy・・・squid-3.1.10

公開はしていませんのであしからず

コマンドぽちっとな

# yum install squid


確認しましょ

# squid -v
Squid Cache: Version 3.1.10
configure options:  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--exec_prefix=/usr' '--libexecdir=/usr/lib64/squid' '--localstatedir=/var' '--datadir=/usr/share/squid' '--sysconfdir=/etc/squid' '--with-logdir=$(localstatedir)/log/squid' '--with-pidfile=$(localstatedir)/run/squid.pid' '--disable-dependency-tracking' '--enable-arp-acl' '--enable-follow-x-forwarded-for' '--enable-auth=basic,digest,ntlm,negotiate' '--enable-basic-auth-helpers=LDAP,MSNT,NCSA,PAM,SMB,YP,getpwnam,multi-domain-NTLM,SASL,DB,POP3,squid_radius_auth' '--enable-ntlm-auth-helpers=smb_lm,no_check,fakeauth' '--enable-digest-auth-helpers=password,ldap,eDirectory' '--enable-negotiate-auth-helpers=squid_kerb_auth' '--enable-external-acl-helpers=ip_user,ldap_group,session,unix_group,wbinfo_group' '--enable-cache-digests' '--enable-cachemgr-hostname=localhost' '--enable-delay-pools' '--enable-epoll' '--enable-icap-client' '--enable-ident-lookups' '--enable-linux-netfilter' '--enable-referer-log' '--enable-removal-policies=heap,lru' '--enable-snmp' '--enable-ssl' '--enable-storeio=aufs,diskd,ufs' '--enable-useragent-log' '--enable-wccpv2' '--enable-esi' '--with-aio' '--with-default-user=squid' '--with-filedescriptors=16384' '--with-dl' '--with-openssl' '--with-pthreads' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpie' 'LDFLAGS=-pie' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpie' --with-squid=/builddir/build/BUILD/squid-3.1.10

Squid Cache: Version 3.1.10」こいつが問題でした。。。

とりあえず、僕の環境抜粋(非推奨ww)

# vim /etc/squid/squid.conf

acl localnet src 192.168.0.0/16 #ネットワークが大きいのでw
http_access allow localnet #アクセス許可

cache_mem 64 MB
visible_hostname unknown
cache_access_log /dev/null
cache_log /dev/null
forwarded_for off
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all

で、何がハマったかというと

「header_access」ディレクティブ
が3.x系には無い。。。

巷の設定はheader_accessで書かれているのが多く
ちょっと調べました。

header_access
http://www.squid-cache.org/Doc/config/header_access/

request_header_access
http://www.squid-cache.org/Doc/config/request_header_access/

ちなみに、header_accessだと
起動時にエラーがでて、うまく隠蔽できない。
ERROR: Directive ‘header_access’ is obsolete.

# tail -f /var/log/squid/squid.out 
2012/01/29 21:08:29| ERROR: Directive 'header_access' is obsolete.
2012/01/29 21:08:29| ERROR: Directive 'header_access' is obsolete.
2012/01/29 21:08:29| ERROR: Directive 'header_access' is obsolete.

ということなので、
2.x系
header_access
3.x系
request_header_access

を使いましょうw

ポートはどうなってるかな

# netstat -lanput|grep squid
tcp 0 0 :::3128 :::* LISTEN 1616/(squid) 

IPv6だけリスンしてるように見えますが、
きちんとIPv4もリスンしてますw

[tegaki]変えないでくれヨォ。。。[/tegaki]

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

Enter code * Time limit is exhausted. Please reload CAPTCHA.

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください