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 12-13-2005, 08:20 AM   #1
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Rep: Reputation: 15
Help with syslog.conf ?


I have log info being thrown into /var/log/syslog that I would rather have echoed to just /var/log/router.

The host of the machine is 192.168.1.1. I have entered this line in /etc/syslog.conf

*192.168.1.1* -/var/log/router

So the "router" log gets filled, but at the same time it still echos to syslog. My syslog is 4MB. How can I make it stop?

A sample of the output:
Code:
Dec 13 10:00:21 192.168.1.1 kernel: ACCEPT IN=vlan1 OUT=br0 SRC=84.251.255.166 DST=192.168.1.11 LEN=52 TOS=0x00 PREC=0x80 TTL=50 ID=12756 DF PROTO=TCP SPT=1986 DPT=1412 SEQ=888723016 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B40103030201010402)
Dec 13 10:00:23 192.168.1.1 kernel: DROP IN=vlan1 OUT= MAC=ff:ff:ff:ff:ff:ff:00:02:fc:83:d8:54:08:00:45:00:01:48 SRC=10.38.32.1 DST=255.255.255.255 LEN=328 TOS=0x00 PREC=0x00 TTL=255 ID=20091 PROTO=UDP SPT=67 DPT=68 LEN=308
Dec 13 10:00:24 192.168.1.1 kernel: ip_nat_mangle_udp_packet: undersized packet
Dec 13 10:00:28 192.168.1.1 kernel: ACCEPT IN=vlan1 OUT=br0 SRC=62.101.51.112 DST=192.168.1.11 LEN=225 TOS=0x00 PREC=0x00 TTL=106 ID=44145 PROTO=UDP SPT=63537 DPT=1412 LEN=205
Dec 13 10:00:31 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.11 DST=81.235.155.42 LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=47384 DF PROTO=TCP SPT=3407 DPT=17769 SEQ=283902878 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B401010402)
Dec 13 10:00:32 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.11 DST=217.115.41.248 LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=47432 DF PROTO=TCP SPT=3408 DPT=11935 SEQ=675833211 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B401010402)
Dec 13 10:00:35 192.168.1.1 kernel: ACCEPT IN=vlan1 OUT=br0 SRC=83.67.104.241 DST=192.168.1.11 LEN=48 TOS=0x00 PREC=0x80 TTL=116 ID=32756 DF PROTO=TCP SPT=1541 DPT=1412 SEQ=1530509945 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (0204059801010402)
Dec 13 10:00:35 192.168.1.1 kernel: ACCEPT IN=vlan1 OUT=br0 SRC=84.251.255.166 DST=192.168.1.11 LEN=52 TOS=0x00 PREC=0x80 TTL=50 ID=14043 DF PROTO=TCP SPT=2019 DPT=1412 SEQ=2622878081 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B40103030201010402)
Dec 13 10:00:41 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.11 DST=83.109.164.48 LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=47655 DF PROTO=TCP SPT=3409 DPT=16187 SEQ=1003809200 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B401010402)
Dec 13 10:00:43 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.101 DST=66.135.202.135 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=23514 DF PROTO=TCP SPT=52688 DPT=80 SEQ=2326942785 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B4010303000101080A0FF5137300000000)
Dec 13 10:00:43 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.101 DST=207.218.206.82 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=23525 DF PROTO=TCP SPT=52689 DPT=80 SEQ=2653178178 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B4010303000101080A0FF5137300000000)
Dec 13 10:00:43 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.101 DST=17.254.32.16 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=23529 DF PROTO=TCP SPT=52690 DPT=80 SEQ=3106849475 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B4010303000101080A0FF5137300000000)
Dec 13 10:00:43 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.101 DST=66.135.202.135 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=23532 DF PROTO=TCP SPT=52691 DPT=80 SEQ=1229839357 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B4010303000101080A0FF5137300000000)
Dec 13 10:00:43 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.101 DST=66.135.210.112 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=23556 DF PROTO=TCP SPT=52692 DPT=443 SEQ=4168820227 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B4010303000101080A0FF5137400000000)
Dec 13 10:00:43 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.101 DST=66.135.210.112 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=23561 DF PROTO=TCP SPT=52693 DPT=443 SEQ=2901781940 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B4010303000101080A0FF5137400000000)
Dec 13 10:00:48 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.11 DST=85.165.108.60 LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=47854 DF PROTO=TCP SPT=3410 DPT=6882 SEQ=3207708539 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B401010402)
Dec 13 10:00:49 192.168.1.1 kernel: ACCEPT IN=vlan1 OUT=br0 SRC=81.232.114.36 DST=192.168.1.11 LEN=52 TOS=0x00 PREC=0x80 TTL=49 ID=49587 DF PROTO=TCP SPT=62529 DPT=1412 SEQ=1383136376 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B40103030201010402)
Dec 13 10:00:50 192.168.1.1 kernel: ACCEPT IN=vlan1 OUT=br0 SRC=62.101.51.112 DST=192.168.1.11 LEN=225 TOS=0x00 PREC=0x00 TTL=106 ID=47221 PROTO=UDP SPT=63537 DPT=1412 LEN=205
Dec 13 10:00:55 192.168.1.1 kernel: DROP IN=vlan1 OUT= MAC=ff:ff:ff:ff:ff:ff:00:02:fc:83:d8:54:08:00:45:00:01:48 SRC=10.38.32.1 DST=255.255.255.255 LEN=328 TOS=0x00 PREC=0x00 TTL=255 ID=20120 PROTO=UDP SPT=67 DPT=68 LEN=308
Dec 13 10:00:56 192.168.1.1 kernel: ACCEPT IN=vlan1 OUT=br0 SRC=86.126.82.17 DST=192.168.1.11 LEN=48 TOS=0x00 PREC=0x80 TTL=109 ID=54755 DF PROTO=TCP SPT=3389 DPT=1412 SEQ=828447561 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B401010402)
A paste of my syslog.conf
Code:
# /etc/syslog.conf
# For info about the format of this file, see "man syslog.conf"
# and /usr/doc/sysklogd/README.linux.  Note the '-' prefixing some
# of these entries;  this omits syncing the file after every logging.
# In the event of a crash, some log information might be lost, so
# if this is a concern to you then you might want to remove the '-'.
# Be advised this will cause a performation loss if you're using
# programs that do heavy logging.

# Uncomment this to see kernel messages on the console.
#kern.*                                                 /dev/console
*192.168.1.1* -/var/log/router

# Log anything 'info' or higher, but lower than 'warn'.
# Exclude authpriv, cron, mail, and news.  These are logged elsewhere.
*.info;*.!warn;\
        authpriv.none;cron.none;mail.none;news.none     -/var/log/messages

# Log anything 'warn' or higher.
# Exclude authpriv, cron, mail, and news.  These are logged elsewhere.
*.warn;\
        authpriv.none;cron.none;mail.none;news.none     -/var/log/syslog

# Debugging information is logged here.
*.=debug                                                -/var/log/debug

# Private authentication message logging:
authpriv.*                                              -/var/log/secure

# Cron related logs:
cron.*                                                  -/var/log/cron

# Mail related logs:
mail.*                                                  -/var/log/maillog

# Emergency level messages go to all users:
*.emerg                                                 *

# This log is for news and uucp errors:
uucp,news.crit                                          -/var/log/spooler

# Uncomment these if you'd like INN to keep logs on everything.
# You won't need this if you don't run INN (the InterNetNews daemon).
#news.=crit                                     -/var/log/news/news.crit
#news.=err                                      -/var/log/news/news.err
#news.notice                                    -/var/log/news/news.notice

Last edited by sauce; 12-13-2005 at 09:02 AM.
 
Old 12-13-2005, 10:17 AM   #2
TruckStuff
Member
 
Registered: Apr 2002
Posts: 498

Rep: Reputation: 30
I'm a little confused as to your exact configuration. It sounds like your router is running on 192.168.1.1 and is logging remotely to some other machine? If that is the case, you will need to post your /etc/syslog.conf files for *both* machines.

If however, you are simply trying to log iptables violations to a different file on the same box, you need to remove the line you added and add the following to your /etc/syslog.conf:
Code:
kern.=warn  /var/log/router
then restart the syslog daemon:
Code:
/etc/init.d/syslog restart
for the changes to take effect. As long as you don't change anything else in the syslog.conf, all iptables violations will still be logged to /var/log/messages as well as /var/log/router.
 
Old 12-13-2005, 11:26 AM   #3
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by TruckStuff
I'm a little confused as to your exact configuration. It sounds like your router is running on 192.168.1.1 and is logging remotely to some other machine? If that is the case, you will need to post your /etc/syslog.conf files for *both* machines.

If however, you are simply trying to log iptables violations to a different file on the same box, you need to remove the line you added and add the following to your /etc/syslog.conf:
Code:
kern.=warn  /var/log/router
then restart the syslog daemon:
Code:
/etc/init.d/syslog restart
for the changes to take effect. As long as you don't change anything else in the syslog.conf, all iptables violations will still be logged to /var/log/messages as well as /var/log/router.
My router is a Linksys WRT54G which runs Linux out-of-the-box. I set it to log to my slackware box and started up syslog with -r switch (allows remote logging).

I don't think your line would work because what if my Slackware's kernel sends out a warning? It will be logged in router, and not syslog. I think I need a line that tells syslogd. Here is a crude example in a script type language I just made up in my head...

If kern.warn is_from 192.168.1.1
then { write /var/log/router }
else { write /var/log/syslog }

