PROXY SERER DENGAN SQUID

PROXY SERER DENGAN SQUID

  Bagi sebagian rekan-rekan yang mau membuattau bagi adik-adik Ilmu Komputer USD yang mau coba-coba belajar bikin untuk membuatenggunakan squid.

  Untuk spesifikasi hardware yang saya gunakan, dapat dilihat di artikel

  

  yang saya fungsikan sebagai: 1. Menyimpan halaman web di

  2. Akses kontrolrdasarkan IP Address. Menggunakan 2 network yang berbeda (saya fungsikan juga sebagai router – dengan IP Forwarding), untuk ini, saya menggunakan 3 NIC pada

  3. Blacklist daftar situs terlarang secara manual.

  4. Membatasi ukuranile dengan ekstension tertentu dan hanya berlaku pada jam tertentu.

  5. Pesan Error dalam format Bahasa Indonesia.

  6. Rule untuk memperbolehkan aksesnya protokol tertentu saja. Langkah-langkah yang saya lakukan:

  1. Instal aplikasi squid

  2. Edit file konfigurasi squid

  3. Buat direktori dan file blacklist untuk blacklist secara manual

  4. Buat direktori dan file untuk pesan error dalam bahasa indonesia

  5. Check konfigurasi firewall yang diterapkan di

  6. Jalankan servicenya

  7. Test konfigurasi din client File konfigurasi squid: /etc/squid/squid.conf (versi saya)

  #SQUID 2.6.STABLE12 #Author by: http://fxekobudi.net # OPTION JARINGAN #

  • -----------------------------------------------------------------------------

    http_port 3128 icp_port

  # OPTION UKURAN CACHE # -------------------------------------------------------------------

  cache_mem 256 MB cache_swap_low

  94

  maximum_object_size 16384 KB minimum_object_size

  4 KB

  maximum_object_size_in_memory 2048 KB fqdncache_size 1024 cache_replacement_policy heap GDSF memory_replacement_policy heap GDSF

  # DIREKTORI LOG DAN CACHE # ------------------------------------------------------------------

  cache_dir aufs / var / spool / squid 9000

  16 256

  access_log / var / log / squid / access. log squid cache_log / var / log / squid / cache. log cache_store_log none

  # TUNING CACHE PROXY # ------------------------------------------------------------------

  refresh_pattern ^ ftp : 1440

  20 % 10080

  refresh_pattern ^ gopher : 1440 % 1440 refresh_pattern .

  20 % 4320

  negative_ttl

  1 minutes # TIMEOUT # -----------------------------------------------------------------

  half_closed_clients off

  # ------------------------------------- # Memblok situs terlarang (blacklist)secara manual # -------------------------------------

  acl noblacklist dstdomain "/etc/squid/blacklist/no-blacklist.txt"

  • acl katablacklist url_regex i "/etc/squid/blacklist/kata-blacklist.txt"

  acl domainblacklist dstdomain "/etc/squid/blacklist/domain-blacklist.txt" acl ipblacklist dst "/etc/squid/blacklist/ip-blacklist.txt"

  08 :

  00 - acl tdkbebasdownload time 13 :

  

00

# AKSES KONTROL # ------------------------------------------------------------------

  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 to_localhost dst 127.0.0.0 /

  8

  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

  70 # gopher

  acl Safe_ports port 210 # wais

  • acl Safe_ports port 1025 65535 # unregistered ports

  acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http

  # ------------------------------------- # Daftar IP address # -------------------------------------

  • acl lab1 src 192.168.254.1 192.168.254.40 / 255.255.255.255
  • acl staf - it src 192.168.254.41 192.168.254.42 / 255.255.255
  • acl ruang1 src 192.168.1.1 192.168.1.8 / 255.255.255.255
  • acl ruang2 src 192.168.1.11 192.168.1.17 / 255.255.255.255 # ------------------------------------- # Memblok situs terlarang secara manual # -------------------------------------

  http_access allow noblacklist http_access deny katablacklist http_access deny domainblacklist http_access deny ipblacklist http_access allow manager localhost http_access deny manager

  # ------------------------------------- # Rule yang saya terapkan # -------------------------------------

  http_access allow lab1

  • http_access allow staf it

  http_access allow lab2 http_access allow ruang1 http_access allow ruang2

  • acl magic_words2 url_regex i

  ftp . exe . mp3 . vqf . tar . gz . gz . tar . bz2 . bz2 . rpm . zip . rar . avi . mpeg . mpe . m

  pg . qt . ram . rm . raw . wav . iso

# Cancel download if file is bigger than 2 MB = 2000x1024 byte = 2048000 byte

  reply_body_max_size 2048000 allow magic_words2 tdkbebasdownload http_access deny ! Safe_ports http_access deny CONNECT ! SSL_ports http_access allow localhost http_access deny all http_reply_access allow all icp_access allow all

  # PARAMETER ADMINISTRATOR # -----------------------------------------------------------------

  cache_mgr fxekobudi@gmail. com cache_effective_user squid cache_effective_group squid visible_hostname proxy. fxekobudi . local

  # PESAN ERROR DALAM BAHASA INDONESIA # --------------------------------------------------------------------

  error_directory / usr / share / squid / errors / Indonesian Agar fungsi blacklist manual itu dapat digunakan, buat direktori berisi file-file disebutkan dalam blacklist manual:

  # mkdir /etc/squid/blacklist # cd /etc/squid/blacklist/

  # vim no-blacklist.txt # vim kata-blacklist.txt # vim domain-blacklist.txt # vim ip-blacklist.txt

  Minimal dimasukkan satu item untuk masing-masing file tersebut, karena jika tidak, maka saat kita melihat error log squid sesaat setelah service dijalankan, akan ada pesan error tidak menemukan item pada file tersebut… Selain itu, saya juga menyertakan konfigurasi untuk pesan Error dariquid dalam bentuk bahasa indonesia, agar user di tempat kerja saya lebih mudah memahami maksudnya… Ide pesan error ini kemudian menjadi inspirasi saya saat mengkonfigurasi redirect SquidGuard untuk mengarah kepada file yang sengaja saya buat di root direktori Untuk melakukannya, tinggal copykan saja pesan Error dalam bahasa Inggris ke direktori lokasi pesan error berbahasa Indonesia.

  # cp /usr/share/squid/errors/English /usr/share/squid/errors/Indonesian

  trus terjemahkan file-filenya… Untuk menjalankan servicenya, gunakan saja perintah:

  # /sbin/service squid start

  Oh ya, Anda juga perlu menambahkan di konfigurasi Firewall menggunakan Iptable agar client diperbolehkan mengaksesngan IP address yang terdaftar diperbolehkan melalui port 3128 (atau 8080) tergantung konfigurasi yang Anda gunakan… Saya jadi ingat waktu pertama kali mencoba, koneksi udah jalan, tapi kok clientnya ngga bisa akses, eh ternyata emang client belum diperbolehkan akses ke IP address dan portnyae iptable-nya untuk file /etc/sysconfig/iptables harus memuat rule ini: (saya pakai konfigurasi firewall bawaan

  )

  • A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3128 -j

  ACCEPT Untuk menerapkan IP forwarding, saya edit file /etc/sysctl.conf dan memberi nilai 1 (enable) untuk direktive: net.ipv4.ip_forward = 0 menjadi net.ipv4.ip_forward = 1 Konfigurasin persekolahan

  

ngan beberapa tambahan fitur

  yang tidak dapat saya sebutkan disini… Dengan alasan keamanan. Hehe… Sedangkan konfigurasi squid untuk menggunakan blacklist dari redirect SquidGuard dan

  

firewall-nya akan saya tulis beberapa minggu ke depan… Setelah saya pulang berlibur ke rumah

  orang tua saya sekaligus tanah kelahiran saya di