LinuxQuestions.org
Help answer threads with 0 replies.
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 01-26-2011, 09:48 AM   #1
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Question Logs of TCP Wrappers


Hi All,

I have a CENTOS 5.5 boxes.
I want to block all ssh services to domain test.com.

For this, I have made the below entry in /etc/host.deny
Code:
sshd : .test.com  \ : spawn /bin/echo `/bin/date` access denied>>/var/log/sshd.log
This works properly and log as below in /var/log/sshd.log
Code:
Wed Jan 26 21:06:10 IST 2011 access denied
Can I also log the IP and username of the system from which the ssh request came ?

Is there any other log file for TCP Wrappers, there were no logs in /var/log/messages.

Code:
# tail -f  /var/log/messages -f /var/log/sshd.log
==> /var/log/messages <==
Jan 26 20:27:46 gateway yum: Installed: dansguardian-2.8.0.6-1.2.el5.rf.i386
Jan 26 20:28:15 gateway clamd[3915]: SelfCheck: Database status OK.
Jan 26 20:30:43 gateway kernel: ip_tables: (C) 2000-2006 Netfilter Core Team
Jan 26 20:30:43 gateway kernel: Netfilter messages via NETLINK v0.30.
Jan 26 20:30:43 gateway kernel: ip_conntrack version 2.4 (4096 buckets, 32768 max) - 228 bytes per conntrack
Jan 26 20:38:14 gateway init: Trying to re-exec init
Jan 26 20:41:22 gateway clamd[3915]: SelfCheck: Database status OK.
Jan 26 20:53:08 gateway yum: Installed: zsh-html-4.2.6-3.el5.i386

==> /var/log/sshd.log <==
Wed Jan 26 21:06:10 IST 2011 access denied
Wed Jan 26 21:13:05 IST 2011 access denied

Last edited by vikas027; 01-26-2011 at 11:00 AM. Reason: Added my OS
 
Old 01-26-2011, 10:25 AM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
RHEL-based system?

On systems where sshd(8) is compiled with libwrap.so (tcp wrappers), the logging goes to the same place as sshd logging. On RHEL systems, that would be /var/log/secure.
 
Old 01-26-2011, 11:02 AM   #3
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Original Poster
Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by anomie View Post
RHEL-based system?

On systems where sshd(8) is compiled with libwrap.so (tcp wrappers), the logging goes to the same place as sshd logging. On RHEL systems, that would be /var/log/secure.
Hi Anomie,

I forgot to write by OS name, have edited it now.

I know I can find out this info in /var/log/secure, but other logs would also be logged in it. I was just curious to know if we have any such option in TCP wrappers to just log for one rule.

Thanks for your time.
 
Old 01-26-2011, 12:20 PM   #4
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
Try:

Code:
sshd : .test.com  \ : spawn /bin/echo `/bin/date` access denied for %u on host %a>>/var/log/sshd.log

Last edited by frndrfoe; 01-26-2011 at 12:22 PM.
 
Old 01-28-2011, 08:31 AM   #5
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Original Poster
Rep: Reputation: 107Reputation: 107
Thumbs up

Quote:
Originally Posted by frndrfoe View Post
Try:

Code:
sshd : .test.com  \ : spawn /bin/echo `/bin/date` access denied for %u on host %a>>/var/log/sshd.log

Hi frndrfoe,

Many thanks !

It helped me to find the IP which is trying to ssh but not the username.

Now, I am getting the below logs

Code:
[root@gateway ~]# tail -5f /var/log/sshd.log
Wed Jan 26 21:32:18 IST 2011 access denied
Fri Jan 28 19:53:57 IST 2011 access denied
Fri Jan 28 19:55:13 IST 2011 access denied
Fri Jan 28 19:55:53 IST 2011 access denied for unknown on host ::ffff:192.168.0.10
Fri Jan 28 19:56:09 IST 2011 access denied for unknown on host ::ffff:192.168.0.10
Any other ideas ?
 
Old 01-28-2011, 10:56 AM   #6
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
Does /var/log/secure have a corresponding failure entry with a username?

from man hosts.allow
%u The client user name (or "unknown").

Last edited by frndrfoe; 01-28-2011 at 01:34 PM.
 
Old 01-29-2011, 04:02 PM   #7
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Original Poster
Rep: Reputation: 107Reputation: 107
Yes it has an entry but not of username.
 
  


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
tcp wrappers nishith Linux - Security 4 11-11-2008 04:45 AM
Tcp wrappers sysconfig Linux - Security 4 09-08-2006 08:20 AM
TCP Wrappers ? juanb Linux - Newbie 1 01-31-2004 01:35 PM
tcp wrappers --with-tcp-wrappers ForumKid Linux - Security 2 01-04-2002 04:01 PM
TCP Wrappers ltrain Linux - Security 6 05-31-2001 10:40 PM

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

All times are GMT -5. The time now is 07:55 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