Wednesday 8 October 2014

Script that will create a local proxy server for your lan or local netwook

Script that will create a local proxy server for your lan or local netwook on Red hat , Fedora and CentOS

writer:Anuj Borah
email: anujborah1@gmail.com





#!/bin/bash
clear
echo "############This script will make a local porxy server for your home network ###########"
if [ $UID -eq 0 ]
then
read -p "press ENTER to proceed"
rpm -q squid
if [ $? -eq 0 ]
then
read -p "squid is altready installed to yuor system. Press ENTER to proceed"
clear
echo -e "Now give me the ip  or range of home lan ips to include in the access list . some exaples are given bellow.\n1.ip-addess/netmak\n2.ip-addr1-ip-addr2/netmask"
read q
echo "acl anuj $q
http_access allow anuj" >> /etc/squid/squid.conf 2&>1
echo "All done.  just make sure your local lan pcs brosers config look like ip = $q and port 3128 . Now your local lan pcs got internet connecion.  "
iptables --polict  INPUT ACCEPT > /dev/null
iptables --polict  OUTPUT ACCEPT > /dev/null


else
echo "Installing squid .."
yum install squid 2&>1
clear
echo -e "Now give me the ip  or range of home lan ips to include in the access list . some exaples are given bellow.\n1.ip-addess/netmak\n2.ip-addr1-ip-addr2/netmask"
read q
echo "acl anuj $q
http_access allow anuj" >> /etc/squid/squid.conf 2&>1
echo "All done.  just make sure your local lan pcs brosers config look like ip = $q and port 3128 . Now your local lan pcs got internet connecion.  "
iptables --polict  INPUT ACCEPT > /dev/null
iptables --polict  OUTPUT ACCEPT > /dev/null
fi
else
echo "We need you to login as root. Try again as $0"
fi

No comments:

Post a Comment

Popular Posts