Remote Logging Using Syslog And Logging Shell Commands Remotely

While trying to come up with a simple keylogging solution that provides remote logging, I came across a pretty good solution of using the audit package and altering bash.

One of the problems I came across was that many of the keyloggers could not log any commands sent through a SSH connection - this does on Fedora anyways.

Edit /etc/rsyslog.conf and uncoment this line:

vi /etc/rsyslog.conf

*.* @>/code>

<b>Note: this is where the remote server is.</b>

Install and run the following:

<code>yum install -y audispd-plugins pasacct
chkconfig psacct on
chkconfig rsyslog on
service rsyslog start
service psacct start

Edit the conf file to look like the following:

vi /etc/audisp/audisp-remote.conf

remote_server =
port = 514
##local_port =
transport = udp

Save the file and edit the following file:

vi /etc/audisp/plugins.d/syslog.conf

# This file controls the configuration of the
# syslog plugin. It simply takes events and writes
# them to syslog.

active = yes
direction = out
path = builtin_syslog
type = builtin
args = LOG_INFO
format = string

Save the file and restart rsyslog:

service rsyslog restart

Onto altering the bash shell, but first determine what version the system is using already:

# bash --version
GNU bash, version 4.1.2(1)-release (i386-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <<a href=">


This</a> is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

The version is 4.1.2, but GNU project has the next version of bash at 4.2 - so I am going to use that instead:

wget <a href="
tar</a> -xzvf bash-4.2.tar.gz
cd bash-4.2

Edit the config file and enable syslog by making the directive look as follows:

vi config-top.h

#if defined (SYSLOG_HISTORY)

Onto the building:

make install

Replace bash

mv bash bash2
mv bash2 /bin
cd /bin
mv bash bashorig
mv bash2 bash

Optional: rm bashorig -rf

service rsyslog restart

Now on your remote server syslog should be logging everything.


Blog tags: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <python> <c>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.