Firewall – How Do I Block an IP Address on My Linux server? September 12th, 2010
What is iptable? Iptables is a generic table structure that defines rules and commands as part of the netfilter framework that facilitates Network Address Translation (NAT), packet filtering, and packet mangling in the Linux 2.4 and later operating systems. NAT is the process of converting an Internet Protocol address (IP address) into another IP address. Packet filtering is the process of passing or blocking packets at a network interface based on source and destination addresses, ports, or protocols. Packet mangling is the ability to alter or modify packets before and/or after routing.
Iptables and netfilter are the successor to ipchains and ipfwadm in earlier versions of Linux. Netfilter and iptables are often combined into the single expression netfilter /iptables, which refers to the Linux 2.4 and later subsystems for NAT, firewall, and advanced packet processing.
How do I block an IP address or subnet under Linux operating system?
In order to block an IP on your Linux server you need to use iptables tools (administration tool for IPv4 packet filtering and NAT) and netfilter firewall. First you need to log into shell as root user. To block IP address you need to type iptables command as follows:
Syntax to block an IP address under Linux
Replace IP-ADDRESS with actual IP address. For example if you wish to block ip address 65.55.44.100 for whatever reason then type command as follows:
If you have IP tables firewall script, add above rule to your script.
If you just want to block access to one port from an ip 65.55.44.100 to port 25 then type command:
# iptables -A INPUT -s 65.55.44.100 -p tcp –destination-port 25 -j DROP
The above rule will drop all packets coming from IP 65.55.44.100 to port mail server port 25.
You can also create Security Shell Script to block the ips: Create /root/iptables/blocked.ips file as follows with list of ips and subnets to block entering your dedicated server.
Posted in CentOS, debian, fedora, feebsd, linux, Networking, ubuntu | No Comments »
Unix / Linux Security: Secure your box using (autoban) Denyhosts September 12th, 2010
I wrote a denyhack shell scripts to restrict the hacking users from the server. It was my development with bash script. I am using it for the past three years. Recently, While doing google search, I find an open source (source-forge) software denyhosts,written in python, which does the same function.
Here are some tips to make your Linux server safer from intruders.
I have recently viewed by log files in linux and noticed a few hundreds failed logins from different hosts on my sshd service.
I wanted to secure it using iptables, but this reduced my mobility quite a lot. By denying packets from all hosts and accepting just from a few trusted ones, I ended up not being able to access my server from everywhere i want.
So I started searching on the Internet for an alternative; and I found something called Deny Hosts, an open source project from Sourceforge. This python script is very useful, bringing many options that are an advantage in the fight against hackers.
It’s features include allowed and denied host list files that dynamically update by analyzing the attempts in service’s log files, e-mailing functions to notify you if something happens and a synchronization tool that gets all the hosts that were banned several times around the world and denies them on your server too.
Downloading the script
To download the script, go to http://denyhosts.sourceforge.net/ or if you are using Fedore Core, try “yum install denyhosts”. Read the rest of this entry »
Secure Email Server On Centos June 4th, 2010
Qmailtoaster is a project whose purpose is to install Qmail with RPMs on RPM based Linux and these RPMs are source RPMs. The advantage of Qmailtoaster is that it contains all patches needed for Qmail for example domainkeys etc.
Included Featureset by Qmailtoaster
- Source RPM packages easily rebuilt for multiple distributions
- SMTP with SMTP-AUTH, TLS, REMOTE-AUTH
- DomainKeys, SPF “Sender Policy Framework” and SRS “Sender Rewriting Scheme”
- Integrated SpamAssassin, ClamAV and Simscan
- Warlord virus and worm loader realtime MIME signature scanning
- CHKUSER 2.0 functions for qmail-smtpd
- Qmail-Tap provides email archive capability
- Virtual Domains and Virtual Users using MySQL
- Autoresponder for vacation/away from office messages
- Integrated Mailing List (ezmlm)
- Web-based email system using Squirrelmail
- Web-based administration tools
- POP3, POP3-SSL, IMAP and IMAP-SSL
- Submission port (587) allows roaming users to skip RBL checks and port 25 blocks
- eMPF patch for advanced policy control over email
Qmailtoaster has support for RHEL/CentOS (3.x, 4.x, 5.x , Fedora, Suse, Mandriva. We are going to install Qmailtoaster for CentOS 5.x
Prerequisites: Install Centos 5 base system, remaining packages and dependencies will be installed automatically with qmailtoaster scripts.
1) Configuration Read the rest of this entry »
Posted in CentOS, databases, linux, mysql, Networking | No Comments »
