Skip to main content

How To Install DenyHosts on Ubuntu

What is DenyHosts?

This is a python-script for the protection of  ssh server, like fail2ban, but consumes 

far less memory. The script parses the log file and finds failed login attempts and 

prohibits login from these IP addresses.

Installation steps.


Installation process is simple and contains some steps:

1. Retrieve new lists of packages

sudo apt-get update

2. Installation DenyHosts:

sudo apt-get install denyhosts

If the process is successfully completed, you will see the information of the screen:




After installation you can add your IP address in whitelist:

sudo nano /etc/hosts.allow

and insert following string:

sshd: 12.34.45.678

Where “12.34.45.678” – your IP address

And restart denyhost:

sudo service denyhosts restart

Configuration denyhosts.


After the installation process, the DenyHosts is ready to work, but some 

configuration options are noteworthy. All configuration values are in the file 

/etc/denyhosts.conf

1. PURGE_DENY: removed HOSTS_DENY entries that are older than this 

time.

Default value is empty and all listed ip-addresses remain in the file 

/etc/hosts.deny forever.

2. BLOCK_SERVICE: the service name that should be blocked in 

HOSTS_DENY

Default value = sshd, By default, the service protects only ssh server, but it 

can be customized to other services.

3. ADMIN_EMAIL: if you would like to receive report from denyhosts.

Default value = root@localhost, but you can change this value to your email.

After changing the settings, you should restart the DenyHosts again:

sudo service denyhosts restart

The result of  DenyHosts you can see in the file:  /etc/hosts.deny





Comments

Simon Smith said…
I like denyhosts and have used it for years, but it seems like they've removed it from the official deb repository in 14.04, and you have to install it manually. See:

http://askubuntu.com/questions/433924/package-denyhosts-in-ubuntu-trusty-tahr-is-deleted-temporary-or-forever

I haven't messed around with the manual install yet.

Popular posts from this blog

How to set or disable auto-logout on bash shell

Following information is intended for bash shell only.
The system variable TMOUT can be set to specify the amount of time the user is inactive before the user is automatically logged out.
Set the following listed below in the /root/.bashrc file: TMOUT=XXX #
The system will logout the root account after one hour of inactivity. The value entered for the TMOUT= variable is in seconds. To represent 1 hour, we have to multiply as follows: 1 hour is 60 minutes. 60 minutes * 60 seconds = 3600 seconds.
After setting the parameter, the intended user will need to log out and then log in for the changes to take effect. To make modifications apply to all users on the system, specify the TMOUT variable in /etc/ profile.
To disable auto-logout simply comment out or delete the line with TMOUT value

Provided by:Forthscale systems, cloud experts

How to install PGPool II on PostgreSQL Servers in master-slave architecture + PGPoolAdmin web managment

General InformationPGPool can run on same server along with PostgreSQL DB or on stand alone server(recommended). In this article we will install PGPool on stand alone server, but the only difference is connection ports on PGPool and PostgreSQL. We will install PGPool II 3.1 on PostgreSQL 9.1.


Basic architecture: ┏───────────────┓ │                │ │    pgpool-1    │ │  pgpool server │ │                │ ┗───────────────┛ //             \\ //               \\ //                 \\ \\//                \\// \/                  \/ ┏───────────────┓           ┏───────────────┓ │                │           │                │ │    pgsql-1     │ streaming │     pgsql-2    │ │  pgsql master  │══════════>│  pgsql slave   │ │     server     │replication│     server     │ │                │           │                │ ┗───────────────┛           ┗───────────────┛


Fail cases:Slave failsIn case slave server will fail PGPool will start failover.sh script and will mark server as Down (state 3). I…

Setting Filezilla Server on Amazon EC2 instance with passive ftp

If you want to set Filezilla  ftp server to handle passive connections on your AWS EC2 instances, you should do the following.

Select non used TCP ports, for example 9024-9048 range

Configure firewalls:

In your AWS EC2 security group, allow the incoming connections on chosen ports:

tcp port 20
tcp port 21
tcp port 9024-9048

If using Windows firewall  on you instance, allow connections on same ports.

Now configure Filezilla to use specific port range on Passive connections:

Open Filezilla management console.

Got to: Edit > Settings > Passive Mode Settings

'External Server IP Address for passive mode transfers'

If you use AWS Elastic IP, enter it in "Use the following IP",
if not - use Filezilla provided web service with "Retrieve external IP address from" option.

Check 'Don't use external IP for local connections'

Check 'Use custom port range'

Enter chosen values (in our example) 9024 - 9048 for custom port range.

Powered by 123Con…