All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Expose x_tables /proc entries as 0444 not 0440
@ 2015-11-07  7:49 Philip Whineray
  2015-11-11 16:50 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 19+ messages in thread
From: Philip Whineray @ 2015-11-07  7:49 UTC (permalink / raw)
  To: netfilter-devel

Reading these files is impossible in an unprivileged user namespace,
interfering with various firewall tools. For instance, iptables-save
relies on reading /proc/net/ip_tables_names to dump only loaded tables.

Hiding the contents from non-root users does not achieve anything
practical. Possible values are well-known and the specifics can
be inferred from a list of loaded modules on most systems.

Signed-off-by: Philip Whineray <phil@firehol.org>
---
An alternate might be to change the ownership of the files within the
namespace when it is created:

https://lists.linuxcontainers.org/pipermail/lxc-users/2014-November/008110.html

I do not see that there is much advantage to this, it just ties the
ability to read the files to the ability to create an unprivileged
namespace.

 net/netfilter/x_tables.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 9b42b5e..c05adde 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1236,21 +1236,21 @@ int xt_proto_init(struct net *net, u_int8_t af)
 #ifdef CONFIG_PROC_FS
 	strlcpy(buf, xt_prefix[af], sizeof(buf));
 	strlcat(buf, FORMAT_TABLES, sizeof(buf));
-	proc = proc_create_data(buf, 0440, net->proc_net, &xt_table_ops,
+	proc = proc_create_data(buf, 0444, net->proc_net, &xt_table_ops,
 				(void *)(unsigned long)af);
 	if (!proc)
 		goto out;
 
 	strlcpy(buf, xt_prefix[af], sizeof(buf));
 	strlcat(buf, FORMAT_MATCHES, sizeof(buf));
-	proc = proc_create_data(buf, 0440, net->proc_net, &xt_match_ops,
+	proc = proc_create_data(buf, 0444, net->proc_net, &xt_match_ops,
 				(void *)(unsigned long)af);
 	if (!proc)
 		goto out_remove_tables;
 
 	strlcpy(buf, xt_prefix[af], sizeof(buf));
 	strlcat(buf, FORMAT_TARGETS, sizeof(buf));
-	proc = proc_create_data(buf, 0440, net->proc_net, &xt_target_ops,
+	proc = proc_create_data(buf, 0444, net->proc_net, &xt_target_ops,
 				(void *)(unsigned long)af);
 	if (!proc)
 		goto out_remove_matches;
-- 
2.1.4

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

end of thread, other threads:[~2015-11-25 12:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07  7:49 [PATCH] Expose x_tables /proc entries as 0444 not 0440 Philip Whineray
2015-11-11 16:50 ` Pablo Neira Ayuso
2015-11-11 18:25   ` Jozsef Kadlecsik
2015-11-11 18:40   ` Florian Westphal
2015-11-11 18:48     ` Jan Engelhardt
2015-11-11 19:35       ` Phil Whineray
2015-11-11 20:10         ` Jozsef Kadlecsik
2015-11-11 21:20           ` Phil Whineray
2015-11-14  9:12   ` [PATCH v2] Root in namespace owns x_tables /proc entries Philip Whineray
2015-11-15 18:53     ` Jozsef Kadlecsik
2015-11-16 11:56       ` Pablo Neira Ayuso
2015-11-16 12:57         ` Phil Whineray
2015-11-16 22:03         ` Eric W. Biederman
2015-11-16 21:56     ` Eric W. Biederman
2015-11-18  7:37       ` Phil Whineray
2015-11-18  9:13         ` Eric W. Biederman
2015-11-18 18:39           ` Phil Whineray
2015-11-22 11:35           ` [PATCH v3] Set /proc/net entries owner to root in namespace Philip Whineray
2015-11-25 12:55             ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.