The pfSense Store

Author Topic: Install storeid ke squid 3.4  (Read 894 times)

0 Members and 1 Guest are viewing this topic.

Offline 91X

  • Full Member
  • ***
  • Posts: 139
  • Karma: +4/-1
  • Keep respect to all people!
    • View Profile
Install storeid ke squid 3.4
« on: August 09, 2015, 08:24:17 pm »
Tolong sharing ilmunya rekan semua, bagaimana mengintergasikan storied ke squid 3.4 pfsense?

Offline shr_kaza

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #1 on: August 21, 2015, 05:25:46 pm »
harus pke perl, kalau langsung malah erroor

Offline 91X

  • Full Member
  • ***
  • Posts: 139
  • Karma: +4/-1
  • Keep respect to all people!
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #2 on: August 23, 2015, 08:51:39 pm »
harus pke perl, kalau langsung malah erroor
gimna cara bro, bisa perjelas?

Offline shr_kaza

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #3 on: August 26, 2015, 09:29:35 pm »
pertama cari storeid di internet
setelah itu rubah hak akses file
chmod 777 /usr/pbi/squid-i386/local/etc/squid/store-id
chown proxy:proxy /usr/pbi/squid-i386/local/etc/squid/store-id

setelah itu masukkan kalimat berikut
store_id_program /usr/pbi/squid-i386/local/bin/perl /usr/pbi/squid-i386/local/etc/squid/store-id

« Last Edit: August 26, 2015, 09:33:06 pm by shr_kaza »

Offline 91X

  • Full Member
  • ***
  • Posts: 139
  • Karma: +4/-1
  • Keep respect to all people!
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #4 on: August 27, 2015, 07:08:48 pm »
pertama cari storeid di internet
setelah itu rubah hak akses file
chmod 777 /usr/pbi/squid-i386/local/etc/squid/store-id
chown proxy:proxy /usr/pbi/squid-i386/local/etc/squid/store-id

setelah itu masukkan kalimat berikut
store_id_program /usr/pbi/squid-i386/local/bin/perl /usr/pbi/squid-i386/local/etc/squid/store-id
thx bro, ane coba dulu  ;D

Offline kentuss

  • Jr. Member
  • **
  • Posts: 44
  • Karma: +1/-1
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #5 on: August 28, 2015, 01:47:36 am »
pertama cari storeid di internet
setelah itu rubah hak akses file
chmod 777 /usr/pbi/squid-i386/local/etc/squid/store-id
chown proxy:proxy /usr/pbi/squid-i386/local/etc/squid/store-id

setelah itu masukkan kalimat berikut
store_id_program /usr/pbi/squid-i386/local/bin/perl /usr/pbi/squid-i386/local/etc/squid/store-id
thx bro, ane coba dulu  ;D

prasaan bbrp bulan ini, yg diskusi diforum hanya kalian ber2 aja deh....hahaha

sepi bingiiitt......

Offline 91X

  • Full Member
  • ***
  • Posts: 139
  • Karma: +4/-1
  • Keep respect to all people!
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #6 on: August 28, 2015, 02:41:01 am »
pertama cari storeid di internet
setelah itu rubah hak akses file
chmod 777 /usr/pbi/squid-i386/local/etc/squid/store-id
chown proxy:proxy /usr/pbi/squid-i386/local/etc/squid/store-id

setelah itu masukkan kalimat berikut
store_id_program /usr/pbi/squid-i386/local/bin/perl /usr/pbi/squid-i386/local/etc/squid/store-id
thx bro, ane coba dulu  ;D

prasaan bbrp bulan ini, yg diskusi diforum hanya kalian ber2 aja deh....hahaha

sepi bingiiitt......
Serasa forum ini milik kita berdua wkkwakakak...

Offline shr_kaza

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #7 on: August 28, 2015, 03:46:41 am »
karena g ada yang mau sharing

Offline 91X

  • Full Member
  • ***
  • Posts: 139
  • Karma: +4/-1
  • Keep respect to all people!
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #8 on: September 01, 2015, 07:24:03 pm »
karena g ada yang mau sharing
bisa jadi bisa jadi  :D
« Last Edit: September 09, 2015, 07:59:40 pm by 91X »

Offline 91X

  • Full Member
  • ***
  • Posts: 139
  • Karma: +4/-1
  • Keep respect to all people!
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #9 on: September 02, 2015, 08:59:35 pm »
pertama cari storeid di internet
setelah itu rubah hak akses file
chmod 777 /usr/pbi/squid-i386/local/etc/squid/store-id
chown proxy:proxy /usr/pbi/squid-i386/local/etc/squid/store-id

setelah itu masukkan kalimat berikut
store_id_program /usr/pbi/squid-i386/local/bin/perl /usr/pbi/squid-i386/local/etc/squid/store-id
thx bro, ane coba dulu  ;D
tolong bantuannya bro, ane cari di internet tidak ada yg cocok, mohon detailnya  ;D

