Advertisement
suprianto

install squid3

Jul 4th, 2014
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.77 KB | None | 0 0
  1. squid 3.4.2 Release Date 2014-01-03
  2. nemu link squid beda tgl x aj berhasil tanpa bug..
  3.  
  4. HARAP DI TELITI DENGAN BENAR AGAR SUPAYA TIDAK TERJADI MASALAH MASALAH ERROR
  5.  
  6. sebelumnya dicompile dulu yg lama..
  7.  
  8. caranya :
  9. buang squid/lusca yang terinstall.
  10. apt-get purge squid squid-common squid-cgi
  11. apt-get purge squid
  12. apt-get autoremove
  13.  
  14. buang juga
  15. rm -rf /etc/squid {dihapus atau di backup}
  16. rm -f /usr/sbin/squid
  17.  
  18. buang cache dan hapus log
  19. rm -rf /cache <<sesuai folder yg d buat pertama buat cache
  20. rm -rf /var/log/squid/
  21.  
  22. update paket ubuntu sperti biasanya
  23.  
  24. setelah itu download squidnya yg di bawah ini
  25.  
  26. wget https://olex-secure.openlogic.com/content/openlogic/squid-cache/3.4.2/squid-3.4.2.tar.gz
  27.  
  28. compile berikut tidak ada jebakan sama sekali dan non cflags....
  29.  
  30. ./configure --prefix=/usr --bindir=/usr/bin \
  31. --sbindir=/usr/sbin --libexecdir=/usr/lib/squid \
  32. --sysconfdir=/etc --sysconfdir=/etc/squid \
  33. --localstatedir=/var --includedir=/usr/include \
  34. --datadir=/usr/share/squid --infodir=/usr/share/info \
  35. --mandir=/usr/share/man --srcdir=. --disable-dependency-tracking \
  36. --disable-strict-error-checking --enable-storeio=ufs,aufs,diskd \
  37. --enable-removal-policies=lru,heap --enable-icmp --disable-wccp \
  38. --disable-wccpv2 --enable-kill-parent-hack \
  39. --disable-snmp --enable-cachemgr-hostname=proxy \
  40. --enable-ssl --enable-cache-digests --disable-select \
  41. --enable-http-violations --enable-linux-netfilter \
  42. --enable-follow-x-forwarded-for --disable-ident-lookups \
  43. --enable-ssl-crtd --disable-auth-basic --enable-x-accelerator-vary \
  44. --enable-zph-qos --with-default-user=proxy --with-logdir=/var/log/squid \
  45. --with-pidfile=/var/run/squid.pid --with-swapdir=/var/spool/squid \
  46. --with-aufs-threads=35 --with-large-files \
  47. --enable-ltdl-convenience --with-filedescriptors=65536
  48.  
  49. selanjutnya stelah compile selesai...
  50. make (tunggu sampai selesai dulu...)
  51.  
  52. lanjut...
  53. make install
  54.  
  55. setelah selesai
  56.  
  57. buat cert ssl
  58.  
  59. cd /etc/squid
  60. mkdir ssl_cert
  61. cd ssl_cert
  62. openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout myCA.pem -out myCA.pem
  63. openssl x509 -in myCA.pem -outform DER -out myCA.der
  64. cd
  65. mkdir /var/squid
  66. cd /var/squid
  67. mkdir ssl_db
  68. cd
  69. chown -R nobody /var/squid/ssl_db
  70. /usr/lib/squid/ssl_crtd -c -s /var/squid/ssl_db/certs
  71. chown -R proxy:proxy /var/squid/ssl_db
  72.  
  73. setelah buat cert selesai
  74. buat permission antara lain :
  75. chown -R proxy:proxy /etc/squid
  76. chmod -R 777 /etc/squid
  77. chown -R proxy:proxy /var/log/squid
  78. chmod -R 777 /var/log/squid
  79. chown -R proxy:proxy /var/squid
  80. chmod -R 777 /var/squid
  81.  
  82. copaz script mangle di bawah ini ke rc.local setelah exit 0
  83.  
  84. modprobe xt_TPROXY
  85. modprobe xt_socket
  86. modprobe nf_tproxy_core
  87. modprobe xt_mark
  88. modprobe nf_nat
  89. modprobe nf_conntrack_ipv4
  90. modprobe nf_conntrack
  91. modprobe nf_defrag_ipv4
  92. modprobe ipt_REDIRECT
  93. modprobe iptable_nat
  94.  
  95. iptables -t mangle -F
  96. iptables -t mangle -X
  97.  
  98. iptables -t mangle -N DIVERT
  99. iptables -t mangle -A DIVERT -j MARK --set-mark 1
  100. iptables -t mangle -A DIVERT -j ACCEPT
  101. iptables -t mangle -A INPUT -j ACCEPT
  102. iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
  103. iptables -t mangle -A PREROUTING ! -d xxx.xxx.xxx.x/24 -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
  104. iptables -t mangle -A PREROUTING ! -d xxx.xxx.xxx.x/24 -p tcp --dport 443 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3127
  105.  
  106. /sbin/ip rule add fwmark 1 lookup 100
  107. /sbin/ip route add local 0.0.0.0/0 dev lo table 100
  108.  
  109. echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter
  110. echo 1 > /proc/sys/net/ipv4/ip_forward
  111.  
  112. Mangle Routing TPROXY SESUAIKAN DGN IP PROXY
  113. HARAP JGN LANGSUNG COPAS BUAT MANUAL SJ
  114. ------------------------------------------------
  115. /ip firewall mangle
  116. add action=mark-routing chain=prerouting comment="TPROXY" disabled=no dst-port=80,443 in-interface=Lan new-routing-mark=TPROXY-M passthrough=no \
  117. protocol=tcp dst-address=!XXX.XXX.XXX.XXX
  118. add action=mark-connection chain=prerouting disabled=no dst-port=80,443 in-interface=eproxy new-connection-mark=TPROXY-T passthrough=yes protocol=tcp \
  119. src-address=!XXX.XXX.XXX.XXX
  120. add action=mark-routing chain=prerouting connection-mark=TPROXY-T disabled=yes in-interface=!proxy new-routing-mark=TPROXY-M passthrough=no
  121. /ip route
  122. add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=XXX.XXX.XXX.XXX routing-mark=TPROXY-M scope=30 target-scope=10
  123.  
  124. CATATAN DI MIKROTIK IP FIREWALL
  125. MANGLE MANGLE LAIN LAINNYA DI DISABLE SEMUA DULU KECUALI 3 TPROXY
  126. AGAR SUPAYA LEBIH ENAK DALAM PENGECEKAN TPROXY
  127. DAN JUGA BILA ADDON HTTPS EVERYWARE MASIH NEMPEL MAUPUN REGEX007 DI BUANG ALIAS DI HAPUS
  128. SUPAYA TIDAK TERJADI ERORR ATAU LAIN SEBAGAINYA..
  129.  
  130. cek squid di terminal
  131. Jika sudah semuanya proses selesai kemudian stop dulu servisnya
  132. agar kita bisa membuat cache_dir
  133. /etc/init.d/squid stop
  134.  
  135. Cek apakah ada configurasi yang error dengan perintah
  136. squid -k parse
  137. squid -k reconfigure
  138.  
  139. Membuat folder-folder swap dan cache di dalam folder /cache yang telah ditentukan dg perintah
  140. squid -f /etc/squid/squid.conf -z
  141.  
  142. Jika sudah oke, jalankan servicesnya
  143. /etc/init.d/squid restart
  144. atau
  145. squid -NDd1
  146. reboot squidnya..
  147.  
  148. cek iptables dgn perintah
  149. iptables -L -t mangle
  150.  
  151. Jika ada penampakan seperti di bawah ini artinya sudah jalan:
  152.  
  153. Chain PREROUTING (policy ACCEPT)
  154. target prot opt source destination
  155. DIVERT tcp -- anywhere anywhere socket
  156. TPROXY tcp -- anywhere !localnet/24 tcp dpt:http TPROXY redirect 0.0.0.0:3129 mark 0x1/0x1
  157. TPROXY tcp -- anywhere !localnet/24 tcp dpt:https TPROXY redirect 0.0.0.0:3127 mark 0x1/0x1
  158.  
  159. Chain INPUT (policy ACCEPT)
  160. target prot opt source destination
  161. ACCEPT all -- anywhere anywhere
  162.  
  163. Chain FORWARD (policy ACCEPT)
  164. target prot opt source destination
  165.  
  166. Chain OUTPUT (policy ACCEPT)
  167. target prot opt source destination
  168.  
  169. Chain POSTROUTING (policy ACCEPT)
  170. target prot opt source destination
  171.  
  172. Chain DIVERT (1 references)
  173. target prot opt source destination
  174. MARK all -- anywhere anywhere MARK set 0x1
  175. ACCEPT all -- anywhere anywhere
  176.  
  177. Cek apakah squid sudah berjalan dengan perintah :
  178. ps ax | grep squid
  179.  
  180. Jika ada penampakan seperti di bawah ini artinya sudah jalan:
  181.  
  182. 7109 pts/0 T 0:00 tail -f /var/log/squid/access.log
  183. 28201 ? Ss 0:00 /usr/sbin/squid -YC -f /etc/squid/squid.conf
  184. 28205 ? Sl 5:26 (squid-1) -YC -f /etc/squid/squid.conf
  185. 28206 ? S 0:00 (ssl_crtd) -s /var/squid/ssl_db/certs/ -M 4MB -b 4096
  186. 28207 ? S 0:00 (ssl_crtd) -s /var/squid/ssl_db/certs/ -M 4MB -b 4096
  187. 28208 ? S 0:00 (ssl_crtd) -s /var/squid/ssl_db/certs/ -M 4MB -b 4096
  188. 28209 ? S 0:00 (ssl_crtd) -s /var/squid/ssl_db/certs/ -M 4MB -b 4096
  189. 28210 ? S 0:00 (ssl_crtd) -s /var/squid/ssl_db/certs/ -M 4MB -b 4096
  190. 28211 ? S 0:07 /usr/bin/perl /etc/squid/store-id.pl
  191. 28212 ? S 0:00 /usr/bin/perl /etc/squid/store-id.pl
  192. 28213 ? S 0:00 /usr/bin/perl /etc/squid/store-id.pl
  193. 28214 ? S 0:00 /usr/bin/perl /etc/squid/store-id.pl
  194. 28215 ? S 0:00 /usr/bin/perl /etc/squid/store-id.pl
  195. 28216 ? S 0:00 /usr/bin/perl /etc/squid/store-id.pl
  196. 28217 ? S 0:00 /usr/bin/perl /etc/squid/store-id.pl
  197. 28218 ? S 0:00 /usr/bin/perl /etc/squid/store-id.pl
  198. 28219 ? S 0:00 /usr/bin/perl /etc/squid/store-id.pl
  199. 28220 ? S 0:00 /usr/bin/perl /etc/squid/store-id.pl
  200. 29036 pts/0 S+ 0:00 grep --color=auto squid
  201.  
  202. setelah semuanya berjalan normal tanpa error
  203. cek log accesss
  204. tail -f /var/log/squid/access.log | grep HIT | ccze
  205. tail -f /var/log/squid/access.log | grep TCP_HIT
  206. tail -f /var/log/squid/access.log | grep HIT
  207. tail -f /var/log/squid/access.log | ccze
  208.  
  209. semoga berhasil dan sukses..
  210. tested semalam lancar no gatot (y)
  211. squid.conf+store-id.pl pakai sebelumnya...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement