netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfrm audit hook misplaced in pfkey_delete and xfrm_del_sa
@ 2007-03-02 20:15 Eric Paris
  2007-03-05 16:00 ` Venkat Yekkirala
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Paris @ 2007-03-02 20:15 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: davem, jmorris, vyekkirala, cxzhang, sds

Inside pfkey_delete and xfrm_del_sa the audit hooks were not called if
there was any permission/security failures in attempting to do the del
operation (such as permission denied from security_xfrm_state_delete).
This patch moves the audit hook to the exit path such that all failures
(and successes) will actually get audited.

Signed-off-by: Eric Paris <eparis@redhat.com>

 net/key/af_key.c     |    5 ++---
 net/xfrm/xfrm_user.c |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 1c58204..d8fc88c 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1467,9 +1467,6 @@ static int pfkey_delete(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
 
 	err = xfrm_state_delete(x);
 
-	xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
-		       AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
-
 	if (err < 0)
 		goto out;
 
@@ -1478,6 +1475,8 @@ static int pfkey_delete(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
 	c.event = XFRM_MSG_DELSA;
 	km_state_notify(x, &c);
 out:
+	xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
+		       AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
 	xfrm_state_put(x);
 
 	return err;
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 956cfe0..4264473 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -530,9 +530,6 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	err = xfrm_state_delete(x);
 
-	xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
-		       AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
-
 	if (err < 0)
 		goto out;
 
@@ -542,6 +539,8 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
 	km_state_notify(x, &c);
 
 out:
+	xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
+		       AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
 	xfrm_state_put(x);
 	return err;
 }



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] xfrm audit hook misplaced in pfkey_delete and xfrm_del_sa
  2007-03-02 20:15 [PATCH] xfrm audit hook misplaced in pfkey_delete and xfrm_del_sa Eric Paris
@ 2007-03-05 16:00 ` Venkat Yekkirala
  2007-03-06  0:37 ` James Morris
  2007-03-07 23:44 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Venkat Yekkirala @ 2007-03-05 16:00 UTC (permalink / raw)
  To: 'Eric Paris', netdev, linux-kernel
  Cc: davem, jmorris, Venkat Yekkirala, cxzhang, sds

> Inside pfkey_delete and xfrm_del_sa the audit hooks were not called if
> there was any permission/security failures in attempting to do the del
> operation (such as permission denied from security_xfrm_state_delete).
> This patch moves the audit hook to the exit path such that 
> all failures
> (and successes) will actually get audited.

Not sure ALL failures are being audited this way elsewhere, but I guess
they would catchup in course of time.

> 
> Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Venkat Yekkirala <vyekkirala@trustedcs.com> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfrm audit hook misplaced in pfkey_delete and xfrm_del_sa
  2007-03-02 20:15 [PATCH] xfrm audit hook misplaced in pfkey_delete and xfrm_del_sa Eric Paris
  2007-03-05 16:00 ` Venkat Yekkirala
@ 2007-03-06  0:37 ` James Morris
  2007-03-07 23:44 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: James Morris @ 2007-03-06  0:37 UTC (permalink / raw)
  To: Eric Paris
  Cc: netdev, linux-kernel, David S. Miller, Venkat Yekkirala,
	Stephen Smalley

On Fri, 2 Mar 2007, Eric Paris wrote:

> Inside pfkey_delete and xfrm_del_sa the audit hooks were not called if
> there was any permission/security failures in attempting to do the del
> operation (such as permission denied from security_xfrm_state_delete).
> This patch moves the audit hook to the exit path such that all failures
> (and successes) will actually get audited.
> 
> Signed-off-by: Eric Paris <eparis@redhat.com>

Acked-by: James Morris <jmorris@namei.org>


-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfrm audit hook misplaced in pfkey_delete and xfrm_del_sa
  2007-03-02 20:15 [PATCH] xfrm audit hook misplaced in pfkey_delete and xfrm_del_sa Eric Paris
  2007-03-05 16:00 ` Venkat Yekkirala
  2007-03-06  0:37 ` James Morris
@ 2007-03-07 23:44 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2007-03-07 23:44 UTC (permalink / raw)
  To: eparis; +Cc: netdev, linux-kernel, jmorris, vyekkirala, cxzhang, sds

From: Eric Paris <eparis@parisplace.org>
Date: Fri, 02 Mar 2007 15:15:36 -0500

> Inside pfkey_delete and xfrm_del_sa the audit hooks were not called if
> there was any permission/security failures in attempting to do the del
> operation (such as permission denied from security_xfrm_state_delete).
> This patch moves the audit hook to the exit path such that all failures
> (and successes) will actually get audited.
> 
> Signed-off-by: Eric Paris <eparis@redhat.com>

Also applied, thanks a lot Eric.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-03-07 23:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-02 20:15 [PATCH] xfrm audit hook misplaced in pfkey_delete and xfrm_del_sa Eric Paris
2007-03-05 16:00 ` Venkat Yekkirala
2007-03-06  0:37 ` James Morris
2007-03-07 23:44 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).