
RAPANI-ID : MENERIMA JASA SETTING MIKROTIK - JASA SETTING PROXY - JASA INSTALASI DAN PEMBUATAN WARNET GAME ONLINE TELP 082170824476 (WA)
Proxy squid adalah web cache yang sangat popular karna dapat di gunakan secara bebas dirilis di bawah lisensi GNU General Public License
Pada artikel ini  akan kita bahas langkah-langkah tutorial cara setting dan instalasi proxy squid yang support untuk cache static konten dan dinamic seperti youtube dan facebook
Dalam tutorial install squid ini sudah di sertakan file helper store-id untuk youtube HTML5 yang terbaru.
Adapun persiapan sebelum memuulai instalasi proxy squid ini adalah :
- Â Sudah terpasang mikroTik dan terkoneksi dengan baik
- Persiapan PC untuk di jadikan proxy dapat di lihat pada halaman hadware dan software untuk proxy
- Â Sudah terinstall debian/ubuntu server , panduannya silahkan download disini
Topologi Jaringan proxy server seperti gambar dibawah ini :
Selanjutnya  adalah ganti terlebih dahulu Repository Debian/ Ubuntu ke server lokal agar prosess update dan install depedency lebih cepat
Repository ubuntu server 16.04 LTS
Repository Debian Jessi dan Ubuntu Server 14.04 LTS
Login sebagai root ke proxy server menggunakan PuTTy, dan install paket depedency berikut ini :
1 2 3 |
echo Y | apt-get update echo Y | apt-get install openssl libssl-dev devscripts build-essential fakeroot libcppunit-dev libsasl2-dev echo Y | apt-get install cdbs ccze libcap2 libcap-dev libcap2-dev acpid sysv-rc-conf zip unzip apache2 |
Untuk optimalisasi performance server silahkan copy paste script dibawah ini ke console di Putty.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
echo 4 >> /proc/sys/net/ipv4/tcp_fin_timeout mv /etc/sysctl.conf /etc/sysctl.conf.BAK touch /etc/sysctl.conf chmod 777 /etc/sysctl.conf echo "net.ipv4.ip_forward = 1 net.ipv4.conf.default.rp_filter = 0 net.ipv4.conf.all.rp_filter = 0 net.ipv4.conf.eth0.rp_filter = 0 vm.swappiness = 10 fs.file-max = 819201" >> /etc/sysctl.conf echo 819200 > /proc/sys/fs/file-max echo "* soft nofile 819200 * hard nofile 819200 root soft nofile 819200 root hard nofile 819200 proxy soft nofile 819200 proxy hard nofile 819200" > /etc/security/limits.conf echo "session required pam_limits.so" >> /etc/pam.d/common-session echo "ulimit -Hn 819201 ulimit -Sn 819200" >> /etc/profile |
Downlaod dan Install paket Squid Cache
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 29 30 31 32 33 34 35 36 37 38 39 40 |
wget https://rapani-id.com/proxy/webcache-v3.tar.gz --no-check-certificate && tar xzvf webcache-v3.tar.gz && cd webcache-v3 ./configure --prefix=/usr \ --bindir=/usr/bin \ --sbindir=/usr/sbin \ --libexecdir=/usr/lib/squid \ --sysconfdir=/etc/squid \ --localstatedir=/var/spool/squid \ --libdir=/usr/lib \ --includedir=/usr/include \ --datadir=/usr/share/squid \ --enable-default-err-language=English \ --enable-auto-locale \ --infodir=/usr/share/info \ --mandir=/usr/share/man \ --with-logdir=/var/log/squid \ --with-pidfile=/var/run/squid.pid \ --enable-linux-netfilter \ --disable-dependency-tracking \ --enable-storeio=aufs \ --enable-removal-policies=lru,heap \ --disable-wccp \ --enable-kill-parent-hack \ --enable-cache-digests \ --enable-follow-x-forwarded-for \ --enable-x-accelerator-vary \ --enable-zph-qos \ --enable-snmp \ --enable-underscores \ --with-default-user=proxy \ --with-large-files \ --enable-large-cache-files \ --enable-ltdl-convenience \ --with-openssl \ --disable-auth \ --disable-ipv6 \ --disable-translation \ --with-pthreads \ --with-filedescriptors=819200 make make install |
Buat ip Table Tproxy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
mv /etc/rc.local /etc/rc.local.original touch /etc/rc.local chmod 777 /etc/rc.local cat <<EOF >>/etc/rc.local #!/bin/sh -e iptables -t mangle -F iptables -t mangle -X iptables -t mangle -N DIVERT iptables -t mangle -A DIVERT -j MARK --set-mark 1 iptables -t mangle -A DIVERT -j ACCEPT iptables -t mangle -A INPUT -j ACCEPT iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT iptables -t mangle -A PREROUTING ! -d 10.10.10.10/32 -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129 iptables -t mangle -A PREROUTING ! -d 10.10.10.10/32 -p tcp --dport 443 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3127 /sbin/ip rule add fwmark 1 lookup 100 /sbin/ip route add local 0.0.0.0/0 dev lo table 100 echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter echo 1 > /proc/sys/net/ipv4/ip_forward exit 0 EOF |
Rubah permition/ hak akses dir cache agar bisa di baca tulis oleh program squid
1 2 |
chown -R proxy:proxy /cache chmod 777 /cache |
buat file log squid
1 2 3 4 5 |
touch /var/log/squid/cache.log touch /var/log/squid/access.log chown -R proxy:proxy /var/log/squid/ chown -R proxy:proxy /var/log/squid/cache.log chown -R proxy:proxy /var/log/squid/access.log |
Download SSL CA Root
1 2 3 4 5 |
cd /etc/squid/ wget https://rapani-id.com/squid/ssl_cert.tar.gz && tar xzvf ssl_cert.tar.gz chmod 777 /etc/squid/ssl_cert/ rm -rf /var/www/html/index.hml && mv /etc/squid/ssl_cert/Certificate.der /var/www/html cd /var/www/html && zip -r Certificate.zip Certificate.der |
Download file service squid
1 2 |
cd /etc/init.d/ && wget https://rapani-id.com/proxy/squid --no-check-certificate chmod 777 /etc/init.d/squid |
Buat file helper store-id squid
1 2 |
touch /etc/squid/store-id.pl chmod 777 /etc/squid/store-id.pl |
kemudian login ke proxy menggunakan WINSCP, dan ganti isi file squid.conf yang terletak di folder /etc/squid/ dengan script dibawah ini :
File squid.conf ganti dengan script dibawah ini.
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# WELCOME TO SQUID WEB CACHE RE-BUILD BY RAPANI LOEBIS # Website : www.rapani-id.com || https://rapani-id.com # Mobile : 082170824476 acl RFC1918 src 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 #PORT ALLOWED acl SSL_ports port 443 acl Safe_ports port 80 81 88 182 21 443 70 210 1025-65535 280 488 591 777 acl CONNECT method CONNECT acl GET method GET acl purge method PURGE acl blokdomain dstdomain .u-ad.info .uzone.id .windowsupdate.com http_access deny blokdomain acl yt_player url_regex -i \.youtube\.com\/yts\/jsbin\/player-.*\/base\.js http_access deny yt_player deny_info https://rapani-id.com/yt/base.js yt_player acl rapani dstdomain .fbcdn.net .akamaihd.net .ak.instagram.com acl rapani dstdomain .cdninstagram.com .dl.sourceforge.net .googlevideo.com acl text rep_mime_type -i ^text/plain acl text rep_mime_type -i ^text/html acl text rep_mime_type -i ^application/xml #HTTP ACCESS http_access deny purge http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow RFC1918 http_access allow localhost http_reply_access allow all icp_access allow all always_direct allow all http_access deny all # NETWORK OPTIONS https_port 3127 tproxy ssl-bump generate-host-certificates=on cert=/etc/squid/ssl_cert/myCA.pem http_port 3129 tproxy http_port 3128 # TAG: ssl_bump acl sni ssl::server_name mail.google.com gmail.com .bri.co.id login.yahoo.com .iris.yahoo.com .bankmandiri.co.id ssl_bump splice localhost acl step1 at_step SslBump1 acl step2 at_step SslBump2 acl step3 at_step SslBump3 ssl_bump peek step1 all ssl_bump splice step2 sni ssl_bump bump all sslproxy_cert_error allow all sslproxy_flags DONT_VERIFY_PEER NO_DEFAULT_CA sslproxy_options NO_SSLv2 NO_SSLv3 SINGLE_DH_USE # MEMORY CACHE OPTIONS cache_mem 512 MB maximum_object_size_in_memory 64 KB maximum_object_size 512 MB memory_replacement_policy heap GDSF cache_replacement_policy heap LFUDA #CACHE DIR cache_dir aufs /cache 25000 59 256 cache_swap_low 95 cache_swap_high 99 # LOG access_log stdio:/var/log/squid/access.log GET logfile_rotate 1 #STORE-ID store_id_program /etc/squid/store-id.pl store_id_children 50 startup=10 idle=8 concurrency=100 store_miss deny rapani text send_hit deny rapani text store_id_access deny !GET store_id_access allow rapani store_id_access deny all #REFRESH PATTERN max_stale 1 year refresh_pattern -i youtube\.internal 4821300 100% 4821300 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-store ignore-must-revalidate ignore-private ignore-auth refresh-ims store-stale refresh_pattern -i \.internal\.proxy-id\.com 0 60% 4350 ignore-reload ignore-private store-stale refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320 negative_ttl 1 seconds positive_dns_ttl 12 hours forward_timeout 2 minutes minimum_expiry_time 1 seconds read_ahead_gap 32 KB store_objects_per_bucket 50 client_db on max_filedescriptors 819200 #TAG HEADER via off forwarded_for off reply_header_access Alternate-Protocol deny all request_header_access X-Forwarded-For deny all request_header_access Server deny all request_header_access From deny all request_header_access Via deny all request_header_access Link deny all # TAG ZPH qos_flows tos local-hit=0x20 # ADMINISTRATIVE PARAMETERS shutdown_lifetime 12 seconds cache_effective_user proxy cache_effective_group proxy visible_hostname rapani-id.com memory_pools off reload_into_ims on vary_ignore_expire on |
untuk store-id.pl masukkan script dibawah ini :
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#!/usr/bin/perl # referensi = https://github.com/elico/squid-helpers # re-build by Rapani Loebis / https://rapani-id.com $|=1; while (<>) { chomp; my $chan = ""; if (s/^(\d+\s+)//o) { $chan = $1; } @X = split; if (@X[0] =~ m/^(exit|quit|x|q)/) { print STDERR "quiting helper quietly\n"; exit 0; } $url = $X[0]; $ip = $X[1]; #################Begin#### if ($url =~ m/^https?:\/\/.*\.googlevideo\.com\/videoplayback\?/){ @itag = m/[&?](itag\=[0-9]*)/; @mime = m/[&?](mime\=[^\&\s]*)/; @range = m/[&?](range\=[^\&\s]*)/; @cpn = m/[&?]cpn\=([^\&\s]*)/; @id = m/[&?](id=[^\&]*)/; if (@cpn != NULL ) {@v = @cpn ;} else {@v = @id ;} print $chan . "OK store-id=http://video-srv.youtube.internal/@v/@itag/@mime/@range\n"; } elsif ($url =~ m/^https?\:\/\/.*((akamaihd|fbcdn|instagram|fbsbx)\.(net|com))(\/[\w])?\/[\w]+.[\d]+-[\d]+\/(.*\.[\w]{2,4})(\?.*)?/) { print $chan . "OK store-id=http://fb.internal.rapani-id.com/" . $2 . "/" . $5 . "\n"; } elsif ($url =~ m/^https?:\/\/.*\.(fbcdn|akamaihd|instagram)\.(net|com)\/h(video|photos).*[a-z]{3}[0-9].*\/(.*\.(mp4|m4a)).*/) { print $chan . "OK store-id=http://fb.internal.rapani-id.com/" . $4 . "\n"; } elsif ($url =~ m/^https?:\/\/.*\.(akamaihd|fbcdn|cdninstagram|instagram)\.(net|com)\/(h|s)(profile|photos).*\/(.*\.(png|gif|jpg|mp4))(\?.+)?/) { print $chan . "OK store-id=http://fb.internal.rapani-id.com/" . $5 . "\n"; } elsif ($url =~ m/^https?:\/\/.*\.dl\.sourceforge\.net\/(.*)/) { print $chan . "OK store-id=http://sourceforge.internal.rapani-id.com/" . $1 . "\n"; } #################and###### else { print $chan . "ERR\n"; } } |
kemudian buat direktori cache dengan perintah
1 |
squid -z |
Cek konfigurasi squid dengan perintah
1 |
squid -k parse |
Jika semua line configuration squid tidak ada yang error , jalankan proxy squid dengan perintah
1 2 3 |
service squid start atau /etc/init.d/squid start |
untuk starup squid dan apache2Â :
1 2 |
update-rc.d apache2 defaults update-rc.d squid defaults |
terkahir masukkan ke dalam crontab -e
1 |
30 23 * * * root squid -k rotate |
Restart mesin proxy squid dengan perintah
1 |
reboot |
Settingan berikutnya adalah membuat routing tproxy di mikrotik, caranya login ke mikrotik dengan winbox dan klik new terminal , copy paste sript dibawah ini.
Akan tetapi sebelum Setting Routing TProxy / transparent proxy di Mikrotik, silahkan di sesuaikan dengan kondisi real jaringan yang anda gunakan.
192.168.1.0/24 Adalah Ip Komputer Klien dan ether3-PROXY = Port yang terpasang Proxy di Mikrotik
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
/ip fi ma add action=mark-connection chain=prerouting comment=TPROXY dst-port=80,443 \ new-connection-mark=tproxy_con passthrough=yes protocol=tcp src-address=\ 192.168.1.0/24 add action=mark-routing chain=prerouting connection-mark=tproxy_con \ in-interface=!ether3-PROXY new-routing-mark=tproxy passthrough=no add action=mark-packet chain=postrouting comment=HIT dscp=8 new-packet-mark=\ HIT passthrough=no /ip route add comment=proxy distance=1 gateway=10.10.10.10 routing-mark=tproxy /tool netwatch add disabled=no down-script="/ip route disable [find comment=proxy]" \ host=10.10.10.10 interval=1s timeout=1s up-script=\ "/ip route enable [find comment=proxy]" /ip fi filter add action=reject chain=forward dst-port=443 protocol=udp reject-with=\ icmp-network-unreachable |
Setelah proxy server di restart dan routing tproxy sudah di setting di mikrotik maka pertama kali saat melakukan browsing akan muncul pesan your connection is not secure di browser, Â itu karna SSL SELF SIGNED proxy tidak di kenali oleh browser
maka solusinya adalah anda harus menginstall certificate root nya ke dalam browser.
Cara memasang SSL CA ROOT ke browser adalah sebegai berikut :
- Install SSL Ca Root di Mozilla Firefox
Buka browser mozilla firefox dan buka ip proxy 10.10.10.10 di URL address  browser, kemudian pilih Certificate.der,  Ceklist pada 3 bagian yaitu Trust this CA to identify website, Trust this CA to identify email users, Trust this CA to identify software develpoer dan klik OK.
Lebih jelas perhatikan gambar dibawah ini :
- Install SSL Ca Root di Chrome, Opera dan Internet Explorer
Download file Certificate.zip dan extract , lalu klik kanan pada file Certificate.der dan pilih Install Certificate, seperti gambar dibawah ini :
Selanujutnya pilih Local Mechine dan Next
Pilih Browse dan klik pada Trusted Root — OK dan Klik Next
Terkahir klik Finish dan OK
Sampai pada tahap ini, jika sudah benar maka anda sudah bisa browsing sebagaimana mestinya, Namun jika masih muncul Your Connection Is not Secure setelah Certificate di install, kemungkinan lain adalah SSL Ca Root nya di block oleh anti virus, yang sering terjadi adalah pada antivirus merek Avast dan Kaspersky.
Maka solusinya uninstall Anti virus atau jika ingin tetap menggunakan anda dapat menghilangkan Ceklist pada bagian Scan Certificate pada bagian settingan Anti virus anda.
Untuk melihat log proxy squid jalankan perintah :
1 |
tail -f /var/log/squid/access.log | ccze |
Demikianlah tutorial lengkap install proxy squid versi 3 pada artikel ini, mudah-mudahan bermanfaat dan ada hikmahnya, jika ada pertanyaan silahkan tinggal komentar dibawah artikel ini.
Terima Kasih .
pertamax
wget https://rapani-id.com/proxy/proxy-id.tar.gz && tar xzvf proxy-id.tar.gz && cd proxy-id
Apakah wajib menggunakan squid bawaan ini, ?
tidak wajib mas… bisa menggunakan asli dari http://squid-cache.org
Malam,
mau tanya, apakah stode-id yang anda buat ini bersifat sample? adakah store-id yang mungkin selalu up to date. Melihat bahwa youtube ini menggunakan CDN, tentu mungkin akan berubah/berkembang lagi ke depannya.
terima kasih
tidak ada store-id yang selalu uptudate mas, semuanya harus dirubah sesuai dengan perkembangan dari youtube, dan untuk saat ini store-id.pl diatas adalah yang terbaru
kk kenapa ya aku selalu salahnya di
chown -R proxy:proxy /cache
apa mungkin kita bikin file /cache nya
dengan Mkdir /cache
coba cek partisi cachenya apa sudah ada ,, ketik df -h
kalok gak ada gimana ya kk apa kita harus bikin dengan cara Mkdir cache
KK ini script ini belum install squid ya sory masih newbie. mau nanya squid versi brp y kk kalok boleh tau
Selamat siang,
Kalau boleh tau ini conf digunakan untuk yang 32 bit atau 64 bit ya
Sekalian mau bertanya untuk yang Cache Youtube HTML5 dengan Proxy Squid : STORE-ID dan eCap itu juga 32 bit atau 64 bit, mksh ya mas infonya
Sukses selalu
64 bit mas
pada bagian crontab -e saya gak paham pada bagian ini mas… gimana ya mas mohon penhjelasaanya
ketik crontab -e di linux nya lalu pilih 1 untuk mengedit dengan nano, untuk menyimpan file tekan crtl + x dan Y
saya coba dulu mas terima kasih
mas saya masih ketemu trouble
saya sudah selesai install dan konfigurasi panduan di atas .. kendalanya tidak semua video youtube bisa di cache.. contonya seperti video armada pada gambar di artikel video ini kalau saya play cuma bisa loading aja
tapi ada beberapa video youtube yang lain bisa di putar dan bisa dicache
mohon penjelasannya mas
terima kasih
setelah selesai awalnya bisa cache web … seting di mikrotik pun susah saya buat sesuai dengan seti ngan mas… tapi ketika proxy saya reboot.. tidak bisa browsing lagi… untuk bisa browsing lagi saya harus disable route tproxy di mikrotik
mohon pentunjukanya mas terima kasih
masqruade di nat harus di tentukan out-interfacenya mas
dan gunakan eCap agar youtubenya bisa di cache mas = https://rapani-id.com/youtube-caching
out interfacenya sudah saya atur mengarah ke internet mas
Selamat malam … salam perkenalan
Bang Update dong bang mikrotik management bandwith nya sekalian
….hehehe
insyallah lain kali kita share bandwidth managemant yang match dengan TProxy bg.
mikrotik setting for squid proxy dont work witm me please i want more details about mikrotik setting
I used to be able to find good advice from your blog posts.
mohon pencerahan nya..
saya sudah ikutin semu tapi mentok di squid -z
squid -z
-bash : /usr/sbin/squid : No such file or directory
squid -v
-bash : /usr/sbin/squid : No such file or directory
dimana ya permasalahan nya.
terima kasih.