Offline 91X

  • Full Member
  • ***
  • Posts: 139
  • Karma: +4/-1
  • Keep respect to all people!
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #10 on: September 09, 2015, 07:59:18 pm »
pada sibuk semua nih, padahal ilmu kagak dibawa mati aka mampus ;D

Offline kentuss

  • Jr. Member
  • **
  • Posts: 44
  • Karma: +1/-1
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #11 on: October 13, 2015, 07:44:45 am »
squid 3.4 ane ga keutak atik store ide nya, pakai default saja.
hit msh lancar2 saja.

Offline shr_kaza

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #12 on: December 25, 2015, 06:42:41 pm »
kalau cara buatnya yg selama ini saya lakukan begini bro:
pertama kita buat dulu file storeid.pl di /usr/pbi/squid-amd64/local/etc/squid (saya menggunakan amd64, silakan ganti i386 kalau menggunakan versi itu), lalu copykan isi storeid sebagai berikut yg saya ambil dari blog mas fazar, http://www.fazar.net/storeid-support-caching-youtube-dan-facebook-https/ :

#!/usr/pbi/squid-amd64/local/bin/perl
#
# storeid.pl with debug opt - based on storeurl.pl
# @ http://www2.fh-lausitz.de/launic/comp/misc/squid/projekt_youtube/
#
# mods by cespun and fajar @ ipfire.id
#

use IO::File;
$|=1;
STDOUT->autoflush(1);
$debug=0;         ## recommended:0
$bypassallrules=0;      ## recommended:0
$sucks="";         ## unused
$sucks="sucks" if ($debug>=1);
$timenow="";
$printtimenow=1;        ## print timenow: 0|1
my $logfile = '/tmp/storeid.log';

open my $logfh, '>>', $logfile
    or die "Couldn't open $logfile for appending: $!\n" if $debug;
$logfh->autoflush(1) if $debug;

while (<>) {
$timenow=time()." " if ($printtimenow);
print $logfh "$timenow"."in : $_" if ($debug>=1);
chop;
my $myURL = $_;
@X = split(" ",$myURL);
$a = $X[0]; ## channel id
$b = $X[1]; ## url
$c = $X[2]; ## ip address
$u = $b; ## url

if ($bypassallrules){
 $out="$u"; ## map 1:1

} elsif ($u=~ m/http.*\.(fbcdn|akamaihd)\.net\/h(profile|photos).*[\d\w].*\/([\w]\d+x\d+\/.*\.[\d\w]{3}).*/) {
   $out="OK store-id=http://fbcdn.net.squid.internal/" . $2 . "/" . $3 ;

} elsif ($u=~ m/^http(.*)static(.*)(akamaihd|fbcdn).net\/rsrc.php\/(.*\/.*\/(.*).(js|css|png|gif))(\?(.*)|$)/) {
   $out="OK store-id=http://fbcdn.net.squid.internal/static/" . $5 . "." . $6 ;

} elsif ($u=~ m/^https?\:\/\/.*utm.gif.*/) {
   $out="OK store-id=http://google-analytics.squid.internal/__utm.gif";
 
} elsif ($u=~ m/^https?\:\/\/.*\/speedtest\/(.*\.(jpg|txt)).*/) {
   $out="OK store-id=http://speedtest.squid.internal/" . $1;
 
} elsif ($u=~ m/^https?\:\/\/.*\/(.*\..*(mp4|3gp|flv))\?.*/) {
   $out="OK store-id=http://video-file.squid.internal/" . $1;

} elsif ($u=~ m/^https?\:\/\/c2lo\.reverbnation\.com\/audio_player\/ec_stream_song\/(.*)\?.*/) {
   $out="OK store-id=http://reverbnation.squid.internal/" . $1;
 
} elsif ($u=~ m/^https?\:\/\/.*\.c\.android\.clients\.google\.com\/market\/GetBinary\/GetBinary\/(.*\/.*)\?.*/) {
   $out="OK store-id=http://playstore-android.squid.internal/" . $1;
 
} elsif ($u=~ m/^https?\:\/\/.*youtube.*ptracking.*/){
   @video_id = m/[&?]video_id\=([^\&\s]*)/;
   @cpn = m/[&?]cpn\=([^\&\s]*)/;
   unless (-e "/tmp/@cpn"){
   open FILE, ">/tmp/@cpn";
   print FILE "@video_id";
   close FILE;
   }
   $out="ERR";
 
} elsif ($u=~ m/^https?\:\/\/.*youtube.*stream_204.*/){
   @docid = m/[&?]docid\=([^\&\s]*)/;
   @cpn = m/[&?]cpn\=([^\&\s]*)/;
   unless (-e "/tmp/@cpn"){
   open FILE, ">/tmp/@cpn";
   print FILE "@docid";
   close FILE;
   }
   $out="ERR";
 
} elsif ($u=~ m/^https?\:\/\/.*youtube.*player_204.*/){
   @v = m/[&?]v\=([^\&\s]*)/;
   @cpn = m/[&?]cpn\=([^\&\s]*)/;
   unless (-e "/tmp/@cpn"){
   open FILE, ">/tmp/@cpn";
   print FILE "@v";
   close FILE;
   }
   $out="ERR";
 
} elsif ($u=~ m/^https?\:\/\/.*(youtube|googlevideo).*videoplayback.*/){
   @itag = m/[&?](itag\=[0-9]*)/;
   @range = m/[&?](range\=[^\&\s]*)/;
   @cpn = m/[&?]cpn\=([^\&\s]*)/;
   @mime = m/[&?](mime\=[^\&\s]*)/;
   @id = m/[&?]id\=([^\&\s]*)/;
 
   if (defined(@cpn[0])){
      if (-e "/tmp/@cpn"){
      open FILE, "/tmp/@cpn";
      @id = <FILE>;
      close FILE;}
   }
   $out="OK store-id=http://video-srv.squid.internal/id=@id@mime@range";

} else {
   $out="ERR";
}
   print $logfh "$timenow"."out: $a $out\n" if ($debug>=1);
   print "$a $out\n";
}
close $logfh if ($debug);

