Thursday, July 12, 2012

iptables configuration

We can set several different configuration values for the iptables.
To flush the current rules we run the below command:
sudo /sbin/iptables -F

To accept a certain port, run the below:
sudo /sbin/iptables -A INPUT -i eth0 -p tcp -m tcp --dport 30000 -j ACCEPT

To accept certain state, run the below:
sudo /sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

We rejected all incoming and forwarded requests:
sudo /sbin/iptables -A INPUT -j REJECT
sudo /sbin/iptables -A FORWARD -j REJECT

Now accept all outgoing and selected incoming request:
sudo /sbin/iptables -A OUTPUT -j ACCEPT
sudo /sbin/iptables -I INPUT -i lo -j ACCEPT

Reject all incoming loop requests
sudo /sbin/iptables -I INPUT ! -i lo -d 127.0.0.0/8 -j REJECT

It displays the existing rules with line numbers
sudo /sbin/iptables -L --line-numbers

We accept HTTP and HTTPS requests.
sudo /sbin/iptables -I INPUT 3 -p icmp -m icmp --icmp-type 8 -j ACCEPT
sudo /sbin/iptables -I INPUT 5 -p tcp --dport 80 -j ACCEPT 
sudo /sbin/iptables -I INPUT 5 -p tcp --dport 443 -j ACCEPT

We enable the logging features of iptables.
sudo /sbin/iptables -I INPUT 8 -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
To save an existing rules table, use the below commands:
sudo sh -c '/sbin/iptables-save > /etc/iptables.save'


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

No comments: