티스토리 뷰
스퀴드의 특징들
RPM 버젼보다는 바이러니로 컴파일 하는것을 추천 (자기가 쓰고 싶은 기능을 추가가능함)
가능하면 높은사양으로 마추는것이 성능향상에 좋음
1. 메모리 (RAM)는 많을수록 좋음 (퍼포먼스 향상)
2. 많은 보조기억장치 (HDD)는 클수록 더 많은 자원이 할당되며 캐쉬 적중률도 높아지게 됨
3. 빠른 HDD 인터페이스와 CPU (부가사항)
메모리의 양
디스크 처리 양
프로세스의 성능
squid 대표적 기능
Web caching
squid 로 서비스 불가능한 프로토콜들... (버젼 2.5대)
instant messaging
Internet Relay chat (IRC)
스퀴드 설치전 점검해볼 사항
file descriptor
[root@localhost ~]# ulimit -n |
- 아마 한 shell 유저나 프로세스가 열수있는 최대 파일의 갯수 일거다.
아래와 같이 한다 아마 65535가 최대치일듯? (적당하게 해주던가? 알아서 한다)
[일시적인 방법] : 리부팅하면 원복됨 [root@localhost ~]# ulimit -n 65535 [root@localhost ~]# ulimit -Sn
[root@localhost ~]# ulimit -Hn |
리부팅시에도 유지하게끔 하자
vim /etc/security/limits.conf 열어서 아래열 추가 * - nofile 65535 |
리부팅하고 난뒤
[root@localhost bin]# /usr/local/squid/bin/squidclient -p80 mgr:info | grep 'file descri' |
정상적(?) 으로 된듯 하다? ㅋ
[root@localhost tools]# ulimit
unlimited
Ephemeral Port Range 수정
- 이건 squid 서버가 원본서버와의 만들수 있는 소켓 커넥션수 의 옵션조정인듯 함 (프록시에서 나가는 TCP/IP 스택? 범위?)
보통의 디폴트 값은 아래인데 약 3만개정도 인듯함.
[root@localhost ~]# sysctl -a | grep local
net.ipv4.ip_local_port_range = 32768 61000
[root@localhost ~]# cat /proc/sys/net/ipv4/ip_local_port_range
32768 61000
1024 부터 65000 까지하면 약 6만개정도 쓸수 있는듯?
net.ipv4.ip_local_port_range = 1024 65000
ulimit -a 명령어를 하면 아래 정보 확인 가능
core file size (blocks, -c) 0 |
스퀴드 다운받기
wget http://www.squid-cache.org/Versions/v3/3.1/squid-3.1.4.tar.gz
rpm squid 삭제
rpm -e --force squid
squid 그룹 및 사용자 추가
groupadd -g 3128 squid |
squid 로그 및 캐쉬 디렉토리 생성
mkdir /home/squid/logs |
컴파일 옵션
./configure --prefix=/usr/local/squid --sysconfdir=/etc/squid --localstatedir=/home/squid --disable-ident --disable-ident-lookups --enable-x-accelerator-vary --enable-follow-x-forwarded-for --enable-useragent-log --enable-referer-log --enable-ssl --with-openssl{=/usr/lib/openssl/engines} --enable-linux-netfilter --enable-ipf-transparent --enable-storeio=ufs,aufs --with-maxfd=65536
./configure --prefix=/usr/local/squid --sysconfdir=/etc/squid --localstatedir=/home/squid --disable-ident --disable-ident-lookups --enable-x-accelerator-vary --enable-follow-x-forwarded-for --enable-useragent-log --enable-referer-log --enable-ssl --with-openssl --enable-storeio=ufs,aufs --with-maxfd=65536
make
make install
chmod 755 /etc/init.d/squid |
squid 권한 설정
chown root:root /usr/local/squid cd /usr/local/squid/bin chown squid:squid /usr/local/squid/logs
groupadd nogroup |
squid 컴파일 옵션
--enable-err-language=Korean (squid error 시 한글메세지 출력) |
스퀴드 완전 삭제
/etc/init.d/squid stop |
/etc/squid/squid.conf : squid 설정파일
vim /etc/hosts
- 고객 IP 고객도메인 명시해준다.
co.kr 및 com 주 도메인과 서브도메인들은 같은 그룹에 묶을것
- 묶어서 사용할것 뒤죽박죽 되면 찾기도 힘들뿐 아니라
vim /etc/crontab
01 * * * * root cat /dev/null > /home/squid/logs/access.log
01 * * * * root cat /dev/null > /home/squid/logs/store.log
/etc/cron.20m/squid_restart.sh
sleep 5
/etc/init.d/squid start
vim /etc/squid.conf
http_port 80 transparent or http_port 80 accel vhost |
vim /etc/hosts
xxx.xxx.xxx.42 xx.co.kr (도메인 명시)
# 쿼리 리스트(단어)를 캐쉬서버에 저장하지 않는다.
acl QUERY urlpath_regex cgi-bin \? php php3 htm html jsp js css asp aspx swf jpg gif
vim /etc/sysctl - 아래열 추가
net.netfilter.nf_conntrack_tcp_timeout_established = 3600 |
- sysctl -p (적용)
[보안설정]
acl localhost src 127.0.0.1/255.255.255.255 http_access allow src_localhost http_access deny !to_localhost |
- 허용된 아이피를 제외하고는 프록시를 타고 나갈수 없음
보안설정
acl BLOCK_URI urlpath_regex -i \.exe \.\.\/ \.\.\. \.\. \.ida \.IDA \.cnf \.dll passwd boot \.exe cmd \.\./ default\.ida XXXXXX \/bin\/sh
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl src_localhost src 127.0.0.0/24 211.110.10.101 : 소스아이피가 10.101만 허용
acl to_localhost dst 127.0.0.0/24 116.125.30.202 : 목적지 아이피가 30.202를 제외하곤 거절
acl to_localhost dst 127.0.0.0/8
http_access deny !src_localhost # src_localhost 에 명시된 소스 아이피가 아니면 거절하겠다
#http_access deny !to_localhost # dst_localhost 에 명시된 목적지 아이피가 아니면 거절하겠다
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 1025-65535 # unregistered ports
acl CONNECT method CONNECT
error)
error) squid.conf 에 cache_effective_user squid 구문 추가해준다...
/var/log/message
May 20 09:28:46 localhost (squid): Cannot open '/home/squid/logs/access.log' for writing.#012#011The parent directory must be writeable by the#012#011user 'nobody', which is the cache_effective_user#012#011set in squid.conf.
/logs/squid.out
FATAL: Cannot open '/home/squid/logs/access.log' for writing.
The parent directory must be writeable by the
user 'nobody', which is the cache_effective_user
set in squid.conf.
localhost squid: Could not determine fully qualified hostname. Please set 'visible_hostname'
Squid Cache (Version 3.1.3): Terminated abnormally.
CPU Usage: 0.008 seconds = 0.004 user + 0.004 sys
Maximum Resident Size: 0 KB
Page faults with physical i/o: 0
2010/05/20 15:26:56| WARNING: -D command-line option is obsolete.
FATAL: Could not determine fully qualified hostname. Please set 'visible_hostname'
'LAYER 4 & 7' 카테고리의 다른 글
squid 3.X 설치 예제 (0) | 2015.06.12 |
---|---|
squid 프로세스 재시작 스크립트 (0) | 2015.06.12 |
squid caching 이용하지 않기 only squid (0) | 2015.06.11 |
Proxy 거쳐서 들어오는 IP들 실제 아이피 표기 (Apache Access Log 부분) (0) | 2015.06.11 |
squid 이미지 캐쉬 conf 설정 (0) | 2015.06.11 |
- Total
- Today
- Yesterday
- Apache
- virtualbox
- centOS7
- iptables
- HAProxy
- MySQL
- 베이어다이나믹
- mod_security
- softether
- php
- kvm
- OpenVPN
- gitlab
- NGINX
- galera
- ntp
- pptp
- L2TP
- glusterfs
- centos8
- mariadb
- ssh
- IPSEC
- 리눅스
- GeoIP
- SSL
- cURL
- yum
- WAF
- 인증서
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |