AlmaLinux9.2 Proxy サーバーSquid をインストールする手順

環境
# cat/etc/redhat-release
AlmaLinux release 9.2 (Turquoise Kodkod)

操作方法
1.Squid をインストールします。

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

2.ローカルネットワーク内専用で、外部ネットワークからは Proxy サーバーを利用できないように設定します。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/squid/squid.conf
# vi /etc/squid/squid.conf
# vi /etc/squid/squid.conf

1).16行目 : 自身のネットワーク定義を追記する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# プロキシサーバーへのアクセスを許可する範囲
acl ark_localnet src 10.1.0.0/24
# プロキシサーバーへのアクセスを許可する範囲 acl ark_localnet src 10.1.0.0/24
# プロキシサーバーへのアクセスを許可する範囲
acl ark_localnet src 10.1.0.0/24

2).45行目 : コメントを解除する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
http_access deny to_localhost
http_access deny to_localhost
http_access deny to_localhost

3).54~55行目 : コメント化して自身が定義した ACL を追記する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#http_access allow localnet
#http_access allow localhost
http_access allow ark_localnet
#http_access allow localnet #http_access allow localhost http_access allow ark_localnet
#http_access allow localnet
#http_access allow localhost
http_access allow ark_localnet

4).最終行に以下のコードを追記する

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

クライアント情報を表示しない

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

3.squidを起動する

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

4.Firewalld を有効にしている場合は、Proxy サービスの許可を設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# firewall-cmd --add-service=squid
success
# firewall-cmd --runtime-to-permanent
success
# firewall-cmd --add-service=squid success # firewall-cmd --runtime-to-permanent success
# firewall-cmd --add-service=squid
success
# firewall-cmd --runtime-to-permanent
success

 

AlmaLinux 9

Posted by arkgame