Advertisement
Guest User

Untitled

a guest
Apr 8th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ############################################################################
  4. # Squid Proxy Installer (SPI) #
  5. # Version: 2.0 Build 2017 #
  6. # Branch: Stable #
  7. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  8. # Author: Hidden Refuge (© 2014 - 2016) #
  9. # License: MIT License #
  10. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  11. # GitHub Repo: https://github.com/hidden-refuge/spi/ #
  12. # SPI Wiki: https://github.com/hidden-refuge/spi/wiki #
  13. ############################################################################
  14.  
  15. # Declaring a few misc variables
  16. vspiversion=2.0 # SPI version
  17. vspibuild=2017 # SPI build number
  18. vbranch=Stable # SPI build branch
  19. vsysarch=$(getconf LONG_BIT) # System architecture
  20.  
  21. # Function for iptables rules (CentOS 5 & 6)
  22. firew1 () {
  23. # Opening default Squid port 3128 for clients to connect
  24. iptables -I INPUT -p tcp --dport 3128 -j ACCEPT
  25. # Saving firewall rules
  26. service iptables save
  27. }
  28.  
  29. # Function for iptables rules (CentOS 7, Debian, Ubuntu, Fedora)
  30. firew2 () {
  31. # Opening default Squid port 3128 for clients to connect
  32. iptables -I INPUT -p tcp --dport 3128 -j ACCEPT
  33. # Saving firewall rules
  34. iptables-save
  35. }
  36.  
  37. main () {
  38. username=$1
  39. password=$2
  40.  
  41. echo $1
  42. echo $2
  43. # Installing necessary packages (Squid, httpd-tools for htpasswd and dependencies)
  44. yum install squid httpd-tools -y
  45. # Creating user with username from $usrn and asking user to set a password
  46. htpasswd -b -c /etc/squid/passwd $username $password
  47. # Downloading Squid configuration
  48. wget -O /etc/squid/squid.conf https://raw.githubusercontent.com/hidden-refuge/squid-proxy-installer/master/spi-rhel7.conf --no-check-certificate
  49. # Creating empty blacklist.acl file for further blacklisting entries
  50. touch /etc/squid/blacklist.acl
  51. # Restarting Squid and enabling its service
  52. systemctl restart squid.service && systemctl enable squid.service
  53. # Running function firew2
  54. firew2
  55. }
  56.  
  57. main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement