Sample Header Ad - 728x90

iptables does not generates log

2 votes
1 answer
2482 views
I have this script make_firewall.sh with rules for iptables: iptables -F iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp --dport 443 -j ACCEPT iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT iptables -A OUTPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT iptables -A INPUT -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT iptables -A INPUT -p tcp -j LOG --log-level info --log-prefix='[netfilter] ' iptables -A INPUT -p tcp -j LOG --log-prefix='[netfilter] ' iptables -A INPUT -p tcp -j DROP And I have this at /etc/rsyslog.d/my_iptables.conf : :msg,contains,"[netfilter] " /var/log/iptables.log And too this at /etc/rsyslog.conf : # /etc/rsyslog.conf Configuration file for rsyslog. # # For more information see # /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html ################# #### MODULES #### ################# $ModLoad imuxsock # provides support for local system logging #$ModLoad imklog # provides kernel logging support #$ModLoad immark # provides --MARK-- message capability # provides UDP syslog reception #$ModLoad imudp #$UDPServerRun 514 # provides TCP syslog reception #$ModLoad imtcp #$InputTCPServerRun 514 ########################### #### GLOBAL DIRECTIVES #### ########################### # # Use traditional timestamp format. # To enable high precision timestamps, comment out the following line. # $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat # # Set the default permissions for all log files. # $FileOwner root $FileGroup adm $FileCreateMode 0640 $DirCreateMode 0755 $Umask 0022 # # Where to place spool and state files # $WorkDirectory /var/spool/rsyslog # # Include all config files in /etc/rsyslog.d/ # $IncludeConfig /etc/rsyslog.d/*.conf ############### #### RULES #### ############### # # First some standard log files. Log by facility. # auth,authpriv.* -/var/log/auth.log *.*;auth,authpriv.none -/var/log/syslog cron.* -/var/log/cron.log daemon.* -/var/log/daemon.log kern.* -/var/log/kern.log lpr.* -/var/log/lpr.log mail.* -/var/log/mail.log user.* -/var/log/user.log # # Logging for the mail system. Split it up so that # it is easy to write scripts to parse these files. # mail.info -/var/log/mail.info mail.warn -/var/log/mail.warn mail.err -/var/log/mail.err # # Logging for INN news system. # news.crit -/var/log/news/news.crit news.err -/var/log/news/news.err news.notice -/var/log/news/news.notice # # Some "catch-all" log files. # *.=debug;\ auth,authpriv.none;\ news.none;mail.none -/var/log/debug *.=info;*.=notice;*.=warn;\ auth,authpriv.none;\ cron,daemon.none;\ mail,news.none -/var/log/messages # # Emergencies are sent to everybody logged in. # *.emerg :omusrmsg:* # # I like to have messages displayed on the console, but only on a virtual # console I usually leave idle. # #daemon,mail.*;\ # news.=crit;news.=err;news.=notice;\ # *.=debug;*.=info;\ # *.=notice;*.=warn /dev/tty8 # The named pipe /dev/xconsole is for the `xconsole' utility. To use it, # you must invoke xconsole' with the -file' option: # # $ xconsole -file /dev/xconsole [...] # # NOTE: adjust the list below, or you'll go crazy if you have a reasonably # busy site.. # daemon.*;mail.*;\ news.err;\ *.=debug;*.=info;\ *.=notice;*.=warn |/dev/xconsole The content of the folder /var/log is (I checked all files on this folder, but I not found nothing from iptables): -rw-r--r-- 1 root root 1593 Jul 1 17:09 alternatives.log drwxr-x--- 2 root adm 4096 Jul 2 10:13 apache2 drwxr-xr-x 2 root root 4096 Jun 20 16:49 apt -rw-r----- 1 root adm 4490518 Jul 14 22:58 auth.log -rw------- 1 root utmp 495361 Jul 14 19:44 btmp -rw-r----- 1 root adm 180921 Jul 14 20:06 daemon.log -rw-r----- 1 root adm 775 Jun 20 16:59 debug -rw-r----- 1 root adm 1 Nov 9 2015 dmesg -rw-r--r-- 1 root root 132769 Jul 14 20:04 dpkg.log drwxr-s--- 2 Debian-exim adm 4096 Jul 1 17:09 exim4 -rw-r----- 1 root adm 4363 Jul 14 19:43 fail2ban.log -rw-r--r-- 1 root root 3424 Jul 1 17:09 faillog drwxr-xr-x 2 root root 4096 Nov 9 2015 fsck -rw-rw-r-- 1 root utmp 31244 Jul 14 19:44 lastlog -rw-r----- 1 root adm 3748 Jul 14 20:06 messages drwxr-s--- 2 mysql adm 4096 Jun 20 17:03 mysql -rw-r----- 1 mysql adm 0 Jun 20 17:03 mysql.err -rw-r----- 1 mysql adm 0 Jun 20 17:03 mysql.log -rw-r----- 1 root adm 2628602 Jul 14 22:58 syslog -rw-rw-r-- 1 root utmp 40704 Jul 14 19:44 wtmp I'm using: Debian 8 (jessie) with iptables v1.4.21 **My question is: why iptables does not generates any log?** Thanks for any help!
Asked by Allan Andrade (133 rep)
Jul 15, 2016, 03:04 AM
Last activity: May 27, 2025, 06:04 AM