Skip to contentSkip to conversation

Bug? iptables-save dumps resolved uids/gids for owner matches

DISCUSSION Ferenc Wagner 3 participants 9 messages Dec 3, 2010 – Dec 7, 2010 1 message not in the archive netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

I opened http://bugzilla.netfilter.org/show_bug.cgi?id=683 quite some time ago, but it hasn't received a single comment yet. Don't you think it's a real problem? If you do, I'm willing to work on fixing it, either by introducing a new option or by changing the default behaviour. Actually, since we're seriously affected by this, I'm determined to solve it, but of course I'd prefer to take a blessed route to get my changes incorporated into the official sources if at all possible.

Comments, opinions, ideas and guidance most welcome. :)

Signature · 2 lines
Thanks,
Feri.
#1 lore raw
Quoted 9 lines · Ferenc Wagner

Hi,

I opened http://bugzilla.netfilter.org/show_bug.cgi?id=683 quite some time ago, but it hasn't received a single comment yet. Don't you think it's a real problem? If you do, I'm willing to work on fixing it, either by introducing a new option or by changing the default behaviour. Actually, since we're seriously affected by this, I'm determined to solve it, but of course I'd prefer to take a blessed route to get my changes incorporated into the official sources if at all possible.

This was done on purpose by me, because username resolution usually does not take ages like DNS, and user ids can actually change if you copy a ruleset to another machine (this is much more unlikely to be the case with DNS).

#2 lore raw
Quoted 10 lines · Jan Engelhardt
Quoted 7 lines · Ferenc Wagner

I opened http://bugzilla.netfilter.org/show_bug.cgi?id=683 quite some time ago, but it hasn't received a single comment yet. Don't you think it's a real problem? If you do, I'm willing to work on fixing it, either by introducing a new option or by changing the default behaviour. Actually, since we're seriously affected by this, I'm determined to solve it, but of course I'd prefer to take a blessed route to get my changes incorporated into the official sources if at all possible.

Quoted 4 lines

This was done on purpose by me, because username resolution usually does not take ages like DNS, and user ids can actually change if you copy a ruleset to another machine (this is much more unlikely to be the case with DNS).

This is indeed true if you only use a local passwd and group database. So we're talking about a design decision, which I'd have taken the other way, and not for pure consistency alone. But how do we proceed now? You took responsibily of the ticket (thanks for that and the enlightening comment, too), does it mean you've got an action plan and will carry that out shortly? I'm sure you could resolve this in about half an hour, but have you got the time? Also, I'd probably need this backported to 1.4.8. Shall I start hacking or had I better wait for you?

Signature · 2 lines
Thanks,
Feri.
#3 lore raw
Quoted 9 lines · Ferenc Wagner
Quoted 7 lines
Quoted 2 lines

I opened http://bugzilla.netfilter.org/show_bug.cgi?id=683

This was done on purpose by me, because username resolution usually does not take ages like DNS, and user ids can actually change if you copy a ruleset to another machine (this is much more unlikely to be the case with DNS).

This is indeed true if you only use a local passwd and group database.

(Is your LDAP _that_ slow?)

The change is now in git://dev.medozas.de/iptables .

parent d4105ad56335058af4b0b1be1278e01f5c0bd4ac (v1.4.9-35-gd4105ad) commit f3578faae096f191a44742777275a23b566d7566

Author: Jan Engelhardt <[email protected]>
Date:   Mon Dec 6 13:32:58 2010 +0100

libxt_owner: output numeric IDs when save is requested

References: http://bugzilla.netfilter.org/show_bug.cgi?id=683

---
 extensions/libxt_owner.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
extensions/libxt_owner.c +3 -3
index 4015f13..867ed49 100644
@@ -558,9 +558,9 @@ static void owner_mt_save(const void *ip, const struct xt_entry_match *match)
 {
 	const struct xt_owner_match_info *info = (void *)match->data;
 
-	owner_mt_print_item(info, "--socket-exists",  XT_OWNER_SOCKET, false);
-	owner_mt_print_item(info, "--uid-owner",      XT_OWNER_UID,    false);
-	owner_mt_print_item(info, "--gid-owner",      XT_OWNER_GID,    false);
+	owner_mt_print_item(info, "--socket-exists",  XT_OWNER_SOCKET, true);
+	owner_mt_print_item(info, "--uid-owner",      XT_OWNER_UID,    true);
+	owner_mt_print_item(info, "--gid-owner",      XT_OWNER_GID,    true);
 }
 
 static struct xtables_match owner_mt_reg[] = {
Signature · 1 line
# Created with git-export-patch
#4 lore raw
Quoted 4 lines · Jan Engelhardt
Quoted 2 lines · Ferenc Wagner
Quoted 2 lines
Quoted 1 line

I opened http://bugzilla.netfilter.org/show_bug.cgi?id=683

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This was done on purpose by me, because username resolution usually does not take ages like DNS, and user ids can actually change if you copy a ruleset to another machine (this is much more unlikely to be the case with DNS).

This is indeed true if you only use a local passwd and group database.

(Is your LDAP _that_ slow?)

It's dog slow until the network is brought up... But maybe there's some misunderstanding here. My problem isn't slowness, it's the fundamental impossibility of resolving the user names to numbers before the network is up. And that's the very time to install firewall rules, isn't it?

Quoted 1 line

The change is now in git://dev.medozas.de/iptables .

How cool! So you decided to change the default behaviour after all!

Signature · 2 lines
Thanks a lot!
Feri.
#5 lore raw
Quoted 9 lines · Ferenc Wagner
Quoted 4 lines
Quoted 2 lines

This is indeed true if you only use a local passwd and group database.

(Is your LDAP _that_ slow?)

It's dog slow until the network is brought up... But maybe there's some misunderstanding here. My problem isn't slowness, it's the fundamental impossibility of resolving the user names to numbers before the network is up.

If the network is not up, the potential connections to the database immediately terminate with "No route to host".

Quoted 1 line

And that's the very time to install firewall rules, isn't it?

Yes indeed.

Quoted 3 lines
Quoted 1 line

The change is now in git://dev.medozas.de/iptables .

How cool! So you decided to change the default behaviour after all!

I just like to light up more corners before making decisions.

#7 lore raw
In reply to a message not in the archive
Quoted 2 lines · Maciej Żenczykowski

Couldn't (shouldn't?) this have been done better with a '-n' command line flag?

The problem _was_ that resolution would take place even in the presence of requesting numeric output (as triggered by -n, among others).

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to Jan Engelhardt

06.12.2010 16:59, Jan Engelhardt wrote:
[]

Quoted 2 lines

If the network is not up, the potential connections to the database immediately terminate with "No route to host".

This is only true if at least the loopback interface is up. If no interface is up-n-running, the connection times out, slowly.

It is for this reason I usually put firewall rules in post-up of loopback interface.

/mjt

#9 lore raw
Quoted 6 lines · Michael Tokarev

06.12.2010 16:59, Jan Engelhardt wrote:
[]

Quoted 2 lines

If the network is not up, the potential connections to the database immediately terminate with "No route to host".

This is only true if at least the loopback interface is up.

It is also true if it's down - http://picpaste.de/long-CssHoqqX.png
(What should have really been used if ip r s table all, because all routes to a particular destination need to be absent.)