Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PAM_ABL for ssh: it doesn't work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
daschapa
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2006
Posts: 80

PostPosted: Sat Feb 02, 2008 3:39 pm    Post subject: PAM_ABL for ssh: it doesn't work Reply with quote

I'm trying to get PAM_ABL (auto black list) block brute force attacks, but I've failed miserably. I've read the docs, but my ssh stills let me to try to log in indefinitely.

This is my /etc/pam.d/ssh
Code:
#%PAM-1.0

auth       required     pam_shells.so
auth       required     pam_nologin.so
auth       required     pam_abl.so config=/etc/security/pam_abl.conf
auth       include      system-auth
account    include      system-auth
password   include      system-auth
session    include      system-auth


And this is my /etc/security/pam_abl.conf
Code:
# /etc/security/pam_abl.conf
# debug

host_db=/var/lib/abl/hosts.db
host_purge=2d
host_rule=*:5/1h,15/1d
#user_db=/var/lib/abl/users.db
#user_purge=2d
#user_rule=!root:10/1h,30/1d


This are the only two files I've modified. I'm not an expert with PAM, so if you catch where is my mistake, I'll be glad and happy.
Thanx.
_________________
======================
Back to top
View user's profile Send private message
dfelicia
Apprentice
Apprentice


Joined: 11 May 2005
Posts: 281
Location: Southwestern Connecticut

PostPosted: Wed Mar 26, 2008 12:30 am    Post subject: Reply with quote

I'm having the same problem. Anyone?
Back to top
View user's profile Send private message
dfelicia
Apprentice
Apprentice


Joined: 11 May 2005
Posts: 281
Location: Southwestern Connecticut

PostPosted: Wed Mar 26, 2008 5:09 pm    Post subject: Reply with quote

I gave up and switched to sshguard, which works wonderfully. Details are here: http://www.linode.com/forums/viewtopic.php?p=14562
Back to top
View user's profile Send private message
mimosinnet
l33t
l33t


Joined: 10 Aug 2006
Posts: 717
Location: Barcelona, Spain

PostPosted: Sun Jan 18, 2009 2:54 am    Post subject: Reply with quote

Same problem here. I have read this article. I have add the line:

Code:
auth          required        pam_abl.so config=/etc/security/pam_abl.conf


In these files in /etc/pam.d/:
Code:
# grep pam_abl *
sshd:auth       required     pam_abl.so config=/etc/security/pam_abl.conf
system-auth:auth          required        pam_abl.so config=/etc/security/pam_abl.conf
system-login:auth          required        pam_abl.so config=/etc/security/pam_abl.conf


without success. I have also found this thread mentioning this is a persistent issue.

Cheers!
Back to top
View user's profile Send private message
l0l
n00b
n00b


Joined: 10 Jul 2008
Posts: 43

PostPosted: Sun Jan 18, 2009 8:55 am    Post subject: Re: PAM_ABL for ssh: it doesn't work Reply with quote

daschapa wrote:
I'm trying to get PAM_ABL (auto black list) block brute force attacks, but I've failed miserably. I've read the docs, but my ssh stills let me to try to log in indefinitely.
Thanx.


pam_abl did not work for me either long time ago, but pam_tally works very well. Note that it provides subset of functionality of pam_abl.
"http://www.wlug.org.nz/pam_tally(8)"

You only need to put this in /etc/pam.d/sshd :
Code:

auth       required     pam_tally.so onerr=fail deny=4 lock_time=20 unlock_time=3600 audit

This locks ssh for 3600 sec. after 4 failed log in attempts, it accepts passwords even after that but reports incorrect passwords even for good ones! And, the first 4 login attempts you have to wait 20 sec before trying to log in again after an incorrect password or it will report the password is wrong, even if it is good, that's what the lock_time is.

And, btw... I wouldn't fully trust pam. I recommend adding some iptables rules. I actually combine pam_tally and iptables to stop brute force attempts, just in case one of them fails ;)
Back to top
View user's profile Send private message
mimosinnet
l33t
l33t


Joined: 10 Aug 2006
Posts: 717
Location: Barcelona, Spain

PostPosted: Tue Jan 20, 2009 2:10 am    Post subject: Re: PAM_ABL for ssh: it doesn't work Reply with quote

l0l wrote:
pam_abl did not work for me either long time ago, but pam_tally works very well. Note that it provides subset of functionality of pam_abl.
"http://www.wlug.org.nz/pam_tally(8)"

You only need to put this in /etc/pam.d/sshd :
Code:

auth       required     pam_tally.so onerr=fail deny=4 lock_time=20 unlock_time=3600 audit

This locks ssh for 3600 sec. after 4 failed log in attempts, it accepts passwords even after that but reports incorrect passwords even for good ones! And, the first 4 login attempts you have to wait 20 sec before trying to log in again after an incorrect password or it will report the password is wrong, even if it is good, that's what the lock_time is.

And, btw... I wouldn't fully trust pam. I recommend adding some iptables rules. I actually combine pam_tally and iptables to stop brute force attempts, just in case one of them fails ;)


Thanks very very much for the tip and the reference! I have tried it and it works!!! Next step will be to work on iptables and change the default port.

Cheers!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum