<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Slashzerø &#187; pam</title>
	<atom:link href="http://www.slashzero.com/tag/pam/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.slashzero.com</link>
	<description>Random and Useless Thoughts on Everything</description>
	<lastBuildDate>Wed, 31 Mar 2010 20:46:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Shell session logging</title>
		<link>http://www.slashzero.com/2009/11/shell-session-logging/</link>
		<comments>http://www.slashzero.com/2009/11/shell-session-logging/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 00:48:14 +0000</pubDate>
		<dc:creator>abx21</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[audting]]></category>
		<category><![CDATA[pam]]></category>

		<guid isPermaLink="false">http://www.slashzero.com/?p=117</guid>
		<description><![CDATA[pam_tty_audit.so How come no one ever told me about this!  A while ago we were tasked to find a way to log all commands executed by root.  I know bash_history is easily manipulated so I spent some time on google trying to find a logging shell, then got distracted by something shiny and forgot all <a href='http://www.slashzero.com/2009/11/shell-session-logging/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><strong>pam_tty_audit.so</strong></p>
<p>How come no one ever told me about this!  A while ago we were tasked to find a way to log all commands executed by root.  I know bash_history is easily manipulated so I spent some time on google trying to find a logging shell, then got distracted by something shiny and forgot all about this task.  Turns out the linux auditing system has a built-in tty logging accounting module that will log all tty sessions!  Just add this to your pam stack (/etc/pam.d/system-auth on redhat and clones):</p>
<pre>session required pam_tty_audit.so disable=* enable=root</pre>
<p>Then run a few commands as root, and the aureport command will become your friend:</p>
<pre>audit]# aureport --tty -ts today</pre>
<pre>TTY Report
===============================================
# date time event auid term sess comm data
===============================================
1. 11/22/2009 00:07:52 132278 1040 ? 4294962295 bash "hello world",&lt;ret&gt;</pre>
<p>UPDATE:</p>
<p>You need a newer version of the audit rpm package, tty info will be collected but aureport does not know how to display them.</p>
<p><a href="https://bugzilla.redhat.com/show_bug.cgi?id=497518">https://bugzilla.redhat.com/show_bug.cgi?id=497518</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.slashzero.com%2F2009%2F11%2Fshell-session-logging%2F&amp;linkname=Shell%20session%20logging"><img src="http://www.slashzero.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.slashzero.com/2009/11/shell-session-logging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
