Advertisement
sukriborneo

tutor install squid 3.5.xxx di ubuntu

Nov 5th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. apt-get update
  2. apt-get install build-essential devscripts libcppunit-dev openssl libssl-dev libcap-dev libsasl2-dev ccze pkg-config libkrb5-dev apache2 php5 -y
  3. ### install pake ecap seperti http://pastebin.com/G8sUCy6h
  4. cd
  5. wget http://www.squid-cache.org/Versions/v3/3.5/squid-3.5.20-20160724-r14069.tar.gz
  6. tar xzvf squid-3.5.20-20160724-r14069.tar.gz
  7. wget -O squid_forgery.patch http://www.squid-cache.org/mail-archive/squid-users/201404/att-0240/squid_forgery.patch.txt
  8. cd squid-3.5.20-20160724-r14069
  9. patch -p0 <../squid_forgery.patch
  10. ### configure squid http://pastebin.com/YJxDf02h
  11. make
  12. make install
  13. chown -R nobody /var/log/squid
  14. chown -R nobody /cache
  15. mkdir -p /etc/squid/ssl_cert
  16. openssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout /etc/squid/ssl_cert/warnet.pem -out /etc/squid/ssl_cert/warnet.pem -subj "/C=ID/ST=Jawa Tengah/L=Semarang/O=TSI/CN=Terapi Squid Indonesia"
  17. openssl x509 -in /etc/squid/ssl_cert/warnet.pem -outform DER -out /etc/squid/ssl_cert/warnet.der
  18. openssl x509 -in /etc/squid/ssl_cert/warnet.pem -outform DER -out /etc/squid/ssl_cert/warnet.crt
  19. /usr/lib/squid/ssl_crtd -c -s /var/lib/ssl_db
  20. chown -R nobody /var/lib/ssl_db
  21.  
  22. ### awal squid.conf, jangan ditulis ###
  23. # Recommended minimum configuration:
  24. # sesuaikan ukuran cache
  25. # sesuaikan ip address
  26. # script squid.conf untuk non-range 360p
  27.  
  28. # Example rule allowing access from your local networks.
  29. # Adapt to list your (internal) IP networks from where browsing
  30. # should be allowed
  31. dns_v4_first on
  32. reply_header_access Alternate-Protocol deny all
  33. reply_header_access Alt-Svc deny all
  34.  
  35. #cache_dir aufs /cache 700000 16 256
  36. cache_dir aufs /cache 360000 1 1
  37. cache_mem 8 MB
  38. coredump_dir /var/log/squid
  39.  
  40. cache_swap_low 80
  41. cache_swap_high 85
  42. cache_replacement_policy heap LFUDA
  43. memory_replacement_policy heap GDSF
  44.  
  45. maximum_object_size 4096000 KB
  46. maximum_object_size_in_memory 0 KB
  47. request_body_max_size 0 KB
  48. refresh_all_ims on
  49. reload_into_ims on
  50.  
  51. visible_hostname cespun-proxy
  52. strip_query_terms off
  53. httpd_suppress_version_string on
  54. log_mime_hdrs off
  55. forwarded_for off
  56. via off
  57.  
  58. request_header_access X-Forwarded-For deny all
  59. reply_header_access X-Forwarded-For deny all
  60. request_header_access Via deny all
  61. reply_header_access Via deny all
  62. max_filedescriptors 65536
  63.  
  64. cache_swap_high 98
  65. cache_swap_low 95
  66. fqdncache_size 4096
  67. ipcache_size 4096
  68. dns_nameservers 208.67.222.222 208.67.220.220
  69.  
  70. http_port 3128
  71. #http_port 3127 ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/etc/squid/ssl_cert/warnet.pem
  72. #http_port 3129 intercept
  73. #https_port 3127 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/etc/squid/ssl_cert/warnet.pem
  74. http_port 3129 tproxy
  75. https_port 3127 tproxy ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/etc/squid/ssl_cert/warnet.pem
  76.  
  77. qos_flows local-hit=0x30
  78.  
  79. acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
  80. acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
  81. acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
  82. acl localnet src fc00::/7 # RFC 4193 local private network range
  83. acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
  84. acl SSL_ports port 443
  85. acl Safe_ports port 80 # http
  86. acl Safe_ports port 182 # http
  87. acl Safe_ports port 21 # ftp
  88. acl Safe_ports port 443 # https
  89. acl Safe_ports port 70 # gopher
  90. acl Safe_ports port 210 # wais
  91. acl Safe_ports port 1025-65535 # unregistered ports
  92. acl Safe_ports port 280 # http-mgmt
  93. acl Safe_ports port 488 # gss-http
  94. acl Safe_ports port 591 # filemaker
  95. acl Safe_ports port 777 # multiling http
  96.  
  97. acl step1 at_step SslBump1
  98. acl step2 at_step SslBump2
  99. acl step3 at_step SslBump3
  100. #acl sslserver ssl::server_name_regex -i "/etc/squid/bypass.txt"
  101. #acl iphone browser -i regexp (iPhone|iPad)
  102. #acl BB browser -i regexp (BlackBerry|PlayBook)
  103. #acl Winphone browser -i regexp (Windows.*Phone|Trident|IEMobile)
  104. #acl Android browser -i regexp Android
  105. acl yt-modif url_regex -i ^https?\:\/\/www\.youtube\.com\/(watch\?v|embed|v)
  106. acl youtube url_regex -i ^http.*(youtube|googlevideo|videoplayback|videogoodput)
  107. acl versipatch url_regex -i ^http.*(update|patch).*versi
  108. acl versipatch url_regex -i ^http.*versi.*(update|patch)
  109. acl versipatch url_regex -i ^http.*(antihack|xigncode|gameguard)
  110. #acl patchpartial url_regex -i ^http.*(garena|gemscool|netmarble|valve|dota|winnerinter|lytogame|megaxus).*patch
  111. #acl patchpartial url_regex -i ^http.*patch.*(garena|gemscool|netmarble|valve|dota|winnerinter|lytogame|megaxus)
  112. acl patchpartial url_regex -i ^http.*patch.*garena
  113. acl patchpartial url_regex -i ^http.*garena.*patch
  114. acl httptomiss http_status 302
  115. acl mimehtml rep_mime_type -i mime-type ^text/html
  116. acl mimeplain rep_mime_type -i mime-type ^text/plain
  117. acl tostoreid url_regex -i ^http.*(youtube|googlevideo|videoplayback|videogoodput)
  118. acl tostoreid url_regex -i ^http.*(fbcdn|akamaihd)
  119. acl tostoreid url_regex -i ^http.*c2lo\.reverbnation\.com\/audio_player\/ec_stream_song\/.*\?
  120. acl tostoreid url_regex -i ^http.*\.c\.android\.clients\.google\.com\/market\/GetBinary\/GetBinary\/.*\/.*\?
  121. acl tostoreid url_regex -i ^http.*datafilehost.*\/get\.php.*file\=.*
  122. acl tostoreid url_regex -i ^http.*\.filehippo\.com\/.*\?
  123. acl tostoreid url_regex -i ^http.*\.4shared\.com\/.*\/.*\/.*\/dlink.*preview.mp3
  124. acl tostoreid url_regex -i ^http.*\.4shared\.com\/download\/.*\/.*\?tsid
  125. acl tostoreid url_regex -i ^http.*steam(powered|content)
  126. acl tostoreid url_regex -i ^http.*savefile\.co\:182\/.*\/.*\.(mp4|flv|3gp)
  127. acl tostoreid url_regex -i ^http.*video\-http\.media\-imdb\.com\/.*\.mp4\?
  128. acl tostoreid url_regex -i ^http.*\.dl\.sourceforge\.net
  129. #acl tostoreid url_regex -i ^http.*(speedtest|espeed).*\/.*\.(jpg|txt)
  130. acl speedtest url_regex -i ^http.*(speedtest|espeed).*\/(latency|upload|random.*)\.(jpg|txt|php)
  131. acl CONNECT method CONNECT
  132. acl getmethod method GET
  133.  
  134. http_access deny !Safe_ports
  135. http_access deny CONNECT !SSL_ports
  136. http_access allow localhost manager
  137. http_access deny manager
  138. http_access allow localnet
  139. http_access allow localhost
  140. http_access deny all
  141.  
  142. request_header_access Range deny !patchpartial
  143. #range_offset_limit 128 KB !patchpartial
  144. range_offset_limit none patchpartial
  145. quick_abort_min 1 KB
  146. quick_abort_max 1 KB
  147. quick_abort_pct 95
  148.  
  149. #request_header_access User-Agent deny yt-modif !iphone !BB !Winphone !Android
  150. ### flash
  151. #request_header_replace User-Agent Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14
  152. ### flash
  153. #request_header_replace User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14
  154. ###html5
  155. #request_header_replace User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
  156. ###html5
  157. #request_header_replace user_Agent Mozilla/5.0 (Windows NT 5.1; rv:35.0) Gecko/20100101 Firefox/35.0
  158. #request_header_replace Mozilla/6.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:2.0.0.0) Gecko/20061028 Firefox/3.0
  159.  
  160. cache deny versipatch
  161. cache deny localhost
  162. ssl_bump splice localhost
  163. #ssl_bump splice sslserver
  164. ssl_bump peek step1 all
  165. ssl_bump bump step2 all
  166. ssl_bump splice step3 all
  167.  
  168.  
  169.  
  170. sslcrtd_program /usr/lib/squid/ssl_crtd -s /var/lib/ssl_db -M 4MB
  171. sslcrtd_children 2000 startup=30 idle=1
  172. sslproxy_capath /etc/squid/ssl_cert
  173. sslproxy_cert_error allow all
  174. sslproxy_flags DONT_VERIFY_PEER
  175. sslproxy_flags NO_SESSION_REUSE
  176. ssl_unclean_shutdown on
  177. sslproxy_options NO_SSLv2,NO_SSLv3,SINGLE_ECDH_USE #Jika menggunakan versi setelah squid-3.5.12-20151222-r13967
  178. #sslproxy_options NO_SSLv2,NO_SSLv3
  179. sslproxy_cipher EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:HIGH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS
  180.  
  181. #debug_options 11,2 22,3
  182. logfile_rotate 1
  183. #logformat referer %ts.%03tu %>a %{Referer}>h %ru
  184. #logformat referer %ts.%03tu %>a %ru %{Referer}>h
  185. #logformat referer %ts.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %[un %Sh/%<a %mt %{Referer}>h %{User-Agent}>h
  186. #access_log /var/log/squid/access.log !CONNECT
  187. #access_log /var/log/squid/connect.log CONNECT
  188. #cache_store_log /var/log/squid/store.log
  189. access_log stdio:/var/log/squid/access.log
  190. netdb_filename none
  191.  
  192.  
  193. #ecap
  194. #yt_quality: tiny = 144px small = 240px medium = 360px large = 480px HD720 = Hd720px
  195. loadable_modules /usr/local/lib/ecap_adapter_modifying.so
  196. ecap_enable on
  197. request_header_access Accept-Encoding deny yt-modif
  198. ecap_service modif respmod_precache uri=ecap://e-cap.org/ecap/services/sample/modifying victim="enablejsapi" replacement="dash":"0","vq":"medium","enablejsapi"
  199. #ecap_service modif respmod_precache uri=ecap://e-cap.org/ecap/services/sample/modifying victim="enablejsapi" replacement="dash":"1","vq":"tiny","enablejsapi"
  200. #ecap_service modif respmod_precache uri=ecap://e-cap.org/ecap/services/sample/modifying victim="enablejsapi" replacement="vq":"small","enablejsapi"
  201. adaptation_access modif allow yt-modif
  202. adaptation_access modif deny all
  203.  
  204. cache deny speedtest
  205. url_rewrite_access allow speedtest
  206. url_rewrite_access deny all
  207. url_rewrite_program /etc/squid/speedtest.pl
  208. redirector_bypass on
  209. cache_peer 10.212.212.212 parent 8033 0 no-digest no-tproxy
  210. dead_peer_timeout 5 seconds
  211. cache_peer_access 10.212.212.212 allow speedtest
  212. cache_peer_access 10.212.212.212 deny all
  213. always_direct deny speedtest
  214. never_direct allow speedtest
  215. url_rewrite_children 2000 startup=30 idle=1
  216.  
  217. store_id_bypass off
  218. store_id_extras "%{Referer}>h"
  219. store_id_program /etc/squid/storeid.pl
  220. store_id_children 2000 startup=30 idle=1
  221. store_id_access deny !getmethod
  222. store_id_access allow tostoreid
  223. store_id_access deny all
  224.  
  225. store_miss deny youtube httptomiss
  226. send_hit deny youtube httptomiss
  227. store_miss deny youtube mimeplain
  228. send_hit deny youtube mimeplain
  229. store_miss deny mimehtml
  230. send_hit deny mimehtml
  231. store_miss deny versipatch
  232. send_hit deny versipatch
  233.  
  234. refresh_pattern -i . 432000 100% 432000 override-expire override-lastmod reload-into-ims refresh-ims ignore-no-store ignore-must-revalidate ignore-private ignore-auth store-stale
  235. max_stale 1 day
  236. ### akhir squid.conf, jangan ditulis ###
  237.  
  238. ### awal storeid.pl , jangan ditulis ###
  239. #!/usr/bin/perl
  240. #
  241. # storeid.pl with debug opt - based on storeurl.pl
  242. # @ http://www2.fh-lausitz.de/launic/comp/misc/squid/projekt_youtube/
  243. # referensi dan terimakasih khususnya pada Mr. Syaifudin JW aka Ucok Karnadi
  244.  
  245. use IO::File;
  246. $|=1;
  247. STDOUT->autoflush(1);
  248. $debug=1; ## recommended:0
  249. $bypassallrules=0; ## recommended:0
  250. $sucks=""; ## unused
  251. $sucks="sucks" if ($debug>=1);
  252. $timenow="";
  253. $printtimenow=1; ## print timenow: 0|1
  254. my $logfile = '/var/log/squid/storeid.log';
  255.  
  256. open my $logfh, '>>', $logfile
  257. or die "Couldn't open $logfile for appending: $!\n" if $debug;
  258. $logfh->autoflush(1) if $debug;
  259.  
  260. while (<>) {
  261. $timenow=time()." " if ($printtimenow);
  262. print $logfh "$timenow"."in : input=$_" if ($debug>=1);
  263.  
  264. @X = split;
  265. if ($X[0] =~ m/^http.*/) {
  266. $url = $X[0];
  267. $referer = $X[1];
  268. $urlreferer = $X[0] ." ". $X[1];
  269. } else {
  270. $chanel = $X[0];
  271. $url = $X[1];
  272. $referer = $X[2];
  273. $urlreferer = $X[1] ." ". $X[2];
  274. }
  275.  
  276.  
  277.  
  278.  
  279. if ($bypassallrules){
  280. $out="$url"; ## map 1:1
  281.  
  282. #youtube googlevideo
  283. } elsif ($url =~ m/^https?\:\/\/.*google.*video(playback|goodput).*/){
  284. @cpn = m/[=%&?\/]cpn[=%&?\/]([^\&\s]*)/;
  285. @id = m/[=%&?\/]id[=%&?\/]([^\&\s]*)/;
  286. @itag = m/[=%&?\/]itag[=%&?\/]([\d]*)/;
  287. @range = m/[=%&?\/]range[=%&?\/]([\d]*-[\d]*)/;
  288. @mime = m/[=%&?\/]mime[=%&?\/]([^\&\s]*)/;
  289. if ($referer =~ m/^https?\:\/\/www\.youtube\.com\/(watch\?v|embed|v)[=%&?\/]([^\&\s\?]*)/){
  290. @id = $2;
  291. } else {
  292. if (defined(@cpn[0])){
  293. if (-e "/tmp/@cpn"){
  294. open FILE, "/tmp/@cpn";
  295. @id = <FILE>;
  296. close FILE;
  297. }
  298. }
  299. }
  300. $out="OK store-id=http://squid/google/video/id=@id/itag=@itag/mime=@mime/range=@range";
  301.  
  302. #youtube parameter
  303. } elsif (
  304. ($url =~ m/^https?\:\/\/.*youtube.*(stream_204|watchtime|qoe|atr|csi_204|playback).*[=%&?\/]docid[=%&?\/]([^\&\s]*)/) ||
  305. ($url =~ m/^https?\:\/\/.*youtube.*(ptracking|set_awesome).*[=%&?\/]video_id[=%&?\/]([^\&\s]*)/) ||
  306. ($url =~ m/^https?\:\/\/.*youtube.*(player_204).*[=%&?\/]v[=%&?\/]([^\&\s]*)/)
  307. ){
  308. @id = $2;
  309. @cpn = m/[=%&?\/]cpn[=%&?\/]([^\&\s]*)/;
  310. if ($referer !~ m/^https?\:\/\/www\.youtube\.com\/(watch\?v|embed|v)[=%&?\/]([^\&\s\?]*)/){
  311. unless (-e "/tmp/@cpn"){
  312. open FILE, ">/tmp/@cpn";
  313. print FILE @id;
  314. close FILE;
  315. }
  316. }
  317. $out = "ERR";
  318.  
  319. #utmgif
  320. } elsif ($url =~ m/^https?\:\/\/www\.google-analytics\.com\/__utm\.gif\?.*/) {
  321. $out="OK store-id=http://squid/google-analytics/__utm.gif";
  322.  
  323. #fbcdn.net or akamaihd.net video range
  324. } elsif ($url =~ m/^https?\:\/\/.*(fbcdn\.net|akamaihd\.net).*\/([\w-]+\.[\w]{2,4}).*(bytestart[=%&?\/][\d]+[&\/]byteend[=%&?\/][\d]+)/) {
  325. $out="OK store-id=http://squid/$1/$2/$3";
  326.  
  327. #fbcdn.net or akamaihd.net with size
  328. } elsif ($url =~ m/^https?\:\/\/.*(fbcdn\.net|akamaihd\.net).*\/([a-zA-Z][\d]+[x][\d]+\/[\w-]+\.[\w]{2,4})($|\?)/) {
  329. $out="OK store-id=http://squid/$1/$2";
  330.  
  331. #fbcdn.net or akamaihd.net safe_image.php
  332. } elsif ($url =~ m/^https?\:\/\/.*(fbcdn\.net|akamaihd\.net).*\/safe_image\.php\?(.*)/) {
  333. $out="OK store-id=http://squid/$1/$2";
  334.  
  335. #reverbnation
  336. } elsif ($url =~ m/^https?\:\/\/c2lo\.reverbnation\.com\/audio_player\/ec_stream_song\/(.*)\?.*/) {
  337. $out="OK store-id=http://squid/reverbnation/$1";
  338.  
  339. #playstore
  340. } elsif ($url =~ m/^https?\:\/\/.*\.c\.android\.clients\.google\.com\/market\/GetBinary\/GetBinary\/(.*\/.*)\?.*/) {
  341. $out="OK store-id=http://squid/android/market/$1";
  342.  
  343.  
  344. #filehost
  345. } elsif ($url =~ m/^https?\:\/\/.*datafilehost.*\/get\.php.*file\=(.*)/) {
  346. $out="OK store-id=http://squid/datafilehost/$1";
  347.  
  348.  
  349. #speedtest
  350. } elsif ($url =~ m/^https?\:\/\/.*(speedtest|espeed).*\/(.*\.(txt|jpg)).*/) {
  351. $out="OK store-id=http://squid/speedtest/$2";
  352.  
  353.  
  354. #filehippo
  355. } elsif ($url =~ m/^https?\:\/\/.*\.filehippo\.com\/.*\/([\w-]+\.[\w]{2,4})\?.*/) {
  356. $out="OK store-id=http://squid/filehippo/$1";
  357.  
  358.  
  359. #4shared preview.mp3
  360. } elsif ($url =~ m/^https?\:\/\/.*\.4shared\.com\/.*\/(.*\/.*)\/dlink.*preview.mp3/) {
  361. $out="OK store-id=http://squid/4shared/preview/$1";
  362.  
  363. #4shared
  364. } elsif ($url =~ m/^https?\:\/\/.*\.4shared\.com\/download\/(.*\/.*)\?tsid.*/) {
  365. $out="OK store-id=http://squid/4shared/download/$1";
  366.  
  367. #savefile-animeindo.tv
  368. } elsif ($url =~ m/^https?:\/\/www\.savefile\.co\:182\/.*\/(.*\.(mp4|flv|3gp)).*/) {
  369. $out="OK store-id=http://squid/savefile:182/$1";
  370.  
  371. #imdb
  372. } elsif ($url =~ m/^https?\:\/\/video\-http\.media\-imdb\.com\/(.*\.mp4)\?.*/) {
  373. $out="OK store-id=http://squid/imdb/$1";
  374.  
  375. #sourceforge
  376. } elsif ($url =~ m/^https?\:\/\/.*\.dl\.sourceforge\.net\/([\w-]+\.[\w]{2,3})/) {
  377. $out="OK store-id=http://squid/sourceforge/$1";
  378.  
  379.  
  380. #steampowered dota 2
  381. #} elsif ($url =~ m/^https?\:\/\/.*(steam(powered|content).*\/(client|depot)\/[\d]+\/(chunk|manifest)\/[^\?\s]*).*/) {
  382. # $out="OK store-id=http://squid/$1";
  383.  
  384. #steampowered dota 2
  385. } elsif ($url =~ m/^https?\:\/\/.*steam(powered|content).*\/((client|depot)\/[\d]+\/(chunk|manifest)\/[^\?\s]*).*/) {
  386. $out="OK store-id=http://squid/steam/content-powered/$2";
  387.  
  388. } else {
  389. $out="ERR";
  390. }
  391.  
  392. if ($X[0] =~ m/^http.*/) {
  393. print $logfh "$timenow"."in : url=$urlreferer\n" if ($debug>=1);
  394. print $logfh "$timenow"."out: $out\n" if ($debug>=1);
  395. print $logfh "\n" if ($debug>=1);
  396. print "$out\n";
  397. } else {
  398. print $logfh "$timenow"."in : chanel=$chanel url=$urlreferer\n" if ($debug>=1);
  399. print $logfh "$timenow"."out: chanel=$chanel $out\n" if ($debug>=1);
  400. print $logfh "\n" if ($debug>=1);
  401. print "$chanel $out\n";
  402. }
  403. }
  404. close $logfh if ($debug);
  405. #### akhir script storeid.pl, jangan ditulis ###
  406.  
  407. ### awal speedtest.pl, jangan ditulis ###
  408. #!/usr/bin/perl
  409.  
  410. $|=1;
  411. while (<>) {
  412. @X = split;
  413. if ($X[0] =~ m/^http.*/) {
  414. $url = $X[0];
  415. $referer = $X[1];
  416. $urlreferer = $X[0] ." ". $X[1];
  417. } else {
  418. $chanel = $X[0];
  419. $url = $X[1];
  420. $referer = $X[2];
  421. $urlreferer = $X[1] ." ". $X[2];
  422. }
  423.  
  424. if ($url=~ m/^https?\:\/\/.*(speedtest|espeed).*\/((latency|upload|random.*)\.(jpg|txt|php))/) {
  425. $out="OK rewrite-url=http://10.212.212.212:8033/speedtest/$2";
  426. } else {
  427. $out="ERR";
  428. }
  429.  
  430. if ($X[0] =~ m/^http.*/) {
  431. print "$out\n";
  432. } else {
  433. print "$chanel $out\n";
  434. }
  435. }
  436. ### akhir speedtest.pl, jangan ditulis ###
  437.  
  438. chmod +x /etc/squid/squid.conf
  439. chmod +x /etc/squid/storeid.pl
  440. chmod +x /etc/squid/speedtest.pl
  441. squid -zN
  442. wget --no-check-certificate -O /etc/init.d/squid https://gist.githubusercontent.com/e7d/1f784339df82c57a43bf/raw/squid.sh
  443. chmod +x /etc/init.d/squid
  444. update-rc.d squid defaults
  445. service squid start
  446. ### edit isi /etc/rc.local, tambahkan baris berikut :
  447. ### awal penambahan di rc.local, jangan ditulis ###
  448. iptables -t mangle -N DIVERT
  449. iptables -t mangle -A DIVERT -j MARK --set-mark 1
  450. iptables -t mangle -A DIVERT -j ACCEPT
  451. iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
  452. iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
  453. iptables -t mangle -A PREROUTING -p tcp --dport 8080 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
  454. iptables -t mangle -A PREROUTING -p tcp --dport 8777 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
  455. iptables -t mangle -A PREROUTING -p tcp --dport 182 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
  456. iptables -t mangle -A PREROUTING -p tcp --dport 5050 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
  457. iptables -t mangle -A PREROUTING -p tcp --dport 443 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3127
  458. ip rule add fwmark 1 lookup 212
  459. ip route add local 0.0.0.0/0 dev lo table 212
  460.  
  461. #intercept
  462. #iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3129
  463. #iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3127
  464. ### akhir penambahan rc.local, jangan ditulis ###
  465.  
  466. reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement