Bazy:<br><br>Thanks. I hope in the future version of auditd, it will be much easier to monitor user's activities.<br><br><br><div><span class="gmail_quote">On 9/3/07, <b class="gmail_sendername">Bazy</b> <<a href="mailto:bazy@goofy.celuloza.ro">
bazy@goofy.celuloza.ro</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Mag Gam wrote:<br>> Is it possible to audit the Linux User Shell? I am trying to gather what
<br>> commands a user is running no our systems.<br>> Can auditd handle this?<br>><br>> TIA<br>><br>><br>> ------------------------------------------------------------------------<br>><br>> _______________________________________________
<br>> CentOS mailing list<br>> <a href="mailto:CentOS@centos.org">CentOS@centos.org</a><br>> <a href="http://lists.centos.org/mailman/listinfo/centos">http://lists.centos.org/mailman/listinfo/centos</a><br><br>Hi Mag Gam,
<br><br>I don't know if it can log what every user does... but it can watch a<br>lot of things :) Here is an example of watching what happens in /tmp,<br>the reads and writes (auditctl -w /tmp -p rw -k tmp-watch):<br>
<br>[root@goofy ~]# auditctl -l<br>No rules<br><br>[root@goofy ~]# auditctl -w /tmp -p rw -k tmp-watch<br><br>[root@goofy ~]# auditctl -l<br>LIST_RULES: exit,always watch=/tmp perm=rw key=tmp-watch<br><br>[root@goofy ~]# ausearch -k tmp-watch
<br>----<br>time->Mon Sep  3 18:22:36 2007<br>type=PATH msg=audit(1188832956.932:43): item=0 name="." inode=14207425<br>dev=08:01 mode=041777 ouid=0 ogid=0 rdev=00:00<br>type=CWD msg=audit(1188832956.932:43):  cwd="/tmp"
<br>type=SYSCALL msg=audit(1188832956.932:43): arch=40000003 syscall=5<br>success=yes exit=3 a0=95c1e40 a1=18800 a2=0 a3=95c29d8 items=1<br>ppid=31137 pid=31213 auid=500 uid=500 gid=500 euid=500 suid=500<br>fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts1 comm="ls" exe="/bin/ls"
<br>key="tmp-watch"<br>----<br>time->Mon Sep  3 18:25:02 2007<br>type=PATH msg=audit(1188833102.354:53): item=0 name="." inode=14207425<br>dev=08:01 mode=041777 ouid=0 ogid=0 rdev=00:00<br>type=CWD msg=audit(
1188833102.354:53):  cwd="/tmp"<br>type=SYSCALL msg=audit(1188833102.354:53): arch=40000003 syscall=5<br>success=yes exit=3 a0=96e5010 a1=18800 a2=96e1458 a3=96e4ff8 items=1<br>ppid=31137 pid=31270 auid=500 uid=500 gid=500 euid=500 suid=500
<br>fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts1 comm="ls" exe="/bin/ls"<br>key="tmp-watch"<br>----<br>time->Mon Sep  3 18:25:11 2007<br>type=PATH msg=audit(1188833111.401:54): item=1 name="
testme.hack"<br>inode=14207429 dev=08:01 mode=0100664 ouid=500 ogid=500 rdev=00:00<br>type=PATH msg=audit(1188833111.401:54): item=0  name="/tmp"<br>inode=14207425 dev=08:01 mode=041777 ouid=0 ogid=0 rdev=00:00
<br>type=CWD msg=audit(1188833111.401:54):  cwd="/tmp"<br>type=SYSCALL msg=audit(1188833111.401:54): arch=40000003 syscall=5<br>success=yes exit=0 a0=bfebec4e a1=8941 a2=1b6 a3=8941 items=2 ppid=31137<br>pid=31271 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500
<br>sgid=500 fsgid=500 tty=pts1 comm="touch" exe="/bin/touch" key="tmp-watch"<br><br><br>What i did under uid 500 in the shell was:<br>cd /tmp<br>ls<br>touch testme.hack<br><br>Like this you can watch under /bin with "-p rx" for example, and see
<br>what your users execute from /bin. You get the ideea :)<br><br>Your could add a watch on "/etc/shadow" with the arbitrary filterkey<br>"shadow-file" that generates records for "reads, writes, executes, and<br>appends" on "shadow":
<br><br>auditctl -w /etc/shadow -k shadow-file -p rwxa<br><br>Use man auditctl, and take a look at /etc/audit/audit.rules.<br><br>BE CAREFUL!!! edit /etc/sysconfig/auditd and change the<br>"AUDITD_CLEAN_STOP" to no, otherwise when you restart auditd all your
<br>rules will be wiped!<br>_______________________________________________<br>CentOS mailing list<br><a href="mailto:CentOS@centos.org">CentOS@centos.org</a><br><a href="http://lists.centos.org/mailman/listinfo/centos">http://lists.centos.org/mailman/listinfo/centos
</a><br></blockquote></div><br>