Kamis, 04 Februari 2010

Proxy Server with squid in RedHat

To use the services of Squid, you first need to install certain packages and utilities, and then needs to perform the following tasks:
1. Identify the technology for implementing a proxy server.
2. Implement the proxy server.
3. Restart the proxy server

1. Identify the technology for implementing a proxy server in RZTV.
In Linux, a proxy server can be implemented using the Squid proxy server. Squid can be used for caching, connecting sharing, and restrict the restricting the Web sites accessed by users.

2. Implement the proxy server.
To set up the squid proxy server, perform with open the /etc/squid/squid.conf file in editor.
# vi /etc/squid/squid.conf
http_port 192.168.3.130:8080
cache_peer 10.14.202.2 parent 8080 0 no-query default

icp_port 0
cache_mem 8 MB
cache_dir ufs /var/spool/squid 100 16 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
cache_mgr zareuli_rz@yahoo.co.id
acl all src 0.0.0.0/0.0.0.0
# Blok forbidden ip
acl forbidden_ip src 192.168.3.65-192.168.3.94
http_access deny forbidden_ip

# Blok site and porno word
acl asusila_domain dstdomain "/etc/squid/asusila_domain.txt"
acl kata_kotor url_regex -i "/etc/squid/kata_kotor.txt"
deny_info PESAN kata_kotor
deny_info PESAN asusila_domain
http_access deny asusila_domain
http_access deny kata_kotor

# download limited
acl working_time time MTWHF 09:00-17:00
acl movie_file urlpath_regex "/etc/squid/moviefile.txt"
http_access deny working_time movie_file

http_access allow all

# Bandwidth limiter
acl server src 192.168.3.130/27
acl staf src 192.168.3.34-192.168.3.62/27 192.168.3.65-192.168.3.94/27 192.168.3.98-192.168.3.126/27

delay_pools 2

# To pool no 1 and class no 1
delay_class 1 1
delay_parameters 1 -1/-1
delay_access 1 allow server
delay_access 1 deny all

# To pool no 2 and class no 2
delay_class 2 2
delay_parameters 2 5000000/5000000 20000/2000000
delay_access 2 allow staf
delay_access 2 deny all

never_direct allow all
visible_hostname rztv.com
cache_effective_group squid
cache_effective_user squid

Note:
1. http_port: HTTP port is used by the Squid.
2. icp_port: Port that is used by Squid to conduct cooperation with other Squid.
3. cache_mem: Memory physical ideal that is used by Squid to handle objects in-Transit (object is in a transition period between the time cache object download until the object was delivered to the client).
4. cache_dir ufs /var/spool/squid: Cache_dir option is determine the storage system such as that which will be used (UFS), the name of the directory where to store cache (/var/spool/squid).
5. acl: rule list that the state of privileges, to prevent people who do not have access rights to use the cache infrastructure.
6. http_access: HTTP Access parameter is to allow or deny access from the ACL, the ACL has been defined.
7. delay_pools: This option is for specifying the exact amount of pool that is used to limit the amount of bandwidth from the ACL.
8. delay_class: This option specifies the group from each pool that has been defined on the delay-pools option.
9. delay_parameters: This formula specifies the bandwidth that will be obtained by the ACL that will enter delay_pool.
10. delay_access: This defines who ACL that will be entered into a pool for the "slowing" bandwidth.

3. Restart the proxy server
To restart the Squid proxy service, enter the following command at the shell prompt:
# service squid restart

1 komentar: