aboutsummaryrefslogtreecommitdiffstats
path: root/security/security.c
diff options
context:
space:
mode:
authorPaul Moore <paul.moore@hp.com>2009-08-28 18:12:43 -0400
committerJames Morris <jmorris@namei.org>2009-08-31 18:29:48 -0400
commit2b980dbd77d229eb60588802162c9659726b11f4 (patch)
tree78a7f734d0721029e4b4c961ca61d35abe9e6dbc /security/security.c
parentd8e180dcd5bbbab9cd3ff2e779efcf70692ef541 (diff)
lsm: Add hooks to the TUN driver
The TUN driver lacks any LSM hooks which makes it difficult for LSM modules, such as SELinux, to enforce access controls on network traffic generated by TUN users; this is particularly problematic for virtualization apps such as QEMU and KVM. This patch adds three new LSM hooks designed to control the creation and attachment of TUN devices, the hooks are: * security_tun_dev_create() Provides access control for the creation of new TUN devices * security_tun_dev_post_create() Provides the ability to create the necessary socket LSM state for newly created TUN devices * security_tun_dev_attach() Provides access control for attaching to existing, persistent TUN devices and the ability to update the TUN device's socket LSM state as necessary Signed-off-by: Paul Moore <paul.moore@hp.com> Acked-by: Eric Paris <eparis@parisplace.org> Acked-by: Serge Hallyn <serue@us.ibm.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/security.c')
-rw-r--r--security/security.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/security/security.c b/security/security.c
index 0e993f42ce3d..f88eaf6b14cc 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1117,6 +1117,24 @@ void security_inet_conn_established(struct sock *sk,
1117 security_ops->inet_conn_established(sk, skb); 1117 security_ops->inet_conn_established(sk, skb);
1118} 1118}
1119 1119
1120int security_tun_dev_create(void)
1121{
1122 return security_ops->tun_dev_create();
1123}
1124EXPORT_SYMBOL(security_tun_dev_create);
1125
1126void security_tun_dev_post_create(struct sock *sk)
1127{
1128 return security_ops->tun_dev_post_create(sk);
1129}
1130EXPORT_SYMBOL(security_tun_dev_post_create);
1131
1132int security_tun_dev_attach(struct sock *sk)
1133{
1134 return security_ops->tun_dev_attach(sk);
1135}
1136EXPORT_SYMBOL(security_tun_dev_attach);
1137
1120#endif /* CONFIG_SECURITY_NETWORK */ 1138#endif /* CONFIG_SECURITY_NETWORK */
1121 1139
1122#ifdef CONFIG_SECURITY_NETWORK_XFRM 1140#ifdef CONFIG_SECURITY_NETWORK_XFRM