Identify and Verify Gnome Users Based on How They Type

Posted on in Categories Gnome, Hardware, Howto, Linux, Linux desktop last updated April 4, 2008

This tutorial explains GDM (GNOME Display Manager) modification to support user verification through keystroke-dynamics processing. Modified GDM allows only you to login. If you go ahead and tell your password to a friend. They still won’t be able to log in using GDM without knowing the precise method of typing required when entering your user name.

You can create and store a one-way encrypted hash of your keystroke patterns when entering your user name. Add code to GDM to read current keystroke patterns and permit a user to log in when the characteristics are a match.

Many commercial products today provide two-factor authentication on Linux systems. These technologies generally require the purchase of additional hardware and create a closed implementation unsuitable for many environments. The code and processes presented here allow you to implement a low-cost authentication-input system based on the characteristics of how a user types his password into the GDM. Moving beyond examples and into implementation, the modifications to GDM presented here allow you to enhance the security of your computer.

=> Identify and verify users based on how they type

Lighttpd restrict or deny access by IP address

Posted on in Categories Howto, lighttpd, Linux, News, Security, UNIX last updated December 4, 2007
Lighttpd logo

So how do you restrict or deny access by IP address using Lighttpd web server?

Lighttpd has mod_access module. The access module is used to deny access to files with given trailing path names. You need to combine this with remoteip conditional configuration. Syntax is as follows:

$HTTP[“remoteip”] == “IP” : Match on the remote IP
$HTTP[“remoteip”] !~ “IP1|IP2” : Do not match on the remote IP (perl style regular expression not match)
$HTTP[“remoteip”] =~ “IP1|IP2” : Match on the remote IP (perl style regular expression match)

Task: Match on the remote IP

For example block access to url if IP address is NOT and (restrict access to these 2 IPs only):

Open /etc/lighttpd/lighttpd.conf file
# vi /etc/lighttpd/lighttpd.conf
Append following configuration directive:

$HTTP["remoteip"] !~ "|" {
    $HTTP["url"] =~ "^/stats/" {
      url.access-deny = ( "" )

Save and restart lighttpd:
# /etc/init.d/lighttpd restart

Task: Block single remote IP

Do not allow IP address to access our site:

$HTTP["remoteip"] == "" {
       url.access-deny = ( "" )

Do not allow IP address, to access our site:
Do not allow IP address to access our site:

$HTTP["remoteip"] =~ "|" {
       url.access-deny = ( "" )

See also

=> Lighttpd deny access to certain files

Linux Iptables Limit the number of incoming tcp connection / syn-flood attacks

Posted on in Categories Howto, Iptables, Linux, RedHat/Fedora Linux, Security, Suse Linux last updated October 14, 2007

A SYN flood is a form of denial-of-service attack in which an attacker sends a succession of SYN requests to a target’s system. This is a well known type of attack and is generally not effective against modern networks. It works if a server allocates resources after receiving a SYN, but before it has received the ACK.

if Half-open connections bind resources on the server, it may be possible to take up all these resources by flooding the server with SYN messages. Syn flood is common attack and it can be block with following iptables rules:

iptables -A INPUT -p tcp --syn -m limit --limit 1/s --limit-burst 3 -j RETURN

All incoming connection are allowed till limit is reached:

  • –limit 1/s: Maximum average matching rate in seconds
  • –limit-burst 3: Maximum initial number of packets to match

Open our iptables script, add the rules as follows:

# Limit the number of incoming tcp connections
# Interface 0 incoming syn-flood protection
iptables -N syn_flood
iptables -A INPUT -p tcp --syn -j syn_flood
iptables -A syn_flood -m limit --limit 1/s --limit-burst 3 -j RETURN
iptables -A syn_flood -j DROP
#Limiting the incoming icmp ping request: 
iptables -A INPUT -p icmp -m limit --limit  1/s --limit-burst 1 -j ACCEPT

iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j LOG --log-prefix PING-DROP:
iptables -A INPUT -p icmp -j DROP

iptables -A OUTPUT -p icmp -j ACCEPT

First rule will accept ping connections to 1 per second, with an initial burst of 1. If this level crossed it will log the packet with PING-DROP in /var/log/message file. Third rule will drop packet if it tries to cross this limit. Fourth and final rule will allow you to use the continue established ping request of existing connection.

  • ‐‐limit rate: Maximum average matching rate: specified as a number, with an optional ‘/second’, ‘/minute’, ‘/hour’, or ‘/day’ suffix; the default is 3/hour.
  • ‐‐limit‐burst number: Maximum initial number of packets to match: this number gets recharged by one every time the limit specified above is not reached, up to this number; the default is 5.

You need to adjust the –limit-rate and –limit-burst according to your network traffic and requirements.

Let us assume that you need to limit incoming connection to ssh server (port 22) no more than 10 connections in a 10 minute:

iptables -I INPUT -p tcp -s 0/0 -d $SERVER_IP --sport 513:65535 --dport 22 -m state --state NEW,ESTABLISHED -m recent --set -j ACCEPT
iptables -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 600 --hitcount 11 -j DROP
iptables -A OUTPUT -p tcp -s $SERVER_IP -d 0/0 --sport 22 --dport 513:65535 -m state --state ESTABLISHED -j ACCEPT

See also:

More information on recent patch can be found here