Saturday, 4 October 2014

script that will make small firewall for your system


This script will make a small script for your Debian and Ubuntu installed system.

Writer: Anuj Borah
Mail: anujborah1@gmail.com 


#!/bin/bash
clear
echo -e "This a small firewall for your system"
if [ $UID != 0 ]
then
echo "Please login as root and try $0 "
else
echo "First Let Me See Iptables is installed On Your System Or Not ??"
dpkg -l | grep iptables 1&>2
if [ $? -eq 0 ]
then
echo "Make Your Choice"
echo -e "1.Make My System Unrachable From Every-One.But I Can Reach Every-One\n2.I Dont want To Reach Any-One And I Dont Want Others To Reach My System\n3.Make My System Open For Ever-One "
read q
if [ $q -eq 1 ]
then
iptables -F
iptables --policy OUTPUT ACCEPT
iptables --policy INPUT DROP
iptables save
clear
echo -e "All Done. Now My System Unrachable From Every-One.But I Can Reach Every-One.Practically this is not possible :)"
elif [ $q -eq 2 ]
then
iptables -F
iptables --policy INPUT DROP
iptables --policy OUTPUT DROP
iptables save
clear
echo -e "All Done.Now I Dont want To Reach Any-One And I Dont Want Others To Reach My System"
elif [ $q -eq 3 ]
then
iptables -F
iptables --policy INPUT ACCEPT
iptables --policy OUTPUT ACCEPT
iptables save
clear
echo "All Done.Now U Have a open system "
fi
else
clear
echo -e "Soory iptables not installed in your system,  type "sudo apt-get install iptables" to intstall and run $1 once again"
fi
fi

No comments:

Post a Comment

Popular Posts