lalu save.
melalui putty ketik chmod 777 /usr/pbi/squid-amd64/local/etc/squid/storeid.pl
juga chown proxy:proxy /usr/pbi/squid-amd64/local/etc/squid/storeid.pl
buat file /tmp/storeid.log untuk log storeid
jalankan chown proxy:proxy /tmp/storeid.log lalu chmod 777 /tmp/storeid.log
kita masuk ke webgui services -> squid proxy -> tab general dan di Custom ACLS (Before Auth) copas isi konfigurasi berikut ini :

acl urlrewrite dstdomain .fbcdn.net .akamaihd.net
acl speedtest url_regex -i speedtest\/.*\.(jpg|txt)\?.*
acl reverbnation url_regex -i reverbnation.*audio_player.*ec_stream_song.*$
acl utmgif url_regex -i utm.gif.*
acl playstoreandroid url_regex -i c.android.clients.google.com.market.GetBinary.GetBinary.*
acl idyoutube url_regex -i youtube.*(ptracking|stream_204|player_204).*(v\=|docid\=|video_id\=).*$
acl videoyoutube url_regex -i (youtube|googlevideo).*videoplayback\?
acl videoyoutube url_regex -i (youtube|googlevideo).*videoplayback\?
acl getmethod method GET
store_id_program /usr/pbi/squid-amd64/local/bin/perl /usr/pbi/squid-amd64/local/etc/squid/storeid.pl
store_id_children 1 startup=1 idle=1 concurrency=5
store_id_access deny !getmethod
store_id_access allow urlrewrite
store_id_access allow speedtest
store_id_access allow reverbnation
store_id_access allow utmgif
store_id_access allow playstoreandroid
store_id_access allow idyoutube
store_id_access allow videoyoutube
store_id_access deny all

save, lalu restart squid.
coba squid -k reconfigure lihat kalau masih ada error

refresh_pattern yg saya gunakan hanya satu baris bro tapi cukup efektif  :D
refresh_pattern -i .* 100 99% 525600  override-expire override-lastmod reload-into-ims ignore-reload ignore-no-store ignore-must-revalidate ignore-private ignore-auth refresh-ims store-stale

dan untuk menambah regex di storeid silakan googling bro, banyak bertebaran.
Ok, semoga bermanfaat :D
untuk
refresh_pattern -i .* 100 99% 525600  override-expire override-lastmod reload-into-ims ignore-reload ignore-no-store ignore-must-revalidate ignore-private ignore-auth refresh-ims store-stale
ini ditaruh dimana ?

Offline shr_kaza

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #13 on: December 26, 2015, 08:24:06 pm »
kalau refresh_pattern itu saya taruhnya di services -> squid proxy -> local cache di kolom custom refresh_patterns :)
oh iya, regex di atas itu sudah ada beberapa yg tidak berfungsi lagi om, ganti saja. itu cuma sekedar cara pembuatannya saja :) selanjutnya tinggal dikembangkan.
ini ada blog cara membuat regex yg mudah dimengerti ;) : https://mikrotiksquid.wordpress.com/2014/08/27/mudahnya-membuat-regex-untuk-helper-storeurl-atau-storeid-di-squid-web-proxy-untuk-pemula/
juga jangan lupa aktifkan https-nya biar game facebook jadi ngacir :D
ini berarti Cache Dynamic Content harus enable, untuk mengaktifkan refresh pattern

Offline herymulyo

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-3
    • View Profile
Re: Install storeid ke squid 3.4
« Reply #14 on: January 07, 2016, 10:25:16 pm »
kenapa storeid.log terhapus dari folder /tmp/soreid.log ,setelah reboot pfnya