Install Proxy Lusca di ClearOS

  
Setelah sekian lama tersimpan di HDD, kemarin buka2 ada dokumentasi instalasi Lusca di Clearos Iseng di dokumentasikan di blog aja kalau ada yang perlu install proxy lusca di clearos.... Ok langsung saja ya saya anggap Server ClearOS dah diinstal, langsung kita masuk ke putty dan kita ketik perintah seperti di bawa ini :

#yum remove squid          (jawab :  y)
#yum remove squid          (sengaja… untuk memastikan gak ada yg tersisa)
#yum install automake gcc glibc-devel e2fsprogs-devel sharutils  (jawab : y)
#wget http://lusca-cache.googlecode.com/files/LUSCA_HEAD-r14809.tar.gz
#tar -zxvf LUSCA_HEAD-r14809.tar.gz
#cd LUSCA_HEAD-r14809
#ulimit -n 8192
# ./configure --prefix=/usr/local/squid --exec-prefix=/usr/local/squid --enable-delay-pools --enable-cache-digests --enable-poll --enable-linux-netfilter --enable-removal-policies --with-maxfd=8192 --enable-storeio=aufs --disable-wccp --enable-x-accelerator-vary --enable-kill-parent-hack --enable-async-io=30 --disable-ident-lookups
#make all && make install
#cd /usr/local/squid/etc/
dilanjutkan dengan buka winscp : masuk ke folder/directory : /usr/local/squid/etc/
Copy pastekan Script di bawah ini ke file squid.conf
#######################################################
#                       Powered by ccnet0112@gmail.com                            #
#                                   www.ccnetwifi.com                                        #
#######################################################
acl all src 0.0.0.0/0
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
#########################################
# jaringan local (Sesuaikan dengan kondisi jaringan di tempat anda)
#########################################
acl localnet src 192.168.1.0/24
acl localnet src 192.168.2.0/24

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

acl CONNECT method CONNECT
acl dynamic urlpath_regex cgi-bin \?

http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow localnet
http_reply_access allow all
http_gzip on
http_gzip_types text/plain,text/html,text/xml,text/css,application/xml,application/xhtml+xml,application/rss+xml,application/javascript,application/x-javascript
http_access deny all

####################
# transparent proxy
####################
http_port 3128 transparent

######
# ZPH
######
zph_mode tos
zph_local 0x30
zph_parent 0
zph_option 136

###############
# memory cache
###############
cache_mem 32 MB                     # untuk cache_mem = memory : 16
maximum_object_size_in_memory 8 MB  # ini default maximal squid

memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA

#############################
# lokasi partisi cache proxy
#############################
cache_dir aufs /cache1 15000 32 256 max-size=20000
cache_dir aufs /cache2 15000 32 256 max-size=20000
cache_dir aufs /cache3 15000 32 256 max-size=20000

minimum_object_size 0 KB
maximum_object_size 256 MB          # untuk maximum_object_size = 1/2 X memory

cache_swap_low 98%
cache_swap_high 99%

access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_log /dev/null
cache_store_log /dev/null
redirect_rewrites_host_header off

logfile_rotate 10
emulate_httpd_log off
mime_table /usr/share/squid/mime.conf
pid_filename /var/run/squid.pid
log_fqdn off
buffered_logs off

####################
# storeurl
####################
acl store_rewrite_list urlpath_regex \/(get_video|videoplayback\?id|videoplayback.*id)
acl store_rewrite_list urlpath_regex \.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv|wmv|3gp|mp(4|3)|exe|msi|zip|on2|mar|swf)\?
acl store_rewrite_list_domain url_regex ^http:\/\/([a-zA-Z-]+[0-9-]+)\.[A-Za-z]*\.[A-Za-z]*
acl store_rewrite_list_domain url_regex (([a-z]{1,2}[0-9]{1,3})|([0-9]{1,3}[a-z]{1,2}))\.[a-z]*[0-9]?\.[a-z]{3}
acl store_rewrite_list_path urlpath_regex \.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv|avc|zip|mp3|3gp|rar|on2|mar|exe)$
acl store_rewrite_list_domain_CDN url_regex (khm|mt)[0-9]?.google.com
acl store_rewrite_list_domain_CDN url_regex photos-[a-z].ak.fbcdn.net
acl store_rewrite_list_domain_CDN url_regex \.rapidshare\.com.*\/[0-9]*\/.*\/[^\/]*
acl store_rewrite_list_domain_CDN url_regex ^http:\/\/(www\.ziddu\.com.*\.[^\/]{3,4})\/(.*)
acl store_rewrite_list_domain_CDN url_regex ^http:\/\/[.a-z0-9]*\.photobucket\.com.*\.[a-z]{3}$
acl store_rewrite_list_domain_CDN url_regex (khm|mt)[0-9]?.google.co(m|\.id) 
acl store_rewrite_list_domain_CDN url_regex streamate.doublepimp.com.*\.js\? \.doubleclick\.net.* yieldmanager cpxinteractive  quantserve\.com

acl dontrewrite url_regex yimg.com  redbot\.org (get_video|videoplayback\?id|videoplayback.*id).*begin\=[1-9][0-9]* \.php\? threadless.*\.jpg\?r=
acl getmethod method GET

storeurl_access deny dontrewrite
storeurl_access deny !getmethod

storeurl_access allow store_rewrite_list_domain_CDN
storeurl_access allow store_rewrite_list
storeurl_access allow store_rewrite_list_domain store_rewrite_list_path
storeurl_access deny all
storeurl_rewrite_program
/usr/local/squid/etc/storeurl.pl

##############################
# nilai penulisan ulang cache
##############################
storeurl_rewrite_children 5      # default squid ga perlu dirubah
storeurl_rewrite_concurrency 100 # klo nilai minimal 10 sampai 500,

max_stale 10 years
acl QUERY urlpath_regex -i \.(ini|ui|lst|inf|pak|ver|patch)$
acl QUERY urlpath_regex -i (dat.asp|afs.dat|notice.swf|patchlist.txt|hackshield|captcha|reset.css|update.ver|notice.html|updates.txt|gamenotice)
cache deny QUERY

##################
# refresh pattern
##################
refresh_pattern -i  \.(sc-|dl-|ex-|mh-|mst|dll)$                0  20% 0
refresh_pattern -i (main.exe|notice.html)$                      0  20% 0
refresh_pattern -i (livescore.com|UpdaterModifier.exe|FreeStyle.exe|FSLauncher.exe) 0  20% 0

refresh_pattern (get_video|videoplayback|videodownload|\.flv).*(begin|start)\=[1-9][0-9]*       0 0% 0
refresh_pattern imeem.*\.flv  0 0% 0  override-lastmod override-expire
refresh_pattern ^ftp: 40320     20%     40320   override-expire reload-into-ims store-stale
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (livescore.com|UpdaterModifier.exe|FreeStyle.exe|FSLauncher.exe) 0  20% 0

#speedtest
refresh_pattern .speedtest.* 0 60% 10 negative-ttl=0
refresh_pattern speedtest.*\.(jp(e?g|e|2)|tiff?|bmp|gif|png|swf|txt|js) 0 50% 180 store-stale negative-ttl=0

#ads
refresh_pattern ^.*safebrowsing.*google   131400 999999% 525600 override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth ignore-must-revalidate negative-ttl=10080 store-stale
refresh_pattern ^.*(streamate.doublepimp.com.*\.js\?|utm\.gif|ads\?|rmxads\.com|ad\.z5x\.net|bh\.contextweb\.com|bstats\.adbrite\.com|a1\.interclick\.com|ad\.trafficmp\.com|ads\.cubics\.com|ad\.xtendmedia\.com|\.googlesyndication\.com|advertising\.com|yieldmanager|game-advertising\.com|pixel\.quantserve\.com|adperium\.com|doubleclick\.net|adserving\.cpxinteractive\.com|syndication\.com|media.fastclick.net).* 5259487 20% 5259487 ignore-no-cache ignore-no-store ignore-private override-expire ignore-reload ignore-auth ignore-must-revalidate store-stale negative-ttl=40320 max-stale=1440

#antivirus
refresh_pattern avast.com.*\.vpx   40320 50% 525600 store-stale reload-into-ims
refresh_pattern (avgate|avira).*\.(idx|gz)$  1440 90% 1440  ignore-reload ignore-no-cache ignore-no-store store-stale ignore-must-revalidate
refresh_pattern kaspersky.*\.avc$  131400 999999% 525600 ignore-reload store-stale
refresh_pattern kaspersky  1440 50% 131400 ignore-no-cache store-stale
refresh_pattern .symantecliveupdate.com.*\.zip  1440 90% 131400 ignore-must-revalidate store-stale
refresh_pattern .update.nai.com/.*\.(gem|zip|mcs) 43800 999999% 43800   ignore-reload store-stale ignore-must-revalidate
refresh_pattern .symantec.com.*\(exe|zip) 43800 999999% 43800   ignore-reload store-stale  ignore-must-revalidate
refresh_pattern ^http://file.pb.gemscool.com.*\.zip 131400 999999% 131400 override-expire store-stale
refresh_pattern ^http:\/\/\.www[0-9][0-9]\.indowebster\.com\/(.*)(rar|mov|mkv|cab|flv|wmv|3gp|mp(4|3)|exe|msi|zip) 43200 99999% 129600 reload-into-ims  ignore-reload override-expire ignore-no-cache ignore-no-store  ignore-private  store-stale ignore-auth

#kaskus
refresh_pattern .kaskus.us.*\.(jpg|gif|png) 1440 60% 131400 override-expire store-stale

#fb
refresh_pattern -i .facebook.com.*.(jpg|gif|png|swf|wav|mp(e?g|a|e|1|2|3|4)|3gp|flv|swf|wmv|zip|rar) 12960 999999% 129600
refresh_pattern -i .fbcdn.net.*.(jpg|gif|png|swf|wav|mp(e?g|a|e|1|2|3|4)|3gp|flv|swf|wmv|zip|rar) 12960 999999% 129690
refresh_pattern -i .zynga.com.*.(jpg|gif|png|swf|wav|mp(e?g|a|e|1|2|3|4)|3gp|flv|swf|wmv) 12960 999999% 129609
refresh_pattern -i .crowdstar.com.*.(jpg|gif|png|swf|wav|mp(e?g|a|e|1|2|3|4)|3gp|flv|swf|wmv) 12960 999989% 129609
refresh_pattern ^http://static.ak.fbcdn.net*.(jpg|gif|png|mp(e?g|a|e|1|2|3|4)|3gp|flv|swf|wmv) 129600 999999% 129600
refresh_pattern ^http://videoxl.l[0-9].facebook.com/(.*)(3gp|flv|swf|wmv|mp(e?g|a|e|1|2|3|4)) 129600 999999% 129600
refresh_pattern ^http://*.channel.facebook.com/(.*)(js|css|swf|jpg|gif|png|mp(e?g|a|e|1|2|3|4)) 129600 999999% 129600
refresh_pattern ^http://video.ak.facebook.com*.(3gp|flv|swf|wmv|mp(e?g|a|e|1|2|3|4)) 129600 999999% 129600
refresh_pattern ^http://photos-[a-z].ak.fbcdn.net/(.*)(css|swf|jpg|gif|png|mp(e?g|a|e|1|2|3|4)) 129600 999999% 129600
refresh_pattern ^http://profile.ak.fbcdn.net*.(jpg|gif|png) 129600 999999% 129600
refresh_pattern ^http://platform.ak.fbcdn.net/.* 720 100% 4320
refresh_pattern ^http://creative.ak.fbcdn.net/.* 720 100% 4320
refresh_pattern ^http://apps.facebook.com/.* 720 100% 4320
refresh_pattern ^http://static.ak.fbcdn.net*.(js|css|jpg|gif|png) 129600 999999% 129600
refresh_pattern ^http://statics.poker.static.zynga.com/(.*)(swf|jpg|gif|png|mp(e?g|a|e|1|2|3|4)) 129600 999999% 129600
refresh_pattern ^http://statics.poker.static.zynga.com/.* 720 100% 4320
refresh_pattern ^http://*.zynga.com*.(swf|jpg|gif|png|wav|mp(e?g|a|e|1|2|3|4)) 129600 999999% 129600
refresh_pattern ^http://*.crowdstar.com*.(swf|jpg|gif|png|wav|mp(e?g|a|e|1|2|3|4)) 129600 999999% 129600

# files
refresh_pattern -i \.(flv|x-flv|mov|avi|qt|mpg|mpeg)$ 10080 50% 43200 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache  store-stale ignore-must-revalidate
refresh_pattern -i \.(swf|wav|mp3|mp4|au|mid)$ 10080 50% 43200 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-auth  store-stale ignore-must-revalidate
refresh_pattern -i \.(iso|deb|rpm|zip|tar|tgz|ram|rar|bin|ppt|doc)$ 10080 90% 43200 ignore-no-cache ignore-auth store-stale ignore-must-revalidate
refresh_pattern -i \.(zip|gz|arj|lha|lzh)$ 10080 100% 43200 override-expire ignore-no-cache ignore-auth  store-stale ignore-must-revalidate
refresh_pattern -i \.(rar|tgz|tar|exe|bin)$ 10080 100% 43200 override-expire ignore-no-cache ignore-auth store-stale ignore-must-revalidate
refresh_pattern -i \.(hqx|pdf|rtf|doc)$ 10080 100% 43200 override-expire ignore-no-cache ignore-auth store-stale ignore-must-revalidate
refresh_pattern -i \.(inc|cab|ad|txt|dll|dl)$ 10080 100% 43200 override-expire ignore-no-cache ignore-auth store-stale ignore-must-revalidate

#specific sites
refresh_pattern \.rapidshare.*\/[0-9]*\/.*\/[^\/]* 131400 90% 525600 ignore-reload store-stale
refresh_pattern ^http://v\.okezone\.com/get_video\/([a-zA-Z0-9]) 131400 999999% 43200 override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth override-lastmod ignore-must-revalidate negative-ttl=10080 store-stale
refresh_pattern (get_video\?|videoplayback\?|videodownload\?|\.flv?) 525600 99999999% 525600 override-expire ignore-reload ignore-no-cache ignore-must-revalidate ignore-private store-stale negative-ttl=0
refresh_pattern \.(ico|video-stats)  525600 999999% 525600 override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth override-lastmod ignore-must-revalidate negative-ttl=10080 store-stale
refresh_pattern \.etology\?   525600 999999% 525600 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern galleries\.video(\?|sz)   525600 999999% 525600 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern brazzers\?   525600 999999% 525600 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern \.adtology\? 525600 999999% 525600 override-expire ignore-reload ignore-no-cache store-stale

refresh_pattern ^http://((cbk|mt|khm|mlt)[0-9]?)\.google\.co(m|\.id) 131400 999999% 525600 override-expire ignore-reload store-stale ignore-private negative-ttl=10080
refresh_pattern ytimg\.com.*\.(jpg|png) 525600 999999% 525600 override-expire ignore-reload store-stale
refresh_pattern images\.friendster\.com.*\.(png|gif)  131400 999999% 525600 override-expire ignore-reload store-stale
refresh_pattern garena\.com  525600 999999% 525600 override-expire reload-into-ims store-stale
refresh_pattern photobucket.*\.(jp(e?g|e|2)|tiff?|bmp|gif|png)  525600 999999% 525600 override-expire ignore-reload store-stale
refresh_pattern vid\.akm\.dailymotion\.com.*\.on2\?  525600 999999% 525600 ignore-no-cache override-expire override-lastmod store-stale
refresh_pattern ^http:\/\/images|pics|thumbs[0-9]\.  131400 999999% 525600 ignore-no-cache ignore-no-store ignore-reload override-expire store-stale
refresh_pattern ^http:\/\/www.onemanga.com.*\/   525600 999999% 525600 reload-into-ims override-expire store-stale
refresh_pattern mediafire.com\/images.*\.(jp(e?g|e|2)|tiff?|bmp|gif|png)  131400 999999% 525600 reload-into-ims override-expire ignore-private store-stale
refresh_pattern  \.macromedia.com.*\.(z|exe|cab)  131400 999999%  525600 ignore-reload override-expire  store-stale

#general
refresh_pattern \.(jp(e?g|e|2)|tiff?|bmp|gif|png) 131400 999999% 525600 ignore-no-cache ignore-no-store reload-into-ims override-expire ignore-must-revalidate store-stale
refresh_pattern \.(z(ip|[0-9]{2})|r(ar|[0-9]{2})|jar|bz2|gz|tar|rpm|vpu)  131400 999999% 525600 override-expire ignore-no-cache reload-into-ims
refresh_pattern \.(mp3|wav|og(g|a)|flac|midi?|rm|aac|wma|mka|ape)   131400 999999% 525600 override-expire reload-into-ims ignore-reload
refresh_pattern \.(exe|msi|dmg|bin|xpi|iso|swf|mar|psf|cab|mar)  131400 999999% 525600 override-expire reload-into-ims ignore-no-store ignore-no-cache ignore-must-revalidate
refresh_pattern \.(mkv|mpeg|ra?m|avi|mp(g|e|4)|mov|divx|asf|wmv|m\dv|rv|vob|asx|ogm|flv|3gp|on2)  525600 9999999% 525600 ignore-must-revalidate ignore-private ignore-no-cache override-expire reload-into-ims
refresh_pattern -i (cgi-bin) 0 0% 0
refresh_pattern \.(php|jsp|cgi|asx)\? 0 0% 0
refresh_pattern . 0 50% 525600 store-stale

quick_abort_min 0
quick_abort_max 0
quick_abort_pct 75

negative_ttl 2 minutes

############
# shoutcast
############
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast

icp_hit_stale on
vary_ignore_expire on
header_access X-Forwarded-For deny all

server_http11 on

half_closed_clients off
shutdown_lifetime 10 seconds

###################
# email dan domain
###################
cache_mgr ghost.ch4ndr4ya@yahoo.co.id
visible_hostname cjmedia.net
unique_hostname cjmedia.net

cache_effective_user proxy
cache_effective_group proxy
cachemgr_passwd none all

###############################
# bandwidth manager delaypools
###############################
acl warnet src 192.168.1.0/24
acl wifi src 192.168.2.0/24
acl operator src 192.168.1.27
acl blok url_regex -i \.wmv \.mpg \.mpeg \.wma \.wav \.3gp \.3gpp \.avi \.dat \.acc \.ogg \.mp4 \.mp3 \.mov \.rar \.zip \.7z \.iso \.ace \.exe \.torrent \.mkv \.rm \.asf \.flv \.pdf \.doc \.docx \.odt \.xls \.ppt \.pps \.dll \.vob \.tmp \.bin \.m4a \.xpi \.bup \.thm \.dmg 
acl blokftp url_regex ftp -i \.wmv \.mpg \.mpeg \.wma \.wav \.3gp \.3gpp \.avi \.dat \.acc \.ogg \.mp4 \.mp3 \.mov \.rar \.zip \.7z \.iso \.ace \.exe \.torrent \.mkv \.rm \.asf \.flv \.pdf \.doc \.docx \.odt \.xls \.ppt \.pps \.dll \.vob \.tmp \.bin \.m4a \.xpi \.bup \.thm \.dmg 
acl webvideo dstdomain -i \.youtube.com \.facebook.com \.myspace.com \.aol.com \.metacafe.com \.dailymotion.com \.vimeo.com \.Video.bing.com \.blip.tv \.break.com \.redtube.com \.Xtube.com \.youporn.com \.tube8.com \.Wrzuta.p \.games.co.id \.girlsgogames.co.id \.barbie.com \.dressupdollgames.net \.playpink.com
acl striming url_regex -i get_video? video_id? videodownload? videoplayback?
cache allow webvideo
cache allow striming
acl mimeUpload req_mime_type ^application/octet-stream$

delay_pools 5

delay_class 1 1
delay_parameters 1 -1/-1
delay_access 1 allow operator warnet
delay_access 1 deny all

delay_class 2 3
delay_parameters 2 24000/100000 16000/100000 8000/100000
delay_access 2 allow blok warnet
delay_access 2 allow blok wifi
delay_access 2 deny all

delay_class 3 3
delay_parameters 3 24000/100000 16000/100000 8000/100000
delay_access 3 allow blokftp warnet
delay_access 3 allow blokftp wifi
delay_access 3 deny all

delay_class 4 3
delay_parameters 4 24000/100000 16000/100000 8000/100000
delay_access 4 allow striming webvideo warnet
delay_access 4 allow striming webvideo wifi
delay_access 4 deny all

delay_class 5 3
delay_parameters 5 48000/100000 24000/100000 8000/100000
delay_access 5 allow mimeUpload warnet
delay_access 5 allow mimeUpload wifi

##############
# snmp
##############
snmp_port 3401
acl snmppublic snmp_community public
snmp_access allow snmppublic all

############
# icp port
############
icp_port 0
log_icp_queries off
query_icmp on

icon_directory /usr/share/squid/icons
error_directory /usr/share/squid/errors/English

nonhierarchical_direct on
prefer_direct off

max_filedescriptors 8192

ipcache_size 8192
ipcache_low 98
ipcache_high 99
fqdncache_size 8192
################
# MISCELLANEOUS
################
memory_pools off
forwarded_for off
##################
# lusca proxy
##################
client_db on
reload_into_ims on
coredump_dir /var/spool/squid/
pipeline_prefetch on
high_page_fault_warning 2
n_aiops_threads 24
load_check_stopen on
load_check_stcreate on
download_fastest_client_speed on

Setelah itu buat file storeurl.pl dan copykan script di bawah

#!/usr/bin/perl
# rev date 02/04/2012

