Advertisement
ujiajah1

backup_squid4.sh

Oct 16th, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.33 KB | None | 0 0
  1. #!/bin/bash
  2. JAM=`date +%H`
  3. MENIT=`date +%M`
  4. blue='\e[1;34m'
  5. green='\e[0;23m'
  6. purple='\e[1;35m'
  7. cyan='\e[1;36m'
  8. red='\e[1;31m'
  9.  
  10. echo -e $purple
  11. echo "
  12.                                                                                  .----.      
  13. _______                                                                          / .--. \    
  14. \  ___ `'.         __.....__     /|        .--.             _..._               ' '    ' '    
  15. ' |--.\  \    .-''         '.   ||        |__|           .'     '.             \ \    / /    
  16. | |    \  '  /     .-''"'-.  `. ||        .--.          .   .-.   .             `.`'--.'    
  17. | |     |  '/     /________\   \||  __    |  |    __    |  '   '  |             / `'-. `.    
  18. | |     |  ||                  |||/'__ '. |  | .:--.'.  |  |   |  |            ' /    `. \  
  19. | |     ' .'\    .-------------'|:/`  '. '|  |/ |   \ | |  |   |  |           / /       \ '  
  20. | |___.' /'  \    '-.____...---.||     | ||  |`" __ | | |  |   |  |          | |         | |
  21. /_______.'/    `.             .' ||\    / '|__| .'.''| | |  |   |  |          | |         | |
  22. \_______|/       `''-...... -'   |/\'..' /     / /   | |_|  |   |  |           \ \       / /  
  23.                                 '  `'-'`      \ \._,\ '/|  |   |  |            `.'-...-'.'  
  24.                                                `--'  `" '--'   '--'               `-...-'      ";
  25. echo -e $cyan
  26. read -p 'Masukan User Linux Anda: ' userver
  27. read -sp 'password Linux Anda:' passserver
  28. echo "selamatkan dunia"
  29. echo -e "selamat datang $userver ashole di program installasi server\n"
  30. echo -e "Sekarang jam" $JAM:$MENIT
  31. echo -e $red
  32. cal
  33. echo -n "Masukan Nama Anda :"
  34. read nama
  35. echo -e $red[+] $cyan"$HOSTNAME uptime is "$red[+]$cyan;uptime
  36. echo -e Hello $blue $nama $green you are $red ashole
  37. echo -e $blue how are you $blue $nama
  38. echo -e $blue oh iya ... !sebelumnya clone dari $red github git clone https://github.com/puji122/squid4-autoinstall.git
  39. echo -e $cyan
  40. echo "|=====================================================|"
  41. echo "|                   Sajak Suara                       |"
  42. echo "|=====================================================|"
  43. echo "|     sesungguhnya suara itu tak bisa diredam         |"
  44. echo "|                mulut bisa dibungkam                 |"
  45. echo "|  namun siapa mampu menghentikan nyanyian bimbang    |"
  46. echo "|    dan pertanyaan-pertanyaan dari lidah jiwaku      |"
  47. echo "|      suara-suara itu tak bisa dipenjarakan          |"
  48. echo "|          di sana bersemayam kemerdekaan             |"
  49. echo "|           apabila engkau memaksa diam               |"
  50. echo "|       akan kusiapkan untukmu: pemberontakan!        |"
  51. echo "|                                                     |"
  52. echo "|        sesungguhnya suara itu bukan perampok        |"
  53. echo "|             yang ingin meraih hartamu               |"
  54. echo "|                 ia ingin bicara                     |"
  55. echo "|            mengapa kau kokang senjata               |"
  56. echo "|         dan gemetar ketika suara-suara itu          |"
  57. echo "|                menuntut keadilan?                   |"
  58. echo "|                                                     |"
  59. echo "|       sesungguhnya suara itu akan menjadi kata      |"
  60. echo "|          ialah yang mengajari aku bertanya          |"
  61. echo "|          dan pada akhirnya tidak bisa tidak         |"
  62. echo "|                engkau harus menjawabnya             |"
  63. echo "|            apabila engkau tetap bertahan            |"
  64. echo "|         aku akan memburumu seperti kutukan          |"
  65. echo "|           Wiji Thukul - 1996 (Sajak Suara)          |"
  66. echo "|=====================================================|"
  67. echo -e $purple Selamat datang di installasi server
  68. while true; do
  69.    read -p "Lanjutkan installasi?" yn
  70.    case $yn in
  71.        [Yy]* ) break;;
  72.        [Nn]* ) exit;;
  73.        * ) echo "Tolong jawab yes atau no";;
  74.    esac
  75. done
  76.  
  77. # informasi perangkat keras
  78. echo "++ Perangkat keras "
  79. CPU=`grep "model name" /proc/cpuinfo | head -n 1 | cut -f 2 -d ':'`
  80. RAM=`grep "MemTotal" /proc/meminfo | cut -f 2 -d ':'`
  81. echo " |- CPU : " $CPU
  82. echo " |- RAM : " $RAM
  83. echo "++ Sistem Operasi "
  84. # informasi sistem operasi
  85. OS=`uname -sr`
  86. echo " |- OS : " $OS
  87. echo " |- Shell : " $SHELL --version
  88. echo -n "Waktu system   :"; date
  89. echo -n "Distro Info    :"; lsb_release -a
  90. echo -n "Anda           :"; whoami
  91. echo -n "Banyak pemakai :"; who | wc -l
  92. echo "ok langsung ajah"
  93. echo "sambil ngopi brayy duduk yang manis yah"
  94.  
  95. echo -e $cyan
  96. cp sysctl.conf /etc/
  97. cp limits.conf /etc/security/
  98.  
  99. apt-get update && apt-get upgrade -y
  100.  
  101. echo -e "WebServer Telah Selesai di install, \n"
  102. while true; do
  103.    read -p "Lanjuut?" yn
  104.    case $yn in
  105.        [Yy]* ) break;;
  106.        [Nn]* ) exit;;
  107.        * ) echo "jawab aja yes atau no";;
  108.    esac
  109. done
  110. echo -e "memulai installasi proxy server"
  111. apt-get install devscripts build-essential openssl libssl-dev fakeroot libcppunit-dev pkg-config libsasl2-dev cdbs ebtables bridge-utils libcap2 libcap-dev libcap2-dev sysv-rc-conf iproute kernel-package libncurses5-dev fakeroot wget bzip2 debhelper linuxdoc-tools libselinux1-dev htop iftop dnstop perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python ccze pastebinit checkinstall libssl-dev htop iftop iptraf mtr-tiny bwm-ng ccze sysv-rc-conf devscripts build-essential openssl libssl-dev fakeroot libcppunit-dev libsasl2-dev cdbs ccze libfile-readbackwards-perl libcap2 libcap-dev libcap2-dev libnetfilter-conntrack-dev libfile-readbackwards-perl -y  
  112. tar -xzf libecap-1.0.0.tar.gz
  113. cd libecap-1.0.0
  114. ./configure && make && make install
  115. echo '/usr/local/lib' >> /etc/ld.so.conf
  116. ldconfig
  117.  
  118. cd -
  119. tar zxvf ecap_mamamyuk.tar.gz
  120. cd ecap_adapter_sample-1*
  121. ./configure && make && make install
  122.  
  123. cd -
  124. echo -e $red
  125. tar -xzvf squid-4.0.4.tar.gz
  126. cd squid-4.0.4
  127. ./configure '--prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib/squid' '--sysconfdir=/etc/squid' '--localstatedir=/var' '--libdir=/usr/lib' '--includedir=/usr/include' '--datadir=/usr/share/squid' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--disable-dependency-tracking' '--disable-strict-error-checking' '--enable-async-io=24' '--with-aufs-threads=24' '--with-pthreads' '--enable-storeio=aufs,diskd' '--enable-removal-policies=lru,heap' '--with-aio' '--with-dl' '--enable-icmp' '--enable-esi' '--disable-icap-client' '--disable-wccp' '--disable-wccpv2' '--enable-kill-parent-hack' '--enable-cache-digests' '--disable-select' '--enable-http-violations' '--enable-linux-netfilter' '--enable-follow-x-forwarded-for' '--disable-ident-lookups' '--enable-x-accelerator-vary' '--enable-zph-qos' '--with-default-user=proxy' '--with-logdir=/var/log/squid' '--with-pidfile=/var/run/squid.pid' '--with-swapdir=/cache/cache' '--with-openssl' '--with-large-files' '--enable-ltdl-convenience' '--with-filedescriptors=65536' '--with-maxfd=65536' '--enable-storeid-rewrite-helpers' '--enable-snmp' '--enable-referer-log' '--enable-ecap' '--enable-ssl-crtd' '--enable-err-languages=English' '--enable-default-err-language=English' '--build=x86_64' 'build_alias=x86_64' 'PKG_CONFIG_PATH=/usr/local/lib/pkgconfig'
  128. make && make install
  129.  
  130. cd -
  131. cp squid.conf /etc/squid/
  132. cp store-id.pl /etc/squid/
  133. cp blok.txt /etc/squid/
  134. cp ad_block.txt /etc/squid/
  135. cp squid /etc/init.d/
  136. cp blok.html /var/www/
  137.  
  138. cd /etc/init.d/
  139. chmod +x /etc/init.d/squid
  140. update-rc.d squid defaults
  141. /etc/init.d/squid stop
  142.  
  143. cd -
  144. chmod +x /etc/squid/store-id.pl
  145. chmod +x /etc/squid/ad_block.txt
  146. chmod +x /etc/squid/blok.txt
  147. chmod +x /etc/init.d/squid
  148. chown -R proxy:proxy /cache/cache/
  149. chmod -R 777 /cache/cache/
  150.  
  151. cd /var/log/squid/
  152. touch access.log
  153. touch cache.log
  154.  
  155. cd
  156. chown -R proxy:proxy /var/log/squid/
  157. chmod -R 777 /var/log/squid/
  158. mkdir /etc/squid/ssl_certs/
  159.  
  160. echo -e $blue
  161. cd /etc/squid/ssl_certs/
  162. openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=ID/ST=WestJava/L=Bandung/O=puji122/OU=Proxy Server/CN=Puji Ermanto/emailAddress=pujiermanto@gmail.com" -keyout pujiermanto.pem  -out pujiermanto.pem
  163. openssl x509 -in pujiermanto.pem -outform DER -out pujiermanto.der
  164.  
  165. cd
  166. mkdir /var/lib/squid
  167. /usr/lib/squid/ssl_crtd -c -s /var/lib/squid/ssl_db
  168. chown -R proxy:proxy /etc/squid/
  169. chmod -R 777 /etc/squid/
  170. chown -R nobody /var/lib/squid/ssl_db
  171. chown -R proxy:proxy /var/lib/squid/ssl_db
  172.  
  173. echo "================================================================================================================================"
  174. echo "setelah reboot"
  175. echo "squid -k reconfigure"
  176. echo "/etc/init.d/squid restart"
  177. echo "byee ashole"
  178. echo "tail -f /var/log/squid/access.log | ccze"
  179. echo "buat direktory cache, pastikan sebelumnya sudah di sesuaikan untuk direktori /cache nya sesuai dengan kapasitas hardisk anda"
  180. echo -e $purple
  181. squid -z
  182. echo -e $red
  183. echo "selesai_"
  184. echo -e $green
  185. echo -e "Selamat installasi squid proxy version4 telah selesai di laksanakan. , \nHarap Restart dulu server anda."
  186. echo -e "Created by : Puji Ermanto aka mamam-yuk aka younghipster http://younghipster.comli.com/"
  187. echo "================================================================================================================================"
  188. while true; do
  189.    read -p "Silahkan Direstart bro?" yn
  190.    case $yn in
  191.        [Yy]* ) init 6; break;;
  192.        [Nn]* ) exit;;
  193.        * ) echo "jawab aja yes atau no gitu ajah ko repot";;
  194.    esac
  195. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement