Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I know it's running (two different config programs show the firewall enabled, iptables -L -v returns a ruleset and an external firewall test says I'm running in full stealth mode), but I can't recover a log via fwlogwatch,
[root@terrarium root]# fwlogwatch
fwlogwatch summary
Generated Tuesday March 01 00:03:50 PST 2005 by root.
0 of 10031 entries in the file "/var/log/messages" are packet logs, 0 have unique characteristics.
No valid time entries found.
All entries were logged by the same host: "".
All entries are from the same chain: "".
All entries have the same target: "".
All entries are from the same interface: "".
which tells me that:
1) the log is somewhere other than /var/log/messages
or
2) the thing *isn't keeping* a log.
Originally posted by alizard 1) the log is somewhere other than /var/log/messages
or
2) the thing *isn't keeping* a log.
You are correct. Even if you are logging the violations somewhere else (check your /etc/syslog.conf file for "kern.=warn" settings), the violations would likely still showup in /var/log/messages b/c that's wehre everything shows up. So now we look at #2. Do the following:
Code:
# iptables -nL
and look for rules with a target of LOG. Should like something like the following:
Re: Re: how do I enable logging in iptables for FC2?
Quote:
Originally posted by TruckStuff You are correct. Even if you are logging the violations somewhere else (check your /etc/syslog.conf file for "kern.=warn" settings), the violations would likely still showup in /var/log/messages b/c that's wehre everything shows up. So now we look at #2. Do the following:
Code:
# iptables -nL
and look for rules with a target of LOG. Should like something like the following:
Re: Re: Re: how do I enable logging in iptables for FC2?
Quote:
Originally posted by alizard ================================
So adding these rules to the right .conf file should get me logging? Thanks, I'll give it a try.
Where can I find a good set of rules to turn logging on? Will the sample you posted work? Should this go at the end of the config file? Is there anything else I need to know?
To much info can be counter productive so decided on what to log, for example do you really need to logs every packet going through your system, probably not.
If your paranoid and want to logs the first connection for each new access then just log the first SYN flag request for a handshake, also set a limit, if someone knows your logging you can flood the box causing the mount to full up. That leads me to the next thing, move your logs files to a partition that has a fixed amount of space with house cleaning, so every 7 days or so the logs are removed or compressed etc.
If I was you I would log the following: yes Im paranoid
New connections.
Dropped connections that failed the stateful inspection.
ICMP types 8, 11, 13
Any connections that are invalid due to managed flags.
Heres some examples of this in IPtables.
iptables -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j LOG --log-level info --log-prefix **Invalid flags 1**"
iptables -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j LOG --log-level info --log-prefix **Invalid flags 2**"
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j LOG --log-level info --log-prefix **Invalid flags 3**"
iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j LOG --log-level info --log-prefix **Invalid flags 4**"
iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j LOG --log-level info --log-prefix **Invalid flags 5**"
# use your internet interface
iptables -A INPUT -i eth0 -p tcp ! --syn -m state --state NEW -m limit --limit 1/s --limit-burst 5 -j LOG --log-level info --log-prefix **No SYN flag**
iptables -A INPUT -i eth0 -p tcp --syn -m state --state NEW -m limit --limit 1/s --limit-burst 5 -j LOG --log-level info --log-prefix **New Connection recorded**
iptables -t nat -A PREROUTING -i eth0 -s 192.168.0.0/16 -j LOG --log-level info --log-prefix **Invalid IP on Interface**
iptables -t nat -A PREROUTING -i eth0 -s 10.0.0.0/8 -j LOG --log-level info --log-prefix **Invalid IP on Interface**
iptables -t nat -A PREROUTING -i eth0 -s 172.16.0.0/12 -j LOG --log-level info --log-prefix **Invalid IP on Interface**
iptables -A INPUT -i eth0 -p icmp --icmp-type echo-request -m limit --limit 1/s --limit-burst 1 -j LOG --log-level info --log-prefix **ping request**
put your loggin in before you drop the packets or you don't log them as they are not passed down the chain in the preprocessing.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.