$|=1;
while (<>) {
@X = split;
#       $X[1] =~ s/&sig=.*//;
$x = $X[0] . " ";
$_ = $X[1];
$u = $X[1];

#photos-X.ak.fbcdn.net where X a-z
if (m/^http:\/\/photos-[a-z]?(.ak.fbcdn.net.*)/) {
print $x . "http://photos" . $1  . "\n";

# photo
} elsif (m/^http:\/\/photos-ash[1-5]?(.fbcdn.net.*)/) {
print $x . "http://ash.photos" . $1  . "\n";

#photos.ak.fbcdn.net where X i(0-9)
#a5.sphotos.ak.fbcdn.ne
} elsif (m/^http:\/\/[a-z][0-9]?.(sphotos.ak.fbcdn.net.*)/) {
print $x . "http://cdn.photos" . $1  . "\n";

#BLOGSPOT
} elsif (m/^http:\/\/[1-4].bp.(blogspot.com.*)/) {
print $x . "http://blog-cdn." . $1  . "\n";

#AVAST
} elsif (m/^http:\/\/download[0-9]{3}.(avast.com.*)/) {
print $x . "http://avast-cdn." . $1  .  "\n";

#KAV
} elsif (m/^http:\/\/dnl-[0-9]{2}.(geo.kaspersky.com.*)/) {
print $x . "http://kav-cdn." . $1  .  "\n";

#AVG
} elsif (m/^http:\/\/update.avg.com/) {
print $x . "http://avg-cdn." . $1  .  "\n";

#maps.google.com
} elsif (m/^http:\/\/(cbk|mt|khm|mlt|tbn)[0-9]?(.google\.co(m|\.uk|\.id).*)/) {
print $x . "http://" . $1  . $2 . "\n";

#gstatic and/or wikimapia
} elsif (m/^http:\/\/([a-z])[0-9]?(\.gstatic\.com.*|\.wikimapia\.org.*)/) {
print $x . "http://" . $1  . $2 . "\n";

#maps.google.com
} elsif (m/^http:\/\/(khm|mt)[0-9]?(.google.com.*)/) {
print $x . "http://" . $1  . $2 . "\n";

#ini untuk cache partial
} elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?(id=[a-zA-Z0-9]*).*?\&(range=[0-9]*).*/) {
print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $2 . $3 . "\n";

# compatibility for old cached get_video?video_id
} elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?(videoplayback\?id=.*?|video_id=.*?)\&(.*?)/) {
$z = $2; $z =~ s/video_id=/get_video?video_id=/;
print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $z . "\n";

# youtube All itag (semua resolusi)
} elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?(itag=[0-9]*).*?\&(id=[a-zA-Z0-9]*).*/) {
print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $2 . "&" . $3 . "\n";

# youtube All itag (semua resolusi) posisi kebalikan
} elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?(id=[a-zA-Z0-9]*).*?\&(itag=[0-9]*).*/) {
print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $3 . "&" . $2 . "\n";

#Google
} elsif (m/^http:\/\/www\.google-analytics\.com\/__utm\.gif\?.*/) {
print $x . "http://www.google-analytics.com/__utm.gif\n";

#Cache High Latency Ads
} elsif (m/^http:\/\/([a-z0-9.]*)(\.doubleclick\.net|\.quantserve\.com|\.googlesyndication\.com|yieldmanager|cpxinteractive)(.*)/) {
$y = $3;$z = $2;
for ($y) {
s/pixel;.*/pixel/;
s/activity;.*/activity/;
s/(imgad[^&]*).*/\1/;
s/;ord=[?0-9]*//;
s/;&timestamp=[0-9]*//;
s/[&?]correlator=[0-9]*//;
s/&cookie=[^&]*//;
s/&ga_hid=[^&]*//;
s/&ga_vid=[^&]*//;
s/&ga_sid=[^&]*//;
# s/&prev_slotnames=[^&]*//
# s/&u_his=[^&]*//;
s/&dt=[^&]*//;
s/&dtd=[^&]*//;
s/&lmt=[^&]*//;
s/(&alternate_ad_url=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
s/(&url=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
s/(&ref=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
s/(&cookie=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
s/[;&?]ord=[?0-9]*//;
s/[;&]mpvid=[^&;]*//;
s/&xpc=[^&]*//;
# yieldmanager
s/\?clickTag=[^&]*//;
s/&u=[^&]*//;
s/&slotname=[^&]*//;
s/&page_slots=[^&]*//;
}
print $x . "http://" . $1 . $2 . $y . "\n";

#cache high latency ads
} elsif (m/^http:\/\/(.*?)\/(ads)\?(.*?)/) {
print $x . "http://" . $1 . "/" . $2  . "\n";

} elsif (m/^http:\/\/(www\.ziddu\.com.*\.[^\/]{3,4})\/(.*?)/) {
print $x . "http://" . $1 . "\n";

#cdn, varialble 1st path
} elsif (($u =~ /filehippo/) && (m/^http:\/\/(.*?)\.(.*?)\/(.*?)\/(.*)\.([a-z0-9]{3,4})(\?.*)?/)) {
@y = ($1,$2,$4,$5);
$y[0] =~ s/[a-z0-9]{2,5}/cdn./;
print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";

#rapidshare
} elsif (($u =~ /rapidshare/) && (m/^http:\/\/(([A-Za-z]+[0-9-.]+)*?)([a-z]*\.[^\/]{3}\/[a-z]*\/[0-9]*)\/(.*?)\/([^\/\?\&]{4,})$/)) {
print $x . "http://cdn." . $3 . "/SQUIDINTERNAL/" . $5 . "\n";

} elsif (($u =~ /maxporn/) && (m/^http:\/\/([^\/]*?)\/(.*?)\/([^\/]*?)(\?.*)?$/)) {
print $x . "http://" . $1 . "/SQUIDINTERNAL/" . $3 . "\n";

#domain/path/.*/path/filename
} elsif (($u =~ /fucktube/) && (m/^http:\/\/(.*?)(\.[^\.\-]*?[^\/]*\/[^\/]*)\/(.*)\/([^\/]*)\/([^\/\?\&]*)\.([^\/\?\&]{3,4})(\?.*?)$/)) {
@y = ($1,$2,$4,$5,$6);
$y[0] =~ s/(([a-zA-A]+[0-9]+(-[a-zA-Z])?$)|([^\.]*cdn[^\.]*)|([^\.]*cache[^\.]*))/cdn/;
print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "/" . $y[3] . "." . $y[4] . "\n";

#like porn hub variables url and center part of the path, filename etention 3 or 4 with or without ? at the end
} elsif (($u =~ /tube8|pornhub|xvideos/) && (m/^http:\/\/(([A-Za-z]+[0-9-.]+)*?(\.[a-z]*)?)\.([a-z]*[0-9]?\.[^\/]{3}\/[a-z]*)(.*?)((\/[a-z]*)?(\/[^\/]*){4}\.[^\/\?]{3,4})(\?.*)?$/)) {
print $x . "http://cdn." . $4 . $6 . "\n";

#for yimg.com video
} elsif (m/^http:\/\/(.*yimg.com)\/\/(.*)\/([^\/\?\&]*\/[^\/\?\&]*\.[^\/\?\&]{3,4})(\?.*)?$/) {
print $x . "http://cdn.yimg.com/" . $3 . "\n";

#for yimg.com doubled
} elsif (m/^http:\/\/(.*?)\.yimg\.com\/(.*?)\.yimg\.com\/(.*?)\?(.*)/) {
print $x . "http://cdn.yimg.com/"  . $3 . "\n";

#for yimg.com with &sig=
} elsif (m/^http:\/\/([^\.]*)\.yimg\.com\/(.*)/) {
@y = ($1,$2);
$y[0] =~ s/[a-z]+([0-9]+)?/cdn/;
$y[1] =~ s/&sig=.*//;
print $x . "http://" . $y[0] . ".yimg.com/"  . $y[1] . "\n";

#youjizz. We use only domain and filename
} elsif (($u =~ /media[0-9]{1,5}\.youjizz/) && (m/^http:\/\/(.*?)(\.[^\.\-]*?\.[^\/]*)\/(.*)\/([^\/\?\&]*)\.([^\/\?\&]{3,4})(\?.*?)$/)) {
@y = ($1,$2,$4,$5);
$y[0] =~ s/(([a-zA-A]+[0-9]+(-[a-zA-Z])?$)|([^\.]*cdn[^\.]*)|([^\.]*cache[^\.]*))/cdn/;
print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";

#general purpose for cdn servers. add above your specific servers.
} elsif (m/^http:\/\/([0-9.]*?)\/\/(.*?)\.(.*)\?(.*?)/) {
print $x . "http://squid-cdn-url/" . $2  . "." . $3 . "\n";

# spicific extention
# } elsif (m/^http:\/\/(.*?)\.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv|wmv|3gp|mp(4|3)|exe|msi|zip|on2|mar|swf).*?/) {
# @y = ($1,$2);
# $y[0] =~ s/((cache|cdn)[-\d]*)|([a-zA-A]+-?[0-9]+(-[a-zA-Z]*)?)/cdn/;
# print $x . "http://" . $y[0] . "." . $y[1] . "\n";

#generic http://variable.domain.com/path/filename."ex", "ext" or "exte"
#http://cdn1-28.projectplaylist.com
#http://s1sdlod041.bcst.cdn.s1s.yimg.com
} elsif (m/^http:\/\/(.*?)(\.[^\.\-]*?\..*?)\/([^\?\&\=]*)\.([\w\d]{2,4})\??.*$/) {
@y = ($1,$2,$3,$4);
$y[0] =~ s/([a-z][0-9][a-z]dlod[\d]{3})|((cache|cdn)[-\d]*)|([a-zA-A]+-?[0-9]+(-[a-zA-Z]*)?)/cdn/;
print $x . "storeurl://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";

# all that ends with ;
} elsif (m/^http:\/\/(.*?)\/(.*?)\;(.*)/) {
print $x . "http://" . $1 . "/" . $2  . "\n";

} else {
print $x . $_ . "\n";
}
}

untuk file squid.conf dan storeurl.pl jika anda punya yg lebih baik silakan gunakan milik anda
kembali lagi ke…… PUTTY copas perintah berikut satu-satu:

#cd /usr/local/squid/etc/

#mkdir /cache1

#mkdir /cache2
#mkdir /cache3
#chown squid:squid /cache*
#chmod 777 squid.conf storeurl.pl

/usr/local/squid/sbin/squid -k parse
/usr/local/squid/sbin/squid -z
/usr/local/squid/sbin/squid -NDd1 &

jika tampil tulisan : Finished rebuilding storage from disk.
bla.. bla.. bla
bla.. bla.. bla

storeLateRelease: released 0 objects.

artinya lusca berhasil ditanamkan di server anda..tutup putty

kembali lagi ke… WINSCP :

    masuk ke direktori  /etc/rc.d
    buka file : rc.local
    hapus semua dan gantikan dengan script dibawah ini:
   
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/usr/local/squid/sbin/squid -NDd1 &
# This file is executed by the firewall on stop/start/restart.
Simpan, tutup.
 

Masuk ke folder : /etc Buka file : firewall Cari baris berikut :
# Squid configuration
#--------------------------
SQUID_TRANSPARENT="" ( ganti menjadi ) SQUID_TRANSPARENT="on"
SQUID_FILTER_PORT="" ( ganti menjadi ) SQUID_FILTER_PORT="3128"
Simpan, tutup.

tambahkan ini di squid.conf
 

http_port 3128 transparent

Masukkan ini ke /etc/rc.d/rc.firewall.local

iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
Perhatikan eth mana yg anda gunakan untuk lan, jangan asal copas

Restart firewallnya lewat Putty
#service firewall restart

Silakan di coba proxynya test dengan buka utube bebas play sampai finish lalu browser terus buka kembali alamat yang tadi sudah di buka atau bisa gunakan pc lain untuk melihat effeknya
Harusnya Lusca sudah jalan dan jika sudah bener2 jalan restart server untuk memastikan bahwa proxy anda dah bener2 aktif

untuk pengaturan delaypool dapat anda gunakan delaypool yang lama (makanya sebelum instal lusca, squid.conf yang lama wajib di backup), anda bisa menggunakan setingan lama, silahkan oprek  squid.conf anda sampai HIT semua

Tuts ini dulu hasil belajar dari forum clearos indonesia dah lupa tut nya siapa saja dulu yang sempat aq pelajari. 



Untuk senjata tambahan : kadang anda memerlukan ini
1.) Untuk Startup Squid Manual:    
/usr/local/squid/sbin/squid -NDd1 &

2.) Untuk meng reconfigurasi squid, apabila habis di edit squid.conf nya:
/usr/local/squid/sbin/squid -k reconfigure

3.) Melihat aktifitas user:
tail -f /cache1/access.log

