natlog

natlog.1.00.2.tar.gz

2012-2013


natlog(1)

natlog(1)

natlog.1.00.2.tar.gz natlog

2012-2013

NAME

natlog - source-nat logging tool

SYNOPSIS

natlog [OPTIONS] command

DESCRIPTION

Firewalls like iptables(1) usually offer POSTROUTING (source network address translation, snat) facilities changing the source address of a host behind the firewall to the address of the host before the firewall. With snat the following combinations of IP addresses and port numbers are encountered:

Source natting usually uses sport for fwport, but fwport may already be in use, in which case the firewalling host must use another, available port to forward communication from IPsrc, sport to IPdst, dport.

The general scheme that applies to source natting, therefore, looks like this:


    IPsrc:sport is translated by the firewall to IPfw:fwport;
    IPfw:fwport is used when communicating with IPdst:dport.
        
From the perspective of the destination host the communication originates at IPfw::fwport and consequently all communication (e.g., and incident report) sent by the systems administrator maintaining IPdst to IPfw's systems administrator will refer to IPfw:fwport, rather than to IPsrc::sport.

Using the standard log facilities provided by iptables do not easily allow us to relate IPfw:fwport to IPsrc:sport, and natlog was developed to fill in that particular niche.

When running natlog, messages are sent to the syslog daemon (e.g., rsyslogd(1)) and/or the standard output stream showing the essential characteristics of the connection using source natting. Here is an example:


    NATLOG: From 1338990672:55588 until 1338990747:807100:     
    192.168.19.72:4467 (via: 129.125.90.132:4467) to 200.49.219.180:443
        
In this example the values 1338990672:55588 and 1338990747:807100 represent time stamps showing the begin- and end-times in seconds:microseconds of the connection since Jan 1, 1970, 0:00 UTC. Natlog offers the --datetime option if time representations like Nov 2 13:29:11 are preferred.

The next value (192.168.19.72:4467) represents IPsrc::sport. This is followed by 129.125.90.132:4467, representing IPfw:fwport. The third pair of values (200.49.219.180:443) represents IPdst:dport.

In this example, host 192.168.19.72, using port 4467, connected to host 200.49.219.180, port 443. To this latter host the connection appeared to have originated from 129.125.90.132 port 4467. The provided log message easily allows us to related this to the `real' host and port from which the connection originated: 192.168.19.72:4467.

When natlog terminates natlog can no longer track connections that are still open. If natlog was terminated by a SIGTERM signal, then it sends a `terminating' line to syslog, followed by an overview of all still open connections. The end-microseconds values of connections that are no longer tracked are shown as 0000.

COMMANDS

OPTIONS

RSYSLOG FILTERING

When using rsyslogd(1) property based filters may be used to filter syslog messages and write them to a file of your choice. E.g., to filter messages starting with the syslog message tag (e.g., NATLOG) use


:syslogtag, isequal, "NATLOG:"   /var/log/natlog.log
:syslogtag, isequal, "NATLOG:"   ~
        
Note that the colon is part of the tag, but is not specified with the syslog-tag option.

This causes all messages having the NATLOG: tag to be written on /var/log/natlog.log after which they are discarded. More extensive filtering is also supported, see, e.g., http://www.rsyslog.com/doc/rsyslog_conf_filter.html and http://www.rsyslog.com/doc/property_replacer.html

EXAMPLES

Examples of natlog activations:

Here is natlog's default configuration file. Empty lines and lines starting with hash-marks (#) are ignored. Options adhere to the


option  value 
    
syntax. Option and value are separated by white space, Option values may consist of multiple words.
# This configuration file shows the default option values.
# Each option could also be omitted without affecting natlog's default
# behavior. 

# all options and values are case sensitive
# see `man natlog' for further details


    # the path to the conntrack program:
conntrack-path  /usr/sbin/conntrack

    # the used syslog tag:
syslog-tag NATLOG

    # the used syslog facility:
syslog-facility DAEMON

    # the used syslog priority:
syslog-priority NOTICE

    # the time specification:
time raw


# end of the cofiguration file



FILES

SEE ALSO

conntrack(1), iptables(1), rsyslogd(1), syslog(3)

BUGS

None reported

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).