Pages

Labels

Selasa, 22 Juni 2010

Membuat Proxy di Ubuntu Server 8.04

Untuk memulai instalasi, pertama kita install squid proxy terlebih dahulu dengan cara :

$ sudo apt-get install squid

lalu, setelah selesai menginstall. Edit file squid.conf dengan konfigurasi squid yang di butuhkan dengan cara berikut :

$ sudo nano /etc/squid/squid.conf

dan misalnya saya menggunakan konfigurasi squid seperti berikut :

http_port 8080
icp_port 3130

hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY

cache_mem 32 MB
cache_swap_low 98
cache_swap_high 99

maximum_object_size 1 MB
minimum_object_size 5 KB
maximum_object_size_in_memory 0 KB

cache_mgr cahyo@pce0804.net
visible_hostname proxy.pce0804.net

cache_replacement_policy lru
memory_replacement_policy lru

cache_dir ufs /cache 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

log_ip_on_direct on
debug_options ALL,1

refresh_pattern \.gif$ 10080 90% 43200 reload-into-ims
refresh_pattern \.jpg$ 10080 90% 43200 reload-into-ims
refresh_pattern \.bom\.gov\.au 30 20% 120 reload-into-ims
refresh_pattern \.html$ 480 50% 22160 reload-into-ims
refresh_pattern \.htm$ 480 50% 22160 reload-into-ims
refresh_pattern \.class$ 10080 90% 43200 reload-into-ims
refresh_pattern \.zip$ 10080 90% 43200 reload-into-ims
refresh_pattern \.jpeg$ 10080 90% 43200 reload-into-ims

refresh_pattern ^http://*.yahoo.*/.* 720 100% 4320
refresh_pattern ^http://*.yimg.*/.* 720 100% 4320
refresh_pattern ^http://*.gmail.*/.* 720 100% 4320
refresh_pattern ^http://*.google.*/.* 720 100% 4320
refresh_pattern ^http://*korea.*/.* 720 100% 4320
refresh_pattern ^http://*.akamai.*/.* 720 100% 4320
refresh_pattern ^http://*.windowsmedia.*/.* 720 100% 4320
refresh_pattern ^http://*.googlesyndication.*/.* 720 100% 4320
refresh_pattern ^http://*.plasa.*/.* 720 100% 4320
refresh_pattern ^http://*.telkom.*/.* 720 100% 4320
refresh_pattern ^http://*.detik.*/.* 720 100% 4320
refresh_pattern ^http://*.kompas.*/.* 720 100% 4320
refresh_pattern ^http://*.okezone.*/.* 720 100% 4320
refresh_pattern ^ftp:// 1440 20% 10080
refresh_pattern ^gopher:// 1440 0% 1440
refresh_pattern . 0 20% 4320


#acl address
acl all src 0/0
acl localhost src 127.0.0.1/255.255.255.255
acl tes src 10.11.12.0/255.255.255.128

#acl port
acl SSL_ports port 443 #ssl
acl Safe_ports port 80 #http
acl Safe_ports port 25 #pop3
acl Safe_ports port 110 #IMAP
acl Safe_ports port 143 #pop3
acl Safe_ports port 6667-7000 #mirc
acl Safe_ports port 3306 #sqlenterprise
acl Safe_ports port 21 #FTP
acl Safe_ports port 443 563 #https
acl Safe_ports port 70 #gopher
acl Safe_ports port 210 #wais
#acl Safe_ports port 1025-65535 #unregister
acl Safe_ports port 280 #http_mgmt
acl Safe_ports port 488 #gss-http
acl Safe_ports port 591 #file maker
acl Safe_ports port 777 110 #multifiling
#acl Safe_ports port 4461
acl Safe_ports port 3690 #ypt
acl Safe_ports port 8080
acl CONNECT method CONNECT

#acl security
acl manager proto cache_object
acl blokporno dstdomain "/etc/squid/nourl.txt"
acl keyword url_regex -i "/etc/squid/keyword.txt"
acl ncsa_users proxy_auth REQUIRED

#hak akses
http_access deny blokporno
http_access deny keyword
always_direct allow localhost tes
#always_direct deny all
http_access allow manager localhost
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny CONNECT !Safe_ports
http_access allow tes
http_access allow localhost
http_access deny manager
http_access deny all



setelah mengedit file konfigurasi squid.conf, kita harus membuat direktori cache sesuai dengan konfigurasi :

$ sudo mkdir -p /cache

$ sudo chown proxy.proxy /cache

Lalu buat file nourl.txt di /etc/squid/nourl.txt untuk memblok url yang dilarang untuk dibuka misalnya :

www.facebook.com

www.youtube.com

lalu buat file lalu buat keyword.txt di /etc/squid/keyword.txt untuk memblok keyword, misalnya :

porn

sex

miyabi

ariel

Dan setelah itu buat cache dengan cara :

$ sudo squid –z

Lalu jalankan squid dengan cara

$ sudo /etc/init.d/squid restart

0 komentar:

Posting Komentar