4.) Melihat persentase HIT Ratio:
/usr/local/squid/bin/squidclient -p 3128 mgr:info|grep Hit

5.) Untuk matiin squid:
/usr/local/squid/sbin/squid -k shutdown

6.) Untuk mengoreksi configurasi squid.conf:
/usr/local/squid/sbin/squid -k parse

Untuk mengaktifkan kembali content filter:
yum install adzapper app-dansguardian-av app-squid app-squid-acl dansguardian-av

menghilangkan tanda pagar '#'
#cat /etc/squid/squid.conf | sed '/ *#/d; /^ *$/d'
jika ingin memindahkan kedalam file yang baru bisa juga dengan command berikut ini:
#cat /etc/squid/squid.conf | sed '/ *#/d; /^ *$/d' > /etc/squid/squid.conf.bck


Jika ada kesalahan dalam tutorial ini mohon di koreksi sendiri ya, untuk hasil yg bagus sebelum anda copas perintahnya sebaiknya di teliti dulu apakah perintah dah bener apa belum
 
sumber :  http://cozycornernet.blogspot.com/2012/11/install-proxy-lusca-di-clearos.html
Share :

Komentar Facebook:

iklan banner iklan banner iklan banner iklan banner

Artikel Terbaru

Recent Posts
Histats.com