LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-12-2009, 10:12 AM   #1
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Rep: Reputation: 37
Question SSHGuard does not work


I'm trying to protect CentOS 5.2 from brute force ssh attacks.

Downloaded SSHGuard, compiled and installed successfully, but it does not work.

I set it up according to instructions on their site. syslog.conf contains:
Code:
auth.info;authpriv.info    |/usr/local/sbin/sshguard
I also logged the same thing to a file to make sure syslog works and I see all those messages, but SSHGuard never starts.

Any suggestions welcome!
Thanks.
 
Old 06-12-2009, 11:08 AM   #2
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Original Poster
Rep: Reputation: 37
Well, I gave up on sshguard, but I got fail2ban to work effortlessly.
 
Old 06-12-2009, 11:12 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Not so quick, what do you mean "never starts" or "does not work"? Doesn't it add rules to the table?
 
Old 06-12-2009, 11:58 AM   #4
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Original Poster
Rep: Reputation: 37
Well, according to sshguard docs, it should start and continue running after syslog sends the first line. So I should be able to see it with
Code:
ps -A|grep sshguard
and I don't.

It doesn't add any iptables rules either which is pretty obvious since it isn't running.
Code:
iptables -L
only shows CentOS rules.

Last edited by designator; 06-12-2009 at 01:37 PM.
 
Old 06-13-2009, 07:38 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I built sshguard with this minimal .spec file:
Code:
%define debug_packages	%{nil}
%define debug_package %{nil}
%define name sshguard
%define ver 1.4rc4
%define rel 1

%define _docdir /usr/local/share/doc
%define _mandir /usr/local/share/man
%define _bindir /usr/local/bin
%define _sbindir /usr/local/sbin

Name: %{name}
Summary: %{name}, an iptables-based SSH-port blocker 
Version: %{ver}
Release: %{rel}
License: GPL
Group: Utilities/System
Source0: %{name}-%{ver}.tar.bz2
Prereq: /sbin/iptables
Provides: %{name}
Vendor: mij@bitchx.it
URL: http://sshguard.sourceforge.net
BuildRoot: %{_tmppath}/%{name}-%{version}

%description 
%{name} is an iptables-based SSH-port blocker.

%prep
%setup -n %{name}-%{ver}

%build
%configure --with-firewall=iptables
make

%install
if [ "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}-%{version}" ]; then
	rm -rf $RPM_BUILD_ROOT; make DESTDIR=$RPM_BUILD_ROOT install
else
	echo "Invalid Build root "${RPM_BUILD_ROOT}"."; exit 1
fi
						
%clean
if [ "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}-%{version}" ]; then
	rm -rf $RPM_BUILD_ROOT
else
	echo "Invalid Build root "${RPM_BUILD_ROOT}"."; exit 1
fi

%postun
if [ "$1" = "0" ]; then
	if [ `/sbin/iptables  -n -L %{name}|wc -l)` -ne 0 ]; then
		echo "iptables chain %{name} still contains rules."
		echo "Please review, remove chain and contents manually."
	fi
fi

%files
%defattr(-,root,root)
%doc examples/* scripts/* README Changes
%attr(755,root,root) %{_sbindir}/%{name}
%attr(644,root,root) %{_mandir}/man8/%{name}.8

%changelog
* Sat Jun 12 2009 unSpawn -
- Create minimal .spec.
then tried three options: syslog pipe, FIFO and tailing a logfile.
The syslog pipe needs
Code:
module sshguard 1.0;

require {
        type syslogd_t;
        type sbin_t;
        class dir search;
        class file { read write ioctl };
}

#============= syslogd_t ==============
allow syslogd_t sbin_t:dir search;
allow syslogd_t sbin_t:file { read write ioctl };
but still fails to work as the pipe dies w/o debug output.

FIFO and tail work OK but when you use a FIFO as the docs suggest no auth* messages will end up in the syslog.conf configured logfile, and loss of auditing caps leaves only tailing a logfile as input method.

[EDIT]
Since you were the first to note problems with the package I'd like to add the developer has a user mailing list at http://lists.sourceforge.net/lists/l...sshguard-users, so please feel free to at least tell him it's not working as advertised. Thanks in advance.
[/EDIT]

Last edited by unSpawn; 06-13-2009 at 07:51 AM. Reason: Add developer FUP
 
Old 06-14-2009, 05:49 PM   #6
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Original Poster
Rep: Reputation: 37
Unfortunately, I was working with a production box so I can't use it as a test case to help developer fix the problem. If you have time to provide him additional details, please send the message. I should have time next week to set up a virtual machine to play with SSHGuard and I will then reply to or start the discussion on the mailing list.

Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS lookup doesn't work, ping, firefox will not work properly lovemov Linux - Networking 2 04-23-2009 02:30 PM
sshguard won't compile replay019 Linux - Software 1 01-26-2009 05:03 AM
can't make ethernet on laptop work, wireless and usb work fine ubuntu 8.10 rz1988 Linux - Newbie 10 01-13-2009 02:21 PM
LXer: sshguard: Protection for OpenSSH LXer Syndicated Linux News 0 03-06-2007 09:16 PM
FALCONS EYE (nethack) FAILS ON STARTUP, use to work, wont work even after reinstall roorings Linux - Software 0 10-08-2003 10:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration