mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 00:21:17 +00:00
[NETLINK]: Encapsulate eff_cap usage within security framework.
This patch encapsulates the usage of eff_cap (in netlink_skb_params) within the security framework by extending security_netlink_recv to include a required capability parameter and converting all direct usage of eff_caps outside of the lsm modules to use the interface. It also updates the SELinux implementation of the security_netlink_send and security_netlink_recv hooks to take advantage of the sid in the netlink_skb_params struct. This also enables SELinux to perform auditing of netlink capability checks. Please apply, for 2.6.18 if possible. Signed-off-by: Darrel Goeddel <dgoeddel@trustedcs.com> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Acked-by: James Morris <jmorris@namei.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
576a30eb64
commit
c7bdb545d2
12 changed files with 35 additions and 34 deletions
|
@ -663,7 +663,7 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp)
|
|||
sz_idx = type>>2;
|
||||
kind = type&3;
|
||||
|
||||
if (kind != 2 && security_netlink_recv(skb)) {
|
||||
if (kind != 2 && security_netlink_recv(skb, CAP_NET_ADMIN)) {
|
||||
*errp = -EPERM;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb)
|
|||
if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
|
||||
return;
|
||||
|
||||
if (!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN))
|
||||
if (security_netlink_recv(skb, CAP_NET_ADMIN))
|
||||
RCV_SKB_FAIL(-EPERM);
|
||||
|
||||
/* Eventually we might send routing messages too */
|
||||
|
|
|
@ -515,7 +515,7 @@ ipq_rcv_skb(struct sk_buff *skb)
|
|||
if (type <= IPQM_BASE)
|
||||
return;
|
||||
|
||||
if (security_netlink_recv(skb))
|
||||
if (security_netlink_recv(skb, CAP_NET_ADMIN))
|
||||
RCV_SKB_FAIL(-EPERM);
|
||||
|
||||
write_lock_bh(&queue_lock);
|
||||
|
|
|
@ -505,7 +505,7 @@ ipq_rcv_skb(struct sk_buff *skb)
|
|||
if (type <= IPQM_BASE)
|
||||
return;
|
||||
|
||||
if (security_netlink_recv(skb))
|
||||
if (security_netlink_recv(skb, CAP_NET_ADMIN))
|
||||
RCV_SKB_FAIL(-EPERM);
|
||||
|
||||
write_lock_bh(&queue_lock);
|
||||
|
|
|
@ -229,7 +229,7 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb,
|
|||
NFNL_SUBSYS_ID(nlh->nlmsg_type),
|
||||
NFNL_MSG_TYPE(nlh->nlmsg_type));
|
||||
|
||||
if (!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN)) {
|
||||
if (security_netlink_recv(skb, CAP_NET_ADMIN)) {
|
||||
DEBUGP("missing CAP_NET_ADMIN\n");
|
||||
*errp = -EPERM;
|
||||
return -1;
|
||||
|
|
|
@ -320,7 +320,7 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||
goto errout;
|
||||
}
|
||||
|
||||
if ((ops->flags & GENL_ADMIN_PERM) && security_netlink_recv(skb)) {
|
||||
if ((ops->flags & GENL_ADMIN_PERM) && security_netlink_recv(skb, CAP_NET_ADMIN)) {
|
||||
err = -EPERM;
|
||||
goto errout;
|
||||
}
|
||||
|
|
|
@ -1435,7 +1435,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *err
|
|||
link = &xfrm_dispatch[type];
|
||||
|
||||
/* All operations require privileges, even GET */
|
||||
if (security_netlink_recv(skb)) {
|
||||
if (security_netlink_recv(skb, CAP_NET_ADMIN)) {
|
||||
*errp = -EPERM;
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue