#!
/bin/bash clear echo "|=====================================================================|" echo "" echo " _ __ __ _____ " echo " | | | \/ |/ ____|" echo " | | ___ ___| \ / | | __ " echo " _ | |/ _ \ / _ \ |\/| | | |_ |" echo " | |__| | (_) | __/ | | | |__| |" echo " \____/ \___/ \___|_| |_|\_____|" echo "" echo "+=====================================================================+" echo "| INSTALACION Raptor 1.0b - Squid 3.x |" echo "| 64 bits |" echo "+=====================================================================+" echo "" V='|-------------------------> Version 64 bits <-------------------------|' ER='ERROR, su version de linux no es de 64 bits' ER2='Use el script adecuado para su version' P=`uname -m` if [ $P = x86_64 ] ; then echo $V else echo $ER echo "" echo $ER2 echo "" exit 0 fi echo "" IPSERV=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') HOST_NAME="[Link]" sleep 3 rm -rf /etc/apt/[Link] touch /etc/apt/[Link] echo "deb [Link] squeeze main deb-src [Link] squeeze main deb [Link] squeeze/updates main deb-src [Link] squeeze/updates main deb [Link] squeeze-updates main deb-src [Link] squeeze-updates main" >> /etc/apt/sourc [Link] apt-get update apt-get upgrade cd / mkdir /temp cd /temp wget [Link] tar xzvf LUSCA_HEAD-[Link] #baixar pacotes necessarios para a instalacao apt-get install gcc build-essential sharutils ccze libzip-dev automake1.9 cd LUSCA_HEAD-r14809
#configurar Squid Cache: Version LUSCA_HEAD-r14809 ./configure '--prefix=/usr' '--exec_prefix=/usr' '--bindir=/usr/sbin' '--sbindir =/usr/sbin' '--libexecdir=/usr/lib/squid3' '--sysconfdir=/etc/squid3' '--localst atedir=/var/spool/squid3' '--datadir=/usr/share/squid3' '--disable-dependency-tr acking' '--disable-arp-acl' '--disable-cache-digests' '--enable-cachemgr-hostnam e=localhost' '--disable-delay-pools' '--enable-epoll' '--enable-external-acl-hel pers=ip_user' '--disable-ident-lookups' '--enable-linux-netfilter' '--disable-re ferer-log' '--enable-removal-policies=heap,lru' '--enable-snmp' '--disable-ssl' '--enable-storeio=aufs,null,coss' '--disable-useragent-log' '--disable-wccpv2' ' --with-aio' '--with-maxfd=1048576' '--with-dl' '--with-pthreads' 'build_alias=i6 86-redhat-linux-gnu' 'host_alias=i686-redhat-linux-gnu' 'targe_alias=i686-redhat -linux-gnu--enable-truncate' '--disable-unlinkd' '--with-large-files' '--disable -htcp' make all make install echo "CONFIGURANDO O LUSCA E FAZENDO AJUSTES" echo "/" sleep 5 cd / mkdir mkdir mkdir mkdir mkdir chmod chmod chmod chmod chmod chmod /var/log/squid /var/log/squid3 /var/spool/squid /var/spool/squid3 /cache1 777 /cache1 777 /cache1/* 777 777 777 777 /var/log/squid /var/log/squid3 /var/spool/squid /var/spool/squid3
rm -rf /etc/squid3/[Link] touch /etc/squid3/[Link] echo Y | apt-get install lib32stdc++6 beep sleep 3 touch /etc/squid3/[Link] echo "[Link]" >> /etc/squid3/[Link] rm -rf /etc/squid3/[Link] touch /etc/squid3/[Link] echo "# SQUID 2.7/ LUSCA TEST CONFIG FILE http_port 3128 transparent server_http11 on icp_port 0 #ACL Section acl all src [Link]/[Link]
acl acl acl acl acl acl acl acl acl acl acl acl acl acl acl acl acl acl acl acl
manager proto cache_object localhost src [Link]/[Link] to_localhost dst [Link]/8 SSL_ports port 443 563 # https, snews SSL_ports port 873 # rsync Safe_ports port 80 # http Safe_ports port 21 # ftp Safe_ports port 443 563 # https, snews Safe_ports port 70 # gopher Safe_ports port 210 # wais Safe_ports port 1025-65535 # unregistered ports Safe_ports port 280 # http-mgmt Safe_ports port 488 # gss-http Safe_ports port 591 # filemaker Safe_ports port 777 # multiling http Safe_ports port 631 # cups Safe_ports port 873 # rsync Safe_ports port 901 # SWAT purge method PURGE CONNECT method CONNECT allow manager localhost deny manager allow purge localhost deny purge deny !Safe_ports deny CONNECT !SSL_ports
http_access http_access http_access http_access http_access http_access
http_access allow localhost http_access allow all http_reply_access allow all icp_access allow all acl snmppublic snmp_community public icp_access deny all quick_abort_min 16 KB quick_abort_max 16 KB quick_abort_pct 95 range_offset_limit 0 #mascar ZPH tcp_outgoing_tos 0x30 zph_mode tos zph_local 0x30 zph_parent 0 zph_option 136 cache_mem 1500 MB maximum_object_size_in_memory 1024 KB memory_replacement_policy heap GDSF cache_replacement_policy heap LFUDA cache_dir aufs /cache1 250000 357 256 store_dir_select_algorithm round-robin minimum_object_size 0 KB maximum_object_size 51200 KB cache_swap_low 97 cache_swap_high 99 # arquivos de log retirados para melhor desempenho
access_log /var/log/squid3/[Link] cache_access_log /dev/null cache_log /dev/null cache_store_log /dev/null debug_options ALL,1 strip_query_terms off buffered_logs on max_stale 1 year negative_dns_ttl 1 second negative_ttl 0 second positive_dns_ttl 24 hours offline_mode off acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9] upgrade_http0.9 deny shoutcast acl apache rep_header Server ^Apache broken_vary_encoding allow apache vary_ignore_expire on #forwarded_for off header_access header_access header_access header_access header_access From deny all Server deny all Link deny all Via deny all X-Forwarded-For deny all
httpd_suppress_version_string on connect_timeout 30 seconds request_timeout 1 minutes shutdown_lifetime 10 seconds cache_effective_user proxy cache_effective_group root cache_mgr webmaster visible_hostname fspeed unique_hostname none #error_directory /usr/local/squid/share/errors/Portuguese client_persistent_connections on server_persistent_connections on #tcp_reset_on_all_errors on #blank_error_pages on max_filedescriptors 65536 tcp_recv_bufsize 64 KB dns_timeout 1 minutes dns_nameservers [Link] dns_testnames [Link] ipcache_size 10240 ipcache_low 95 ipcache_high 98 fqdncache_size 100 memory_pools off reload_into_ims on maximum_single_addr_tries 2
coredump_dir /cache1 pipeline_prefetch on #cachemgr_passwd none info cachemgr_passwd none all client_db on global_internal_static off max_stale 10 years retry_on_error on read_ahead_gap 32 KB # LUSCA n_aiops_threads 24 load_check_stopen on load_check_stcreate on download_fastest_client_speed on #CACHE PEER RAPTOR acl raptor_lst url_regex -i cache deny raptor_lst cache_peer [Link] parent dead_peer_timeout 2 seconds cache_peer_access [Link] cache_peer_access [Link] sleep 1 squid -z sleep 1 /etc/init.d/squid3 restart sleep 6 beep -f 999.9 beep -f 999.9 IPSERV=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') sleep 3 apt-get update apt-get upgrade echo Y | apt-get install apache2 sleep 1 echo Y | apt-get install sqlite gcc libsqlite3-dev libapache2-mod-php5 php-db li bstdc++6 g++ unzip libmysqlclient15-dev libblkid-dev libcurl3-dev lynx ffmpeg ls b-release sudo make php5-dev php-pear apache2-prefork-dev libpcre3-dev echo Y | apt-get -f upgrade cd /root sleep 3 "/etc/raptor/[Link]" 8080 0 proxy-only no-digest allow raptor_lst deny all" >> /etc/squid3/[Link]
wget [Link] cp [Link] /tmp tar -xzvf /tmp/[Link] -C / rm -rf [Link] chmod a+x /usr/sbin/raptor mkdir /var/log/raptor && mkdir /var/tmp/raptor && mkdir /var/run/raptor && mkdir /raptorcache && chmod a+rwx /var/log/raptor && chmod a+rwx /var/tmp/raptor && chmod a+rwx /var/r un/raptor && chmod a+x /etc/init.d/raptor && chown -R www-data /raptorcache/ chmod -R 777 /raptorcache/ umask 000 /raptorcache/ echo "extension=[Link]" >> /etc/php5/apache2/[Link] echo "[Link]=10" >> /etc/[Link] update-rc.d raptor defaults sleep 3 wget [Link] unzip [Link] mv clean /etc/raptor/ chmod 777 /etc/raptor/clean rm -rf [Link] wget [Link] tar -xzvf [Link] mv pluginmaker /etc/raptor/ rm -rf [Link] touch /etc/raptor/[Link] wget [Link] tar -xzvf [Link] mv plugins /etc/raptor/ rm -rf [Link] clear chmod 777 /etc/raptor/plugins/* chmod 777 /etc/raptor/cl0 /etc/init.d/raptor start chmod 777 /etc/raptor/clean sleep 3 echo "## Raptor # min(0-59) hora(0-23) diames(1-31) mes(1-12) diasem(0-7) user comando 59 1 * * * root /etc/rap tor/./clean 45 30 23 * * * root squid3 k rotate * */1 * * * root /etc/rap tor/./cl0 59 22 * * * root /etc/rap tor/rprotate */2 * * * * root serv
*/1 * u -i eth0" >> /etc/crontab sleep 6 beep -f 999.9 beep -f 999.9 sleep 1
root
vnstat -
apt-get update apt-get upgrade clear echo "" echo "" echo "+-------------------------------------------------------------+" echo "| Instalacion del Mysql |" echo "| Es importante que ponga la contrasea del Mysql = raptor |" echo "+-------------------------------------------------------------+" echo Pulse enter para continuar... read -n 0 -ers echo Y | apt-get install mysql-server mysql-client php5-mysql && echo Y | aptitude install php5-cgi && echo Y | apt-get -f upgrade && wget [Link] cp [Link] /var/tmp/ rm -rf [Link] echo mysql -u root -praptor << eof CREATE DATABASE raptor; eof mysql -u root -praptor raptor < /var/tmp/[Link] sleep 6 beep -f 999.9 beep -f 999.9 sleep 1 IPSERV=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') HOST_NAME="[Link]" sleep 3 mv /etc/hosts /etc/hosts_ touch /etc/hosts echo "[Link] [Link] $IPSERV proxy.$HOST_NAME proxy # ::1 localhost ip6-localhost fe00::0 ip6-localnet fe00::0 ip6-mcastprefix ff02:1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts" >> /etc/hosts localhost ip6-loopback
sleep 3 mv /etc/hostname /etc/hostname_ touch /etc/hostname echo "proxy.$HOST_NAME" >> /etc/hostname mv /etc/[Link] /etc/resolv.conf_ touch /etc/[Link] echo "search proxy.$HOST_NAME nameserver [Link] nameserver [Link] nameserver [Link]" >> /etc/[Link] sleep 3 apt-get update apt-get upgrade echo Y | apt-get install bind9 dnsutils bind9-doc sleep 3 mv /etc/bind/[Link] /etc/bind/[Link].options_old touch /etc/bind/[Link] echo "options { directory \"/var/cache/bind\"; forwarders { [Link]; [Link]; }; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; };" >> /etc/bind/[Link] echo "include \"/etc/bind/zones.rfc1918\"; logging { category lame-servers {null; }; category edns-disabled { null; }; };" >> /etc/bind/[Link] echo "ServerName proxy.$HOST_NAME" >> /etc/apache2/[Link] mv /etc/apache2/[Link] /etc/apache2/httpd.conf_ touch /etc/apache2/[Link] echo "Listen 82 <VirtualHost *:82> DocumentRoot /var/raptor ServerName [Link] ErrorLog /var/log/virtual82-error_log CustomLog /var/log/virtual82-access_log common </VirtualHost> Listen 84 <VirtualHost *:84> DocumentRoot /var/www/sarg ServerName [Link] </VirtualHost>" >> /etc/apache2/[Link]
sleep 6 beep -f 999.9 beep -f 999.9 clear sleep 3 echo " #Repositorio Sarg deb [Link] squeeze-backports main" >> /etc /apt/[Link] apt-get update apt-get upgrade echo Y | aptitude install sarg apt-get -f upgrade mv /etc/sarg/[Link] /etc/sarg/sarg.conf_old wget [Link] mv [Link] /etc/sarg/[Link] echo " # Agendamiento Sarg 59 21 * * * root sarg" > > /etc/crontab mkdir /var/www/sarg/ sarg sleep 1 wget [Link] tar -xzvf [Link] mv raptor /var/ rm -rf [Link] clear chmod 777 /var/raptor/* chmod 777 /var/raptor/mail/* chmod 777 /etc/raptor/[Link] chmod 777 /etc/squid3/[Link] chmod 777 /etc/raptor/[Link] chmod 777 /etc/squid3/[Link] chmod 777 /etc/network/interfaces chmod 777 /etc/[Link] clear sleep 1 echo Y | apt-get install snmpd mv /etc/snmp/[Link] /etc/snmp/[Link] touch /etc/snmp/[Link] echo 'rocommunity public syslocation "PDC, Peters DataCenter" syscontact peter@[Link]' > /etc/snmp/[Link] rm -rf /etc/default/snmpd wget [Link] mv snmpd /etc/default/ /etc/init.d/snmpd restart sleep 3 clear echo "" echo "" echo "+-------------------------------------------------------------------------------------+" echo "| Instalacion del Cacti |"
echo "| Elegir Apache2 como Servidor Web y luego ingresar la contrasea del Mysql( raptor) |" echo "+-------------------------------------------------------------------------------------+" echo Pulse enter para continuar... read -n 0 -ers echo Y | apt-get install cacti wget [Link] mv [Link] /var/tmp/ mysql -u root -praptor cacti < /var/tmp/[Link] sleep 1 mv /etc/cacti/[Link] /etc/cacti/apache.conf_ touch /etc/cacti/[Link] echo "Alias /graphcacti /usr/share/cacti/site <Directory /usr/share/cacti/site> Options +FollowSymLinks AllowOverride None order allow,deny allow from all AddType application/x-httpd-php .php <IfModule mod_php5.c> php_flag magic_quotes_gpc Off php_flag short_open_tag On php_flag register_globals Off php_flag register_argc_argv On php_flag track_vars On # this setting is necessary for some locales php_value mbstring.func_overload 0 php_value include_path . </IfModule> DirectoryIndex [Link] </Directory>" >> /etc/cacti/[Link] /etc/init.d/apache2 restart echo Y | apt-get install vnstat vnstat -u -i eth0 echo Y | apt-get install smartmontools lvm2 hdparm sleep 1 echo Y | apt-get install lm-sensors clear echo "" echo "" echo "+---------------------------------------------+" echo "| Se instalaran los sensores de temperatura |" echo "| Ingresar YES en las siguientes opciones |" echo "+---------------------------------------------+" echo Pulse enter para continuar... read -n 0 -ers sensors-detect service module-init-tools restart /etc/init.d/module-init-tools restart echo " # DNS Cache */2 * * *
root
rndc d
umpdb" >> /etc/crontab clear wget [Link] mv [Link] /usr/lib/cgi-bin/ chmod 777 /usr/lib/cgi-bin/[Link] echo Y | apt-get --purge remove sudo echo Y | apt-get install sudo echo "www-data ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers chmod 777/etc/sudoers clear echo | pecl install apc --with-apxs='/usr/bin/apxs2' echo "Alias /var/raptor/apc /usr/share/php/[Link] <Directory /usr/share/php/[Link]> Options +FollowSymLinks AllowOverride None order allow,deny allow from all AddType application/x-httpd-php .php <IfModule mod_php5.c> php_flag magic_quotes_gpc Off php_flag short_open_tag On php_flag register_globals Off php_flag register_argc_argv On php_flag track_vars On # this setting is necessary for some locales php_value mbstring.func_overload 0 php_value include_path . </IfModule> DirectoryIndex [Link] </Directory>" >> /etc/apache2/conf.d/[Link] echo "extension=[Link]" >> /etc/php5/conf.d/[Link] echo "; APC Configuration [Link] = 1 ; Memory allocated to APC. Use Munin or APC Info to see if more is needed. apc.shm_size=32M ; rfc1867 allow file upload progression display. apc.rfc1867 = on" >> /etc/php5/conf.d/[Link] clear rm -rf /var/tmp/* rm -rf [Link] echo echo echo echo echo =+" echo |" echo |" echo |" echo "" "" "" "" "+========================================================================= "| "| "| "| REINICIE SU SISTEMA PARA CONCLUIR LA INSTALACION INSTALACION FINALIZADA
|" echo |" echo =+" echo echo
"| "+========================================================================= "" ""