Ubuntu 22.04 LTSにSquid をインストールする方法

環境
osバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"

Squidのインストール手順
1.Squid をインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt -y install squid
# apt -y install squid
# apt -y install squid

2.フォワードプロキシとして設定します
内部用 ACL を定義します
1341行目
acl my_localnet src 192.168.71.0/24

1541行目 コメントを解除します
http_access deny to_localhost

1522行目 コメント化して自身の内部用 ACL を追記
#http_access allow localnet
#http_access allow localhost
http_access allow my_localnet

5921行目 設定内容を追記します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all
request_header_access Referer deny all request_header_access X-Forwarded-For deny all request_header_access Via deny all request_header_access Cache-Control deny all
request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all

8649行目 設定内容を追記します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# forwarded_for on
forwarded_for off
# forwarded_for on forwarded_for off
# forwarded_for on
forwarded_for off

3.squidを再起動します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl restart squid
# systemctl restart squid
# systemctl restart squid

 

Ubuntu 22.04

Posted by arkgame