본문 바로가기

OS/LINUX, UNIX

Linux VM을 프록시 서버로 활용하기 (Squid 사용)

설치

yum install squid -y
dnf install  squid -y

 

활성화

systemctl enable --now squid

 

방화벽 허용

sudo firewall-cmd --add-port=3128/tcp --permanent
sudo firewall-cmd --reload

 


 

squid 기본 설정 (모든 host 접속 허용)

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

 

기본적으로 모든 host 접속 차단 + 특정 host만 접속 허용

(특정 host만 접속 허용)
acl github_api dstdomain api.github.com
acl github_main dstdomain github.com
http_access allow github_api
http_access allow github_main

(그 외 모두 차단)
http_access deny all

 


 

로그 확인 (어떤 host에 접속을 시도하는지 이력 확인 가능)

tail -f /var/log/squid/access.log