Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ############################################################################
- # Squid Proxy Installer (SPI) #
- # Version: 2.0 Build 2017 #
- # Branch: Stable #
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
- # Author: Hidden Refuge (© 2014 - 2016) #
- # License: MIT License #
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
- # GitHub Repo: https://github.com/hidden-refuge/spi/ #
- # SPI Wiki: https://github.com/hidden-refuge/spi/wiki #
- ############################################################################
- # Declaring a few misc variables
- vspiversion=2.0 # SPI version
- vspibuild=2017 # SPI build number
- vbranch=Stable # SPI build branch
- vsysarch=$(getconf LONG_BIT) # System architecture
- # Function for iptables rules (CentOS 5 & 6)
- firew1 () {
- # Opening default Squid port 3128 for clients to connect
- iptables -I INPUT -p tcp --dport 3128 -j ACCEPT
- # Saving firewall rules
- service iptables save
- }
- # Function for iptables rules (CentOS 7, Debian, Ubuntu, Fedora)
- firew2 () {
- # Opening default Squid port 3128 for clients to connect
- iptables -I INPUT -p tcp --dport 3128 -j ACCEPT
- # Saving firewall rules
- iptables-save
- }
- main () {
- username=$1
- password=$2
- echo $1
- echo $2
- # Installing necessary packages (Squid, httpd-tools for htpasswd and dependencies)
- yum install squid httpd-tools -y
- # Creating user with username from $usrn and asking user to set a password
- htpasswd -b -c /etc/squid/passwd $username $password
- # Downloading Squid configuration
- wget -O /etc/squid/squid.conf https://raw.githubusercontent.com/hidden-refuge/squid-proxy-installer/master/spi-rhel7.conf --no-check-certificate
- # Creating empty blacklist.acl file for further blacklisting entries
- touch /etc/squid/blacklist.acl
- # Restarting Squid and enabling its service
- systemctl restart squid.service && systemctl enable squid.service
- # Running function firew2
- firew2
- }
- main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement