{"id":721,"date":"2012-01-19T22:47:28","date_gmt":"2012-01-20T05:47:28","guid":{"rendered":"http:\/\/jaredrobinson.com\/blog\/?p=721"},"modified":"2012-01-19T22:47:28","modified_gmt":"2012-01-20T05:47:28","slug":"linux-tty-auditing","status":"publish","type":"post","link":"https:\/\/jaredrobinson.com\/blog\/linux-tty-auditing\/","title":{"rendered":"Linux tty auditing"},"content":{"rendered":"<p>Since RHEL 5.4, and in recent Fedora releases, it&#8217;s possible to audit what users type at their tty (command prompt), thanks to the work of Steve Grubb, a RedHat employee.<\/p>\n<p>Edit \/etc\/pam.d\/system-auth and append the following, <strong>but not both<\/strong>:<\/p>\n<pre>session required pam\\_tty\\_audit.so disable=\\* enable=root\r\nsession required pam\\_tty\\_audit.so enable=\\*<\/pre>\n<p>Wait for users to log in and type into a terminal. Later, to see audited tty input, run:<\/p>\n<pre>aureport --tty<\/pre>\n<p>When a user logs in, the pam module tells the kernel to enable tty auditing for a process and its children. All tty input is logged, but it may not be incredibly easy to read (it includes backspaces, control characters, etc.). I&#8217;m unclear as to when and how often the kernel flushes out accumulated tty input to the audit log. The records are identified with a type of TTY in \/var\/log\/audit\/audit.log.<\/p>\n<p>In addition to tty auditing, RedHat patched their bash shell so that it neatly audits each and every command line it executes, with a record type of USER\\_TTY. It&#8217;s prettier to read than raw tty auditing &#8212; and it&#8217;s easy for a user to bypass by using a shell that doesn&#8217;t send its commands to the Linux audit system, like zsh, or a custom-built unpatched bash. Maybe that&#8217;s why &#8220;aureport &#8211;tty&#8221; doesn&#8217;t show USER\\_TTY records.<\/p>\n<p>&#8212;-<\/p>\n<p>The Linux auditing system is powerful. It&#8217;s possible to write rules that watch for modification to certain files, or that log the use of certain system calls. See the &#8220;audit.rules&#8221; manpage for more information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since RHEL 5.4, and in recent Fedora releases, it&#8217;s possible to audit what users type at their tty (command prompt), thanks to the work of Steve Grubb, a RedHat employee. Edit \/etc\/pam.d\/system-auth and append the following, but not both: session required pam\\_tty\\_audit.so disable=\\* enable=root session required pam\\_tty\\_audit.so enable=\\* Wait for users to log in and &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/jaredrobinson.com\/blog\/linux-tty-auditing\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux tty auditing&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,9,16,17],"tags":[],"class_list":["post-721","post","type-post","status-publish","format-standard","hentry","category-fedora","category-linux","category-security","category-tech"],"_links":{"self":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/721","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/comments?post=721"}],"version-history":[{"count":11,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/721\/revisions"}],"predecessor-version":[{"id":732,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/721\/revisions\/732"}],"wp:attachment":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/media?parent=721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/categories?post=721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/tags?post=721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}