sections in this module City College of San Francisco - CS260A
Unix/Linux System Administration

Module: rsyslog
module list

Security Issues

There are two primary reasons for using log files. The first, monitoring system events such as hardware issues, is secure on a local machine. If your reason for monitoring log files is the second reason, to monitor security, you must ask yourself: if the system has a break-in, can I rely on the log files?

For this reason, rsyslog is often used to log information remotely. Designating a remote server with heightened security as the recipient of copies of log information is an easy way to duplicate information, provide a central repository, and improve your chances of tracing any surreptitious activity.

Consider this simple scenario

A junior system administrator makes a mistake when logged in as root. In order to cover his tracks, he simply deletes the entries in /var/log/secure that show he logged in as root. Since the wtmp log only shows direct root logins (not su logins), there is no record of a root user being logged on when the damage occurred.

This scheme might sound pretty good if you're the junior administrator, but not if you're responsible for the system. If the system had been configured to log authorization records to a secure server as well as the local system, the suspicious login could be traced.

Remote logging with rsyslog

Configuring rsyslog to log remotely consists of two parts. First, the client must have a remote log destination indicated in rsyslog's configuration files. This is simple. For example, suppose in foo.org they have designated a secure logging machine as x.foo.org. (Of course, x.foo.org should not be accessible to any but the most trusted users.) You could create an entry in the rsyslog configuration of other machines in foo.org by placing the following single-line file in /etc/rsyslog.d:

authpriv.*;auth.info        @x.foo.org

This logs all authpriv and auth messages (except auth.debug) remotely using UDP to x.foo.org. (To specify the higher overhead but more reliable protocol TCP, double the @ symbol.) For brevity, we will only cover UDP and TCP logging.

Their destination on x.foo.org is determined by the rsyslog configuration on x.foo.org (they are intermingled with the local messages of the same type on x.foo.org )

Second, on x.foo.org, you must configure rsyslogd to listen to the syslog port (udp or tcp port 514). Traditionally syslogd was always configured to listen to its port for remotely logged messages. This is not a good idea for two reasons:

The best solution here is to only open a syslog port on a machine that is behind a firewall. (i.e., you can expose the syslog port to other machines on your LAN, but not to the outside world!).

After consideration of these two potential problems, if you decide to go ahead and enable remote logging (the receipt of remotely-logged messages), open the firewall for TCP port 514, copy the following lines from /etc/rsyslog.conf, uncomment them, place them in a file whose name ends in .conf, and drop it into /etc/rsyslog.d:

$ModLoad imtcp
$InputTCPServerRun 514

Then you must restart rsyslogd. 

systemctl restart rsyslog

(Note the confusion between rsyslog and rsyslogd. Be careful which name is used when. It is inconsistent. Why is the name for rsyslogd's startup configuration file /etc/sysconfig/rsyslog for example? Better yet, why does the rsyslogd daemon still create a file named syslogd.pid in /var/run?(we will learn about these pid files later when we cover subsystems)) Worse, why is the service named rsyslog, whereas most are named the same as the daemon? (sshd, atd, crond,...)

Excessive log traffic

As mentioned in the previous section, a common hack is to overwhelm rsyslog with log traffic. This causes problems arising from two issues:

Historical note:

if you are logging to a machine that is running sysklogd rather than rsyslogd (RH5 and older), you must configure your default format for forwarded messages on the client like this:

$ActionForwardDefaultTemplate RSYSLOG_TraditionalForwardFormat

Even using this default template for forwarded messages you will see that the hostname is duplicated in each message, but the message will be logged at least! (Without the directive, sysklogd will ignore the remote message as invalid.) 

Prev This page was made entirely with free software on linux:  
the Mozilla Project, Kompozer,
and Openoffice.org      
Next

Copyright 2015 Greg Boyd - All Rights Reserved.