Jump to content


Photo

iptables LOG on Dreambox-600


  • Please log in to reply
14 replies to this topic

#1 Beo

  • Member
  • 11 posts

0
Neutral

Posted 8 January 2012 - 01:16

I have compiled the ipt_LOG.ko for openpli. Now I want to put this line on /etc/syslog.conf:

kern.warning /var/log/iptables.log

But when I restart /etc/init/syslog

/etc/syslog.conf: 10: kern.warning: not found

Any idea ??

Re: iptables LOG on Dreambox-600 #2 Erik Slagter

  • PLi® Core member
  • 46,960 posts

+541
Excellent

Posted 8 January 2012 - 09:55

The syslog supplied with any enigma-based image is a very simple implementation by busybox, it's not the traditional bsd syslog, so creating the /etc/syslog file won't work anyway.

If you want to monitor iptables activities just type "dmesg" at regular intervals or log everything remotely (which the busybox syslog CAN do).

Also did you create a kernel with iptables enabled? The kernel in OpenPLi doesn't have iptables enabled.

* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: iptables LOG on Dreambox-600 #3 Beo

  • Member
  • 11 posts

0
Neutral

Posted 8 January 2012 - 20:49

The syslog supplied with any enigma-based image is a very simple implementation by busybox, it's not the traditional bsd syslog, so creating the /etc/syslog file won't work anyway.

If you want to monitor iptables activities just type "dmesg" at regular intervals or log everything remotely (which the busybox syslog CAN do).

Also did you create a kernel with iptables enabled? The kernel in OpenPLi doesn't have iptables enabled.


Using dmesg works ok, the log that I created in iptables appears on dmesg.

On the other hand the file /etc/syslog.conf have this options:

DESTINATION="buffer" # log destinations (buffer file remote)
MARKINT=20 # interval between --mark-- entries [min]
REDUCE=no # reduced-size logging
BUFFERSIZE=64 # buffer: size of circular buffer [kByte]
LOGFILE=/var/log/messages # file: where to log
ROTATESIZE=32 # file: rotate log if grown beyond X [kByte] (busybox 1.2+)
ROTATEGENS=1 # file: keep X generations of rotated logs (busybox 1.2+)
REMOTE=loghost:514 # remote: where to log
FOREGROUND=no # run in foreground (don't use!)


This are all options of the busybox-syslog ??

Re: iptables LOG on Dreambox-600 #4 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 9 January 2012 - 11:19

busybox syslog works fine, with the default /etc/syslog.conf (or /etc/default/busybox-syslog for more recent images) using destination 'buffer' you can use 'logread -f' to monitor the log.
Or switch it to a file on the hdd if you prefer

Re: iptables LOG on Dreambox-600 #5 Beo

  • Member
  • 11 posts

0
Neutral

Posted 9 January 2012 - 19:42

busybox syslog works fine, with the default /etc/syslog.conf (or /etc/default/busybox-syslog for more recent images) using destination 'buffer' you can use 'logread -f' to monitor the log.
Or switch it to a file on the hdd if you prefer


Do you know how to store the log on a file on /media/hdd for example ??

Re: iptables LOG on Dreambox-600 #6 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 9 January 2012 - 20:32

DESTINATION="file"
LOGFILE=/media/hdd/messages

Re: iptables LOG on Dreambox-600 #7 Beo

  • Member
  • 11 posts

0
Neutral

Posted 9 January 2012 - 22:32

I have now like this:

DESTINATION="file" # log destinations (buffer file remote)
MARKINT=20 # interval between --mark-- entries [min]
REDUCE=no # reduced-size logging
BUFFERSIZE=64 # buffer: size of circular buffer [kByte]
LOGFILE=/media/cf/messages # file: where to log
ROTATESIZE=32 # file: rotate log if grown beyond X [kByte] (busybox 1.2+)
ROTATEGENS=1 # file: keep X generations of rotated logs (busybox 1.2+)
REMOTE=loghost:514 # remote: where to log
FOREGROUND=no # run in foreground (don't use!)


But the /media/cf/messages doesn't created, I have restart the syslog daemon, I have restart the machine but nothing.

More ideas ?

Re: iptables LOG on Dreambox-600 #8 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 9 January 2012 - 22:50

do the /etc/syslog.conf settings actually make it to the busybox-syslogd commandline?
(check with ps)
If they don't, check the initscript (something like /etc/init.d/busybox-syslog)

Re: iptables LOG on Dreambox-600 #9 Beo

  • Member
  • 11 posts

0
Neutral

Posted 10 January 2012 - 09:02

I'm trying to find something on the initscript /etc/syslog of yours Dreambox600 image. The daemon that runs with the system log is klogd (viewing with ps) but initscript apparently manage the 2 daemons syslogd and klogd.

Here the code:

#! /bin/sh
#
# syslog		init.d script for busybox syslogd/klogd
#			   Written by Robert Griebl <sandman@handhelds.org>
#			   Configuration file added by <bruno.randolf@4g-systems.biz>
set -e
 
if [ -f /etc/syslog.conf ]; then
		. /etc/syslog.conf
		LOG_LOCAL=0
		LOG_REMOTE=0
		for D in $DESTINATION; do
				if [ "$D" = "buffer" ]; then
						SYSLOG_ARGS="$SYSLOG_ARGS -C$BUFFERSIZE"
						LOG_LOCAL=1
				elif [ "$D" = "file" ]; then
						if [ -n "$LOGFILE" ]; then
								SYSLOG_ARGS="$SYSLOG_ARGS -O $LOGFILE"
						fi
						if [ -n "$ROTATESIZE" ]; then
								SYSLOG_ARGS="$SYSLOG_ARGS -s $ROTATESIZE"
						fi
						if [ -n "$ROTATEGENS" ]; then
								SYSLOG_ARGS="$SYSLOG_ARGS -b $ROTATEGENS"
						fi
						LOCAL=0
				elif [ "$D" = "remote" ]; then
						SYSLOG_ARGS="$SYSLOG_ARGS -R $REMOTE"
						LOG_REMOTE=1
				fi
		done
		if [ "$LOG_LOCAL" = "1" -a "$LOG_REMOTE" = "1" ]; then
				SYSLOG_ARGS="$SYSLOG_ARGS -L"
		fi
		if [ -n "$MARKINT" ]; then
				SYSLOG_ARGS="$SYSLOG_ARGS -m $MARKINT"
		fi
		if [ "$REDUCE" = "yes" ]; then
				SYSLOG_ARGS="$SYSLOG_ARGS -S"
		fi
else
		# default: log to 16K shm circular buffer
		SYSLOG_ARGS="-C"
fi
 
case "$1" in
  start)
		echo -n "Starting syslogd/klogd: "
		start-stop-daemon -S -b -n syslogd -a /sbin/syslogd -- -n $SYSLOG_ARGS
		start-stop-daemon -S -b -n klogd -a /sbin/klogd -- -n
		echo "done"
		;;
  stop)
		echo -n "Stopping syslogd/klogd: "
		start-stop-daemon -K -n syslogd
		start-stop-daemon -K -n klogd
		echo "done"
		;;
  restart)
		$0 stop
		$0 start
		;;
  *)
		echo "Usage: syslog { start | stop | restart }" >&2
		exit 1
		;;
esac
 
exit 0
 

root@dm600pvr /media/ba #ps -aux|grep log
  936 root		664 S   /sbin/klogd -n
  945 root		548 S   grep log

Edited by Beo, 10 January 2012 - 09:07.


Re: iptables LOG on Dreambox-600 #10 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 10 January 2012 - 17:57

klogd delivers to syslogd. Both are needed.

Re: iptables LOG on Dreambox-600 #11 Beo

  • Member
  • 11 posts

0
Neutral

Posted 10 January 2012 - 21:28

I think the problem can be that klogd binary don't have all options available ? For example for write on a file, which is that I need

root@dm600pvr /sbin # klogd --help
BusyBox v1.01 (2011.08.16-22:45+0000) multi-call binary
Usage: klogd [-c n] [-n]
Kernel logger.
Options:
	    -c n    Sets the default log level of console messages to n.
	    -n	  Run as a foreground process.

When I restart /etc/init.d/syslog this is the output always (apparently syslogd is not working ? )

root@dm600pvr /sbin # /etc/init.d/syslog restart
Stopping syslogd/klogd: no syslogd found; none killed.
stopped klogd (pid 991).
done
Starting syslogd/klogd: done


Re: iptables LOG on Dreambox-600 #12 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 10 January 2012 - 21:31

klogd does not write to a file.
You need busybox-syslogd
Just need to find out why it does not get the 'file' destination settings.

Re: iptables LOG on Dreambox-600 #13 Beo

  • Member
  • 11 posts

0
Neutral

Posted 14 January 2012 - 03:41

klogd does not write to a file.
You need busybox-syslogd
Just need to find out why it does not get the 'file' destination settings.


Yes but openpli for dream600 it uses klogd not syslogd, I ask in this forum, because you are the creator of this wonderful image for Dream600.
I noticed that the default values of /etc/syslog.conf for...

DESTINATION="buffer" # log destinations (buffer file remote)
MARKINT=20 # interval between --mark-- entries [min]
REDUCE=no # reduced-size logging
BUFFERSIZE=64 # buffer: size of circular buffer [kByte]
LOGFILE=/var/log/messages # file: where to log
ROTATESIZE=32 # file: rotate log if grown beyond X [kByte] (busybox 1.2+)
ROTATEGENS=1 # file: keep X generations of rotated logs (busybox 1.2+)
REMOTE=loghost:514 # remote: where to log
FOREGROUND=no # run in foreground (don't use!)


don't create the file /var/log/messages, I'm trying tu study the reason, but at the moment I don't know.

My best regards,

Re: iptables LOG on Dreambox-600 #14 hemispherical1

  • Senior Member
  • 1,596 posts

+49
Good

Posted 14 January 2012 - 04:57

Worked fine on a 500+ image. Normally I use remote logging. I just switched "remote" to "file" in syslog.conf and ran /etc/init.d/syslog restart at which point the messages log file appeared under /var/log. Did you make any other changes? Are both syslogd & klogd actually running?

1070 root 676 S /sbin/syslogd -n -O /var/log/messages -m 60
1072 root 664 S /sbin/klogd -n

--
hemi

Re: iptables LOG on Dreambox-600 #15 Beo

  • Member
  • 11 posts

0
Neutral

Posted 15 January 2012 - 20:29

Worked fine on a 500+ image. Normally I use remote logging. I just switched "remote" to "file" in syslog.conf and ran /etc/init.d/syslog restart at which point the messages log file appeared under /var/log. Did you make any other changes? Are both syslogd & klogd actually running?

1070 root 676 S /sbin/syslogd -n -O /var/log/messages -m 60
1072 root 664 S /sbin/klogd -n

--
hemi


The other day I haven't syslogd started, now I have but the /var/log/messages don't created

26044 root 676 S /sbin/syslogd -n -C64 -m 20
26046 root 664 S /sbin/klogd -n


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users