Any logs from 192.168.1.1 (Linksys router) I would like to send to a separate log called "/var/log/router" and not have logged in syslog. I know that there are other log daemons that could do this better but I don't feel I need to switch because the packaged one can handle this just fine as soon as I figure out how to configure it for it.
 
Old 12-13-2005, 01:06 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
If kern.warn is_from 192.168.1.1
AFAIK 'regular' syslogd doesn't do much filtering other that facility/priority.
 
Old 12-13-2005, 01:59 PM   #5
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Original Poster
Rep: Reputation: 15
I've wasted too much time on this problem. I don't feel like wasting any more on installing and configuring a new syslogd. Router traffic info is just a novelty, its not that important.

I don't understand why I can't forward lines matching 192.168.1.1 to one file and one file only.
 
Old 12-14-2005, 10:09 AM   #6
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Original Poster
Rep: Reputation: 15
Bump once more
 
Old 12-14-2005, 10:43 AM   #7
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 honestly don't understand what you want except to confirm this is a stalemate... You said
Quote:
"I know that there are other log daemons that could do this better but I don't feel I need to switch (..)
and I said it's not gonna work that way with the default syslogd daemon: you'll need syslog-ng to have extended filtering capabilities or for example prefix your rulenames and use a logreporting tool/script to extract the lines.
 
Old 12-14-2005, 11:25 AM   #8
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Original Poster
Rep: Reputation: 15
OK, you're right. I just can't believe how simple sysklogd actually is.
 
Old 12-14-2005, 12:30 PM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
At the time syslogd didn't need all that functionality. I could have used filtering myself, but at the time syslog-ng wasnt production system ready, so just went with extracting the data I need. BTW, you'll can also see some examples why "more functionality" doesn't necessarily equal "better" or "more secure" if you google for "complexity is the enemy of security".
 
Old 12-14-2005, 12:38 PM   #10
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Original Poster
Rep: Reputation: 15
I don't need features. What I need is a way for my syslog not to get flooded with iptables traffic from another machine. Take a look here:

Code:
-rw-r--r--  1 root root 11832217 2005-12-14 13:36 syslog
-rw-r-----  1 root root   119821 2005-12-11 00:37 syslog.1
-rw-r-----  1 root root   352829 2005-12-03 20:22 syslog.2
-rw-r-----  1 root root   204331 2005-11-25 14:47 syslog.3
-rw-r-----  1 root root   205119 2005-11-20 01:07 syslog.4
What you see there is a syslog that is accepting remote logs from another machine for approximately 36 hours. In that amount of time my syslog has increased by 30 times it's original size and it's still going! Furthermore, how am I supposed to see any important information about my systems if all of the data is iptables traffic? What about failed ssh attempts, sudo commands, etc?
 
Old 12-14-2005, 02:10 PM   #11
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 don't need features. What I need is a way for my syslog not to get flooded with iptables traffic
With limited resources you got and not wanting to switch sysloggers I can only come up with this: I. limit the amount of logged data from your WRTG by only logging critical errors, maybe even limit messages per/second. II. Test if priority n when using "-j LOG --log-level n" survives remote logging. If it does you could assign a priority way below the facility.priority threshold for /var/log/messages, like "debug". If that works only 192.168.1.1.debug should end up in /var/log/router. If that works you should disable your debug logging though. Haven't tested the above, so YMMV(VM).


What you see there is a syslog that is accepting remote logs from another machine for approximately 36 hours. In that amount of time my syslog has increased by 30 times it's original size and it's still going!
I use Monit to check logsize and trigger a logrotate when size > 1GB :-]


Furthermore, how am I supposed to see any important information about my systems if all of the data is iptables traffic?What about failed ssh attempts, sudo commands, etc?
For SSH and the like you could apply host/login restrictions and install a blocking tool so you have to worry less about that. Sudo errors can be emailed to root. If you like consolidated reports you could use a logreporting tool. There's even some that check continuously and can perform actions when they encounter an anomaly.
 
Old 12-15-2005, 04:49 PM   #12
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Original Poster
Rep: Reputation: 15
Problem solved. Installed syslog-ng (which was a headache in itself). Configuring it was easy and I'm enjoying the change.
 
  


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
grep in syslog.conf komo Linux - General 2 11-16-2005 04:56 AM
How to edit /etc/syslog.conf (last message repeated...) slackaddict Slackware 2 11-23-2004 04:21 AM
syslog.conf, can you log to console? stakhous Linux - Newbie 1 07-31-2004 12:22 AM
syslog-ng conf confusion cyph3r7 Linux - Software 0 07-06-2004 11:02 PM
edit /etc/syslog.conf wedgeworth Linux - Software 3 04-08-2004 01:58 PM

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

All times are GMT -5. The time now is 07:53 PM.

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