Friday, November 8, 2013

Praktik Sistem Operasi - Belajar Squid Proxy Server (Dasar)

A. Pemasangan Squid

1. Unduh Squid disini (2.7 STABLE 8), kemudian ekstraklah.
2. Salin dan temple folder squid didirektori yang diinginkan (rekomendasi: C:\)
3. Jalankan Command Prompt dan perhatikan command line dibawah.

C:\Documents and Settings\Administrator>cd C:\squid\sbin 
C:\squid\sbin>
 Volume in drive C has no label.
 Volume Serial Number is 5C5F-3CA1
 Directory of C:\squid\sbin
11/08/2013  02:46 PM    <DIR>          .
11/08/2013  02:46 PM    <DIR>          ..
03/13/2010  02:16 PM         1,114,112 squid.exe
               1 File(s)      1,114,112 bytes
               2 Dir(s)  12,766,711,808 bytes free 
C:\squid\sbin>squid.exe -i
Registry stored HKLM\SOFTWARE\GNU\Squid\2.6\Squid\ConfigFile value c:/squid/etc/
squid.conf
Squid Cache version 2.7.STABLE8 for i686-pc-winnt
installed successfully as Squid Windows System Service.
To run, start it from the Services Applet of Control Panel.
Don't forget to edit squid.conf before starting it.

C:\squid\sbin>squid.exe -z
2013/11/08 19:48:40| Creating Swap Directories

B. Konfigurasi Squid
 
1. Pergi ke direktori "\squid\etc" lalu edit empat file dibawah ini:
cachemgr.conf.default
mime.conf.default
squid.conf.default
squid_radius_auth.conf.default
menjadi:
cachemgr.conf
mime.conf
squid.conf
squid_radius_auth.conf
2. Buka file squid.conf dengan text editor. Ada beberapa hal yang harus diperhatikan:
    - Edit "http_port 3128" dengan mencari tag "TAG: http_port" dengan angka port seuai keinginan. Pada bagian:
#  TAG: http_port
# Usage: port [options]
#  hostname:port [options]
#  1.2.3.4:port [options]
#
# The socket addresses where Squid will listen for HTTP client
# requests.  You may specify multiple socket addresses.
# There are three forms: port alone, hostname with port, and
# IP address with port.  If you specify a hostname or IP
# address, Squid binds the socket to that specific
# address.  This replaces the old 'tcp_incoming_address'
# option.  Most likely, you do not need to bind to a specific
# address, so you can use the port number alone.
...
# If you run Squid on a dual-homed machine with an internal
# and an external interface we recommend you to specify the
# internal address:port in http_port. This way Squid will only be
# visible on the internal address.
#
# Squid normally listens to port 3128
http_port 3128
   - Cari dengan tag "http_access allow" dan tambahkan "acl_http allow localhost" pada bagian:
# 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
   - Cari dengan tag "TAG: dns_nameserver" dan tambahkan "dns_nameservers 208.67.222.222 208.67.220.220" (OpenDNS).
#  TAG: dns_nameservers
# Use this if you want to specify a list of DNS name servers
# (IP addresses) to use instead of those given in your
# /etc/resolv.conf file.
# On Windows platforms, if no value is specified here or in
# the /etc/resolv.conf file, the list of DNS name servers are
# taken from the Windows registry, both static and dynamic DHCP
# configurations are supported.
#
# Example: dns_nameservers 10.0.0.1 192.172.0.4
#
#Default:
dns_nameservers 208.67.222.222 208.67.220.220
   - Untuk memblokir halaman situs, pertama-tama kita tambah "acl blok url_regex "C:\squid\etc\blok.txt"" pada bagian: 
...
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.1.0/24 # RFC1918 possible internal network
acl blok url_regex "C:\squid\etc\blok.txt"
...
     Kemudian, tambah  "http_access deny blok" pada bagian:
...
# 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
http_access deny blok
# And finally deny all other access to this proxy
http_access deny all
     Setelah itu, pergi ke "C:\squid\etc" dan buat file "blok.conf". Buka dengan text editor, dan masukkan alamat situs yang ingin diblokir (satu baris, satu alamat). Lalu simpan.
   - Simpan squid.conf. Kemudian, masukkan "Win+R" untuk menjalankan Run. Ketik "services.msc" untuk membuka jendela Services, cari "Squid" dan klik link "Start the service" untuk menjalankannya.

3. Buka web browser seperti Internet Explorer.
   - Setelah muncul jendela IE, masukkan "alt" untuk memunculkan menu bar. Lalu klik "Tools -> Internet Options".
   - Klik tab "Connection" dan klik tombol "LAN Settings".
   - Pada bagian Proxy Server, cek "Use a proxy server for your LAN...". Masukkan alamat IP host squid dengan port yang telah ditentukan. Klik OK dan klik OK lagi untuk menutup Internet Options.

4. Uji koneksi dengan memasukkan alamat situs dan masukkan alamat yang telah diblokir.

No comments:

Post a Comment