Permissive mode for xace is broken.
----- Original Message ----
Quoted 46 lines
From: Eamon Walsh <[email protected]>
To: Steve Grubb <[email protected]>
Cc: Stephen Smalley <[email protected]>; Daniel J Walsh <[email protected]>; SE Linux <[email protected]>
Sent: Wednesday, March 19, 2008 11:56:00 PM
Subject: Re: Permissive mode for xace is broken.Quoted 30 lines · Steve Grubb
Quoted 19 lines · On Thursday 28 February 2008 21:02:28 Eamon Walsh wrote:
Quoted 8 lines · Steve Grubb
Quoted 6 lines · On Thursday 28 February 2008 13:51:05 Stephen Smalley wrote:
Quoted 4 lines · Eamon Walsh
Quoted 2 lines · Stephen Smalley
On Mon, 2008-02-25 at 20:12 -0500, Eamon Walsh wrote:
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines · Eamon Walsh
The X object manager logs all avc's and status messages (including the AVC netlink stuff) through the audit system using libaudit calls (
audit_log_user_avc_message, etc.)Please tell me they have different record types. Also do you have any samples that we can look over to make sure they conform?
Quoted 8 lines
type=USER_AVC msg=audit(1204226161.048:268): user pid=21267 uid=0 auid=4294967295 subj=system_u:system_r:xdm_xserver_t:s0-s0:c0.c1023 msg='avc: denied { read } for request=X11:QueryPointer comm=/usr/libexec/at-spi-registryd xdevice="Virtual core pointer" scontext=staff_u:staff_r:staff_t:s0 tcontext=system_u:system_r:xdm_xserver_t:s0-s0:c0.c1023 tclass=x_device :
exe="/usr/bin/Xorg" (sauid=0, hostname=?, addr=?, terminal=?)'Quoted 8 lines
comm & xdevice are not escaped the right way. exe is. The audit utilities are expecting the comm field to be comm="/usr/libexec/at-spi-registryd" in this case. The standard has been untrusted fields have " " enclosing the field. Whenever there is a space, double quote, or control character, its ASCII HEX encoded with no quotes. xdevice is not a field that the audit system knows about, so we could do something different with it, but comm is known for a long time and has to follow the standards.
Quoted 1 line
Why can't libaudit automatically perform this escaping?
Well, it could. However, this is the API that you currently have:
extern int audit_log_user_avc_message(int audit_fd, int type,
const char *message, const char *hostname, const char *addr, const char *tty, uid_t uid);
The whole avc from msg= up to the exe= statement comes from libselinux. So, libselinux has to do the escaping unless we build a better API for selinux use. I could probably expose the function that does the escaping, but I had really wanted to try to maintain some consistency in the event by API.
Quoted 4 lines
That way we avoid promulgating this "standard" into every caller of libaudit.
If everything is going to be name-value based, then I want a libaudit function that takes a list of name/value pairs.
SE Linux is the only user of the audit system that does not follow the name=value standard. Would you (and the community) really be willing to convert selinux over to that if we have the API for it? Do you have any suggestions about how you'd like to see the new API implemented?
Quoted 7 lines
Quoted 4 lines
Also, is there any information about who caused the event? uid, auid, gid? Even though this was a denied action, what is the results? Were they successful (permissive) or was it really a failed and denied request?
I don't understand this last part with the result of the action. How am I supposed to specify this?
res=0 for failed and res=1 for success even though the action was denied. Admittedly, the audit avc API does not require this from SE Linux, but I could fix that if we change the API to something around name value pairs.
Quoted 2 lines
I need to modify libselinux (again) to support all of this extra uid and hostname stuff getting passed into the logging callback.
Yes, CAPP and other CC protection profiles require that sufficient information be logged to determine who did the action that was denied or granted.
Quoted 7 lines
Quoted 3 lines
Would it make sense to fill in the workspace:window information for the terminal? If X is being used remotely, is the addr & hostname fields correct?
The X server has a terminal that it runs on,
/dev/tty7or whatever. The desktop workspaces and gnome-terminal/xterm pseudo-tty's are external to the X server and it doesn't know about them.
So, should we also make a new field that logs the workspace:window that a request came from?
Thanks,
-Steve
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 59 lines · Steve G
----- Original Message ----
Quoted 46 lines
From: Eamon Walsh <[email protected]>
To: Steve Grubb <[email protected]>
Cc: Stephen Smalley <[email protected]>; Daniel J Walsh <[email protected]>; SE Linux <[email protected]>
Sent: Wednesday, March 19, 2008 11:56:00 PM
Subject: Re: Permissive mode for xace is broken.Quoted 30 lines · Steve Grubb
Quoted 19 lines · On Thursday 28 February 2008 21:02:28 Eamon Walsh wrote:
Quoted 8 lines · Steve Grubb
Quoted 6 lines · On Thursday 28 February 2008 13:51:05 Stephen Smalley wrote:
Quoted 4 lines · Eamon Walsh
Quoted 2 lines · Stephen Smalley
On Mon, 2008-02-25 at 20:12 -0500, Eamon Walsh wrote:
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines · Eamon Walsh
The X object manager logs all avc's and status messages (including the AVC netlink stuff) through the audit system using libaudit calls (
audit_log_user_avc_message, etc.)Please tell me they have different record types. Also do you have any samples that we can look over to make sure they conform?
Quoted 8 lines
type=USER_AVC msg=audit(1204226161.048:268): user pid=21267 uid=0 auid=4294967295 subj=system_u:system_r:xdm_xserver_t:s0-s0:c0.c1023 msg='avc: denied { read } for request=X11:QueryPointer comm=/usr/libexec/at-spi-registryd xdevice="Virtual core pointer" scontext=staff_u:staff_r:staff_t:s0 tcontext=system_u:system_r:xdm_xserver_t:s0-s0:c0.c1023 tclass=x_device :
exe="/usr/bin/Xorg" (sauid=0, hostname=?, addr=?, terminal=?)'Quoted 8 lines
comm & xdevice are not escaped the right way. exe is. The audit utilities are expecting the comm field to be comm="/usr/libexec/at-spi-registryd" in this case. The standard has been untrusted fields have " " enclosing the field. Whenever there is a space, double quote, or control character, its ASCII HEX encoded with no quotes. xdevice is not a field that the audit system knows about, so we could do something different with it, but comm is known for a long time and has to follow the standards.
Quoted 1 line
Why can't libaudit automatically perform this escaping?
Well, it could. However, this is the API that you currently have:
extern int audit_log_user_avc_message(int
audit_fd, int type,
const char *message, const char *hostname, const char *addr, const char *tty,uid_tuid);The whole avc from msg= up to the exe= statement comes from libselinux. So, libselinux has to do the escaping unless we build a better API for selinux use. I could probably expose the function that does the escaping, but I had really wanted to try to maintain some consistency in the event by API.
Quoted 6 lines
Quoted 4 lines
That way we avoid promulgating this "standard" into every caller of libaudit.
If everything is going to be name-value based, then I want a libaudit function that takes a list of name/value pairs.
SE Linux is the only user of the audit system that does not follow the name=value standard. Would you (and the community) really be willing to convert selinux over to that if we have the API for it? Do you have any suggestions about how you'd like to see the new API implemented?
When the topic last came up on list, we weren't opposed to converting to the name=value model, just cautious about not breaking userspace in the
process. We don't want users suddenly finding that audit2allow,
setroubleshoot, setools, etc suddenly stop working over night. And that isn't so far fetched - Fedora pushes new upstream kernels as updates to old releases w/o any corresponding userland updates, which has caused us breakage in the past, and akpm specifically tests new kernels on ancient Fedora releases to see if anything breaks.
As I recall, we even agreed on field names for the avc fields during the prior thread. But no one followed up with actual patches to make it happen.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 8 lines · On Monday 24 March 2008 15:59:05 Stephen Smalley wrote:
Quoted 4 lines
SE Linux is the only user of the audit system that does not follow the name=value standard. Would you (and the community) really be willing to convert selinux over to that if we have the API for it? Do you have any suggestions about how you'd like to see the new API implemented?
When the topic last came up on list, we weren't opposed to converting to the name=value model, just cautious about not breaking userspace in the process.
Sure. Completely understandable.
Quoted 3 lines
As I recall, we even agreed on field names for the avc fields during the prior thread. But no one followed up with actual patches to make it happen.
On the audit side, I implemented what we agreed on. It creates 2 fake names for use with values (seresult & seperm). At some point, I would recommend that the tools experiment with switching over to the auparse library. If that happens, then we can change the actual format since auparse is already providing the illusion of name=value for all of selinux.
I recommend experimenting with switching over for a couple other reasons. At some point we'll start zipping the logs. That will break existing tools unless they are gzip aware. And people have been talking about adding database support for audit records. If people store events that way, we'll have auparse updated to extract events. Its yet another hurdle for the tools doing their own parsing.
This isn't likely to happen for another month or two so there is time to experiment. What I am concerned about right now, though, is what to do about user space AVCs since that is needing some work. :)
-Steve
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 2 lines · Steve G
Well, it could. However, this is the API that you currently have:
API can always be changed or augmented. For heaven's sake, the man page for "audit_log_user_semanage_message" isn't even spelled correctly right now.
Quoted 6 lines
extern int audit_log_user_avc_message(int
audit_fd, int type,
const char *message, const char *hostname, const char *addr, const char *tty,uid_tuid);The whole avc from msg= up to the exe= statement comes from libselinux. So, libselinux has to do the escaping unless we build a better API for selinux use. I could probably expose the function that does the escaping, but I had really wanted to try to maintain some consistency in the event by API.
I would like to see an API that takes an array of struct { name, value }, or a variadic (name, value, name, value...). I think this would be far more flexible than the current situation where libaudit functions are being defined that take 10, 15, or more parameters. Furthermore, libaudit would handle all escaping of these values according to whatever it's format du jour is. Let's please not start
I realize that this API would be more open ended since it would not hardcode specific name/value pairs being passed in, which is what the current set of functions are attempting to do with their fixed arguments. But this could be handled some other way, by printing out a warning in the logs, doing an assert in the code, or returning an error condition if the criteria ones are missing. Or just doing question marks like the current implementation. Which you're going to have to do anyway, because as I have pointed out, not all machines have IP addresses or hostnames and not all programs have terminals.
I also made a suggestion earlier about cleaning up the taxonomy of audit fields, perhaps by using namespacing such as "selinux.perms, selinux.result" etc.
Finally, a good place to start might be to start putting a version number field into the messages. The version number could be bumped for each change to the format or fields.
Quoted 11 lines
Quoted 6 lines
That way we avoid promulgating this "standard" into every caller of libaudit.
If everything is going to be name-value based, then I want a libaudit function that takes a list of name/value pairs.
SE Linux is the only user of the audit system that does not follow the name=value standard. Would you (and the community) really be willing to convert selinux over to that if we have the API for it? Do you have any suggestions about how you'd like to see the new API implemented?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Also, is there any information about who caused the event? uid, auid, gid? Even though this was a denied action, what is the results? Were they successful (permissive) or was it really a failed and denied request?
I don't understand this last part with the result of the action. How am I supposed to specify this?
res=0 for failed and res=1 for success even though the action was denied. Admittedly, the audit avc API does not require this from SE Linux, but I could fix that if we change the API to something around name value pairs.
OK.
Quoted 9 lines
Quoted 4 lines
I need to modify libselinux (again) to support all of this extra uid and hostname stuff getting passed into the logging callback.
Yes, CAPP and other CC protection profiles require that sufficient information be logged to determine who did the action that was denied or granted.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Would it make sense to fill in the workspace:window information for the terminal? If X is being used remotely, is the addr & hostname fields correct?
The X server has a terminal that it runs on,
/dev/tty7or whatever. The desktop workspaces and gnome-terminal/xterm pseudo-tty's are external to the X server and it doesn't know about them.So, should we also make a new field that logs the workspace:window that a request came from?
A request does not come from a window. A request comes from a process. The process comm name is already in the message, and the PID of the process is also known. For remote connections, the address and hostname are known and can be logged (with some API changes as I mentioned).
I think there's some misunderstanding here about the workspaces, so let me try to explain this in more detail. There is no such thing as a "workspace" in the X Window System. The concept of a workspace is completely internal to the metacity window manager. When you switch workspaces, what actually happens is that metacity hides all the windows on your screen and then shows a new set of windows. The only thing the X server sees is the requests that are coming in to hide and show windows. There is no workspace information in any X protocol requests. It is _not possible_ for me to log a workspace from the X server.
Quoted 11 lines
Thanks,
-Steve____________________________________________________________________________________Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs
Signature · 8 lines
Eamon Walsh <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.