From: Steve Grubb <sgrubb@redhat.com>
To: linux-audit@redhat.com
Cc: Maupertuis Philippe <philippe.maupertuis@worldline.com>
Subject: Re: Using a watch to find who is using a file
Date: Mon, 04 Jan 2016 12:53:04 -0500 [thread overview]
Message-ID: <2346384.yfbmgxyLev@x2> (raw)
In-Reply-To: <3D2AB1326AB2974190FCE3F69401F790DB1E930F47@FRVDX103.fr01.awl.atosorigin.net>
On Monday, January 04, 2016 04:49:13 PM Maupertuis Philippe wrote:
> Hi list
> Our dbas complained that vim swap file were renamed instead of being deleted
> With an audit watch we were able to tell them to stop their silly cron
> rename job :) However, the audit log is missing an important piece of
> information : the job name.
Yes. I opened a bz on this about a month ago.
https://bugzilla.redhat.com/show_bug.cgi?id=1288653
> It seems that we didn't capture the exe name associated with the parent pid.
We never do.
> If I am no misunderstanding the results
> below, pid = 28351 is for the exe /bin/mv
Yes.
> I would have liked to know the exe of the parent pid
That would be useful in many cases, but the parent process could have exited
by the time the child process triggers the event. So, its not really possible.
That said, people really do want something. For example, maybe someone knows
an exploit and can get a command injection through apache which then gives
them a shell and they start doing things to escalate privileges. In this case,
you not only want the ppid, you want the whole chain of processes to see how
someone got into the system. A bz was opened to do this:
https://bugzilla.redhat.com/show_bug.cgi?id=1094156
There didn't seem to be anyone who thought this was a good idea.
> Is there a way to ensure that the audit log includes the executable name
> associated with every pid ? Or the exe associated with pid starting a new
> session ?
You could log all clone & execve syscalls. :-)
> What we did was :
>
> To find out how vim swap files were renamed without the leading dot a the
> following rule was inserted : auditctl -w /etc/mysql -p war -k test_swp
> which gave us the following result :
> ----
> type=PATH msg=audit(12/22/2015 11:45:01.766:1660580) : item=3
> name=param-MYLHCE01V.swp inode=49283 dev=fd:00 mode=file,640 ouid=root
> ogid=root rdev=00:00 nametype=CREATE type=PATH msg=audit(12/22/2015
> 11:45:01.766:1660580) : item=2 name=.param-MYLHCE01V.swp inode=49283
> dev=fd:00 mode=file,640 ouid=root ogid=root rdev=00:00 nametype=DELETE
> type=PATH msg=audit(12/22/2015 11:45:01.766:1660580) : item=1
> name=/etc/mysql inode=49308 dev=fd:00 mode=dir,755 ouid=mysql ogid=mysql
> rdev=00:00 nametype=PARENT type=PATH msg=audit(12/22/2015
> 11:45:01.766:1660580) : item=0 name=/etc/mysql inode=49308 dev=fd:00
> mode=dir,755 ouid=mysql ogid=mysql rdev=00:00 nametype=PARENT type=CWD
> msg=audit(12/22/2015 11:45:01.766:1660580) : cwd=/etc/mysql type=SYSCALL
> msg=audit(12/22/2015 11:45:01.766:1660580) : arch=x86_64 syscall=rename
> success=yes exit=0 a0=0x7ffe46229db3 a1=0x7ffe46229dc8 a2=0x0
> a3=0x7ffe46227c80 items=4 ppid=28254 pid=28351 auid=mysql uid=mysql
> gid=mysql euid=mysql suid=mysql fsuid=mysql egid=mysql sgid=mysql
> fsgid=mysql tty=(none) ses=276356 comm=mv exe=/bin/mv key=swp_move
>
> Searching for the whole session gave us :
In this particular case, the cron patch might help. But overall, cases like
this really want the chain of processes to know the complete origin of
processes involved.
-Steve
prev parent reply other threads:[~2016-01-04 17:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-04 15:49 Using a watch to find who is using a file Maupertuis Philippe
2016-01-04 17:53 ` Steve Grubb [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2346384.yfbmgxyLev@x2 \
--to=sgrubb@redhat.com \
--cc=linux-audit@redhat.com \
--cc=philippe.maupertuis@worldline.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox