Advertisement
sorahx0

Untitled

May 29th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 8.32 KB | None | 0 0
  1. #!/bin/bash
  2. tput setaf 7 ; tput setab 4 ; tput bold ; printf '%35s%s%-20s\n' "VPS Manager 2.0.1 (versão gratuita)" ; tput sgr0
  3. tput setaf 3 ; tput bold ; echo "" ; echo "Este script irá:" ; echo ""
  4. echo "● Instalar e configurar o proxy squid nas portas 80, 3128, 8080 e 8799" ; echo "  para permitir conexões SSH para este servidor"
  5. echo "● Configurar o OpenSSH para rodar nas portas 22 e 443"
  6. echo "● Instalar um conjunto de scripts como comandos do sistema para o gerenciamento de usuários" ; tput sgr0
  7. echo ""
  8. tput setaf 3 ; tput bold ; read -n 1 -s -p "Aperte qualquer tecla para continuar..." ; echo "" ; echo "" ; tput sgr0
  9. tput setaf 2 ; tput bold ; echo "   Termos de Uso" ; tput sgr0
  10. echo ""
  11. echo "Ao utilizar esta versão GRATUITA do 'VPS Manager 2.0' você concorda com os seguintes termos de uso:"
  12. echo ""
  13. echo "1. Você pode:"
  14. echo "a. Instalar e usar o 'VPS Manager 2.0' no(s) seu(s) servidor(es)."
  15. echo "b. Criar, gerenciar e remover um número ilimitado de usuários através desse conjunto de scripts."
  16. echo ""
  17. tput setaf 3 ; tput bold ; read -n 1 -s -p "Aperte qualquer tecla para continuar..." ; echo "" ; echo "" ; tput sgr0
  18. echo "2. Você não pode:"
  19. echo "a. Editar, modificar, compartilhar ou redistribuir (gratuitamente ou comercialmente)"
  20. echo "esse conjunto de scripts sem autorização do desenvolvedor."
  21. echo "b. Modificar ou editar o conjunto de scripts para fazer você parecer o desenvolvedor dos scripts."
  22. echo ""
  23. echo "3. Você aceita que:"
  24. echo "a. Esta cópia GRATUITA do VPS Manager 2.0 não inclui NENHUM tipo garantia ou suporte promocional, sendo estes exclusivos da versão paga do VPS Manager 2.0."
  25. echo "b. O usuário desse conjunto de scripts é o único resposável por qualquer tipo de implicação"
  26. echo "ética ou legal causada pelo uso desse conjunto de scripts para qualquer tipo de finalidade."
  27. echo ""
  28. tput setaf 3 ; tput bold ; read -n 1 -s -p "Aperte qualquer tecla para continuar..." ; echo "" ; echo "" ; tput sgr0
  29. echo "4. Você concorda que o desenvolvedor não se responsabilizará por nenhum tipo de problemas ocorridos durante o uso dessa versão GRATUITA do VPS Manager 2.0."
  30. echo ""
  31. tput setaf 3 ; tput bold ; read -n 1 -s -p "Aperte qualquer tecla para continuar..." ; echo "" ; echo "" ; tput sgr0
  32. IP=$(wget -qO- ipv4.icanhazip.com)
  33. read -p "Para continuar confirme o IP deste servidor: " -e -i $IP ipdovps
  34. if [ -z "$ipdovps" ]
  35. then
  36.     tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "" ; echo " Você não digitou o IP deste servidor. Tente novamente. " ; echo "" ; echo "" ; tput sgr0
  37.     exit 1
  38. fi
  39. if [ -f "/root/usuarios.db" ]
  40. then
  41. tput setaf 6 ; tput bold ;  echo ""
  42.     echo "Uma base de dados de usuários ('usuarios.db') foi encontrada!"
  43.     echo "Deseja mantê-la (preservando o limite de conexões simultâneas dos usuários)"
  44.     echo "ou criar uma nova base de dados?"
  45.     tput setaf 6 ; tput bold ;  echo ""
  46.     echo "[1] Manter Base de Dados Atual"
  47.     echo "[2] Criar uma Nova Base de Dados"
  48.     echo "" ; tput sgr0
  49.     read -p "Opção?: " -e -i 1 optiondb
  50. else
  51.     awk -F : '$3 >= 500 { print $1 " 1" }' /etc/passwd | grep -v '^nobody' > /root/usuarios.db
  52. fi
  53. echo ""
  54. read -p "Deseja ativar a compressão SSH (pode aumentar o consumo de RAM)? [s/n]) " -e -i n sshcompression
  55. echo ""
  56. tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "Aguarde a configuração automática" ; echo "" ; tput sgr0
  57. sleep 3
  58. rm /bin/criarusuario /bin/expcleaner /bin/sshlimiter /bin/addhost /bin/listar /bin/sshmonitor /bin/ajuda > /dev/null
  59. rm /root/ExpCleaner.sh /root/CriarUsuario.sh /root/sshlimiter.sh > /dev/null
  60. apt-get install squid3 bc screen nano unzip dos2unix wget -y
  61. killall apache2
  62. apt-get purge apache2 -y
  63. if [ -f "/usr/sbin/ufw" ] ; then
  64.     ufw allow 443/tcp ; ufw allow 80/tcp ; ufw allow 3128/tcp ; ufw allow 8799/tcp ; ufw allow 8080/tcp
  65. fi
  66. if [ -d "/etc/squid3/" ]
  67. then
  68.      wget pastebin.com/raw/HPMGcA4J -O /tmp/sqd1
  69.     echo "acl url3 dstdomain -i $ipdovps" > /tmp/sqd2
  70.     wget pastebin.com/raw/HPMGcA4J -O /tmp/sqd3
  71.     cat /tmp/sqd1 /tmp/sqd2 /tmp/sqd3 > /etc/squid3/squid.conf
  72.     wget pastebin.com/raw/mU6xKGRr -O /etc/squid3/payload.txt
  73.     echo " " >> /etc/squid3/payload.txt
  74.     grep -v "^Port 443" /etc/ssh/sshd_config > /tmp/ssh && mv /tmp/ssh
  75. /etc/ssh/sshd_config
  76.     echo "Port 443" >> /etc/ssh/sshd_config
  77.     grep -v "^PasswordAuthentication yes" /etc/ssh/sshd_config >
  78. /tmp/passlogin && mv /tmp/passlogin /etc/ssh/sshd_config
  79.         echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
  80.         wget pastebin.com/raw/p1WmaUE4 -O /bin/addhost
  81.         chmod +x /bin/addhost
  82.         wget pastebin.com/raw/Tu1mb1Yi -O /bin/alterarsenha
  83.         chmod +x /bin/alterarsenha
  84.         wget pastebin.com/raw/y5qPjxF8 -O /bin/criarusuario
  85.         chmod +x /bin/criarusuario
  86.     wget pastebin.com/raw/4hj5xgxa -O /bin/delhost
  87.     chmod +x /bin/delhost
  88.     wget pastebin.com/raw/F4Fa4pi9 -O /bin/expcleaner
  89.     chmod +x /bin/expcleaner
  90.         wget pastebin.com/raw/dPvnJUh6 -O /bin/mudardata
  91.         chmod +x /bin/mudardata
  92.     wget pastebin.com/raw/ecuwa0Tj -O /bin/remover
  93.     chmod +x /bin/remover
  94.     wget pastebin.com/raw/3PK7irMB -O /bin/sshlimiter
  95.         chmod +x /bin/sshlimiter
  96.         wget pastebin.com/raw/mTRLcZV8 -O /bin/alterarlimite
  97.         chmod +x /bin/alterarlimite
  98.         wget pastebin.com/raw/mZZsGTLD -O /bin/sshmonitor
  99.         chmod +x /bin/sshmonitor
  100.     if [ ! -f "/etc/init.d/squid3" ]
  101.     then
  102.         service squid3 reload > /dev/null
  103.     else
  104.         /etc/init.d/squid3 reload > /dev/null
  105.     fi
  106.     if [ ! -f "/etc/init.d/ssh" ]
  107.     then
  108.         service ssh reload > /dev/null
  109.     else
  110.         /etc/init.d/ssh reload > /dev/null
  111.     fi
  112. fi
  113. if [ -d "/etc/squid/" ]
  114. then
  115.         wget pastebin.com/raw/HPMGcA4J -O /tmp/sqd1
  116.     echo "acl url3 dstdomain -i $ipdovps" > /tmp/sqd2
  117.     wget pastebin.com/raw/HPMGcA4J -O /tmp/sqd3
  118.     cat /tmp/sqd1 /tmp/sqd2 /tmp/sqd3 > /etc/squid/squid.conf
  119.     wget pastebin.com/raw/mU6xKGRr -O /etc/squid/payload.txt
  120.     echo " " >> /etc/squid3/payload.txt
  121.     grep -v "^Port 443" /etc/ssh/sshd_config > /tmp/ssh && mv /tmp/ssh
  122. /etc/ssh/sshd_config
  123.     echo "Port 443" >> /etc/ssh/sshd_config
  124.     grep -v "^PasswordAuthentication yes" /etc/ssh/sshd_config >
  125. /tmp/passlogin && mv /tmp/passlogin /etc/ssh/sshd_config
  126.     echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
  127.     wget pastebin.com/raw/p1WmaUE4 -O /bin/addhost
  128.     chmod +x /bin/addhost
  129.     wget pastebin.com/raw/Tu1mb1Yi -O /bin/alterarsenha
  130.     chmod +x /bin/alterarsenha
  131.     wget pastebin.com/raw/y5qPjxF8 -O /bin/criarusuario
  132.     chmod +x /bin/criarusuario
  133.     wget pastebin.com/raw/4hj5xgxa -O /bin/delhost
  134.     chmod +x /bin/delhost
  135.     wget pastebin.com/raw/F4Fa4pi9 -O /bin/expcleaner
  136.     chmod +x /bin/expcleaner
  137.     wget pastebin.com/raw/dPvnJUh6 -O /bin/mudardata
  138.     chmod +x /bin/mudardata
  139.     wget pastebin.com/raw/ecuwa0Tj -O /bin/remover
  140.     chmod +x /bin/remover
  141.     wget pastebin.com/raw/3PK7irMB -O /bin/sshlimiter
  142.     chmod +x /bin/sshlimiter
  143.     wget pastebin.com/raw/mTRLcZV8 -O /bin/alterarlimite
  144.     chmod +x /bin/alterarlimite
  145.     wget pastebin.com/raw/mZZsGTLD -O /bin/sshmonitor
  146.     chmod +x /bin/sshmonitor
  147.     if [ ! -f "/etc/init.d/squid" ]
  148.     then
  149.         service squid reload > /dev/null
  150.     else
  151.         /etc/init.d/squid reload > /dev/null
  152.     fi
  153.     if [ ! -f "/etc/init.d/ssh" ]
  154.     then
  155.         service ssh reload > /dev/null
  156.     else
  157.         /etc/init.d/ssh reload > /dev/null
  158.     fi
  159. fi
  160. echo ""
  161. tput setaf 7 ; tput setab 4 ; tput bold ; echo "Proxy Squid Instalado e rodando nas portas: 80, 3128, 8080 e 8799" ; tput sgr0
  162. tput setaf 7 ; tput setab 4 ; tput bold ; echo "OpenSSH rodando nas portas 22 e 443" ; tput sgr0
  163. tput setaf 7 ; tput setab 4 ; tput bold ; echo "Scripts para gerenciamento de usuário instalados" ; tput sgr0
  164. tput setaf 7 ; tput setab 4 ; tput bold ; echo "Leia a documentação para evitar dúvidas e problemas!" ; tput sgr0
  165. tput setaf 7 ; tput setab 4 ; tput bold ; echo "Para ver os comandos disponíveis use o comando: ajuda" ; tput sgr0
  166. echo ""
  167. if [[ "$optiondb" = '2' ]]; then
  168.     awk -F : '$3 >= 500 { print $1 " 1" }' /etc/passwd | grep -v '^nobody' > /root/usuarios.db
  169. fi
  170. if [[ "$sshcompression" = 's' ]]; then
  171.     grep -v "^Compression yes" /etc/ssh/sshd_config > /tmp/sshcp && mv /tmp/sshcp /etc/ssh/sshd_config
  172.     echo "Compression yes" >> /etc/ssh/sshd_config
  173. fi
  174. if [[ "$sshcompression" = 'n' ]]; then
  175.     grep -v "^Compression yes" /etc/ssh/sshd_config > /tmp/sshcp && mv /tmp/sshcp /etc/ssh/sshd_config
  176. fi
  177. exit 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement