Joomla Extensions Demo

Support

Do not submit a bug report if you need technical support or have questions.

Forums

Post your suggestions ask for help in the community forums

Contact Me

Missing images/links, any comments, suggestions, need help? Contact me

Skype

Need desperately help?
Skype Me™! But dont abuse of it!

Restrictive Iptables Based Firewall for Webserver script

This script is working on all Linux standard distribution, but use at your own risk! The script has been made to automated the creation of iptables rules. There is an easy to use menu as well

 

 

 

 

root:~# ./firewall.sh
 Firewall script by www.waltercedric.com
  Credits to all various authors - GNU/GPL 3.0 Script
  Choose one of the following options:

[N]ew firewall rules
[C]lear all firewall rules
[T]est firewall rules
[S]ave firewall rules to /etc/network/iptables
[E]xit

Features

  • Use iptables
  • Allow or disallow most services (dns, http, ftp, smtp, icmp, ntp, ssh …),
  • Protect ssh against too many login attempt in a timeframe,
  • Protect ssh and allow only one ip to use that services,
  • Harden the webserver by dropping illegal http packets,
  • Easy to read and extend script written in bash,
  • GNU/GPL 3.0 Script,
  • To use it, just edit the file firewall.sh and change the variables.

    IPT="/sbin/iptables" ########## Interfaces ########################################## PUB_IF="eth0" # public interface LO_IF="lo" # loopback SERVER_IP=$(ifconfig eth0 | grep 'inet addr:' |
              awk -F'inet addr:' '{ print $2}' | awk '{ print $1}') ########## Allow/block services ################################ ALLOW_SSH="true" ALLOW_HTTP="true" ALLOW_FTP="false" ALLOW_OUTGOING_NTP="true" ALLOW_OUTGOING_SMTP="true" ALLOW_INCOMING_ICMP="true" USE_HARDENING_RULESET="true"

    ########## SSH ################################################# SSH_PORT=22 # This notes every NEW connection to port ${SSH_PORT} and adds it to the recent "list" # If your IP is on the recent list, and you have ${SSH_LOGIN_ATTEMPT}
    # or more entries on the list in the # last ${SSH_LOGIN_ATTEMPT_TIMEFRAME} seconds, we drop your request. SSH_LOGIN_ATTEMPT_PROTECTION="true" SSH_LOGIN_ATTEMPT=4 SSH_LOGIN_ATTEMPT_TIMEFRAME_SECONDS=90 SSH_ALLOW_ONLY_IP="false" SSH_ALLOW_ONLY_IP_LIST="122.xx.yy.zz/29" #### FILES ##### BLOCKED_IP_TDB=/root/.fw/blocked.ip.txt SPOOFIP=""

    The file is available as a Gist https://gist.github.com/1690823

    blog comments powered by Disqus
    Category: Linux

    Donations

    Thank You for supporting my work
    Subscribe to me on YouTube

    Latest Articles

    • If you want an extra gigabyte of storage on your Dropbox account, the online cloud service invites you to compete in i... ...
    • CedTag  has been updated to version 2.5.1 and correct a lot of bugs and contains some nice features. CedTag is the... ...
    • SecurityImages has been updated to version 6.0.3 and correct 1 bugs for both Joomla 1.7 and Joomla 2.5. BUG: If enabl... ...
    • if you encounter this error while starting oracle /etc/init.d/oraemctl start Starting Oracle EM DB Console: Environme... ...
    • I will show you in an Apache Maven configuration file how to copy files to server each time the package phase is execu... ...

    Subscribe

    Latest Comments

    Popular Posts

    rockettheme advertisement

    dropbox logo

    Help Us & Leave Feedback!

    • Do you have an excellent article idea you would like to read about here? Share it!
    • Do you have some interesting tips how we could improve our site?
    • Something missing here? Help us make this blog a better place, leave feedback!
    We would love to hear from you! Be active! Write us now!