Bug 10947 - Shorewall not using new interface naming, blocks outbound connections - 4alpha1 Classic DVD
Summary: Shorewall not using new interface naming, blocks outbound connections - 4alph...
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal major
Target Milestone: ---
Assignee: Colin Guthrie
QA Contact:
URL:
Whiteboard: 4alpha1
Keywords:
Depends on:
Blocks: 11103
  Show dependency treegraph
 
Reported: 2013-08-07 10:08 CEST by claire robinson
Modified: 2013-11-19 09:45 CET (History)
7 users (show)

See Also:
Source RPM: shorewall
CVE:
Status comment:


Attachments

Description claire robinson 2013-08-07 10:08:47 CEST
4alpha1 classic dvd 32 kde default installation. Date.txt 06.08.2013

Outbound connections are being blocked by shorewall. It's visible in the journal.

/etc/shorewall/interfaces is set to use eth0 but new interface naming makes eth0 actually become enp5s8

Once the correct IF is set there are shorewall restarted then the connection works as normal.


Reproducible: 

Steps to Reproduce:
claire robinson 2013-08-07 10:10:01 CEST

CC: (none) => davidwhodgins, ennael1, mageia, thierry.vignaud
Whiteboard: (none) => 4alpha1

Sander Lepik 2013-08-07 10:10:20 CEST

CC: (none) => mageia
Hardware: i586 => All
Assignee: bugsquad => mageia
Whiteboard: 4alpha1 => (none)

Sander Lepik 2013-08-07 10:10:52 CEST

Whiteboard: (none) => 4alpha1

Comment 1 claire robinson 2013-08-07 10:12:18 CEST
Once the correct IF is set there _and_ shorewall restarted.. above :)
Comment 2 Colin Guthrie 2013-08-07 11:15:28 CEST
So the question is, what configures shorewall... It's not in the default file and it's not in any shorewall %post script... drakfirewall I presume?

Using eth0 there would seem wrong anyway, as I don't have any eth0 on my machine under mga3 anyway - only wlan0...

But yes, the code needs uptdated.
Comment 3 Colin Guthrie 2013-08-07 11:38:43 CEST
OK, running things like:

[colin@jimmy drakx (master)]$ perl -I /usr/lib/libDrakX -e 'use detect_devices; use Data::Dumper; print Dumper(detect_devices::get_net_interfaces());'
$VAR1 = 'wlp1s0';
$VAR2 = 'enp0s20u1';
[colin@jimmy drakx (master)]$ perl -I /usr/lib/libDrakX -e 'use detect_devices; use Data::Dumper; print Dumper(detect_devices::get_lan_interfaces());'
$VAR1 = 'wlp1s0';
$VAR2 = 'enp0s20u1';


Both provide useful and correct values for me.

I guess the problem is that this is run from within the installer which does not yet use such names. Does that sound correct?

Can someone confirm that that /mnt/etc/shorewall/interfaces file contains eth0 *before* rebooting at the end of install?

if that is the case then we need work out the best route forward as I'm not sure stage2 would automatically rename any interfaces even if we did include the relevant udev rule... It would be nice if that was all that was needed tho'.

I won't be able to test this more fully until the end of next week, but if someone want to try adding the /usr/lib/udev/rules.d/80-net-name-slot.rules to the stage2 file list and regenerating it, they could try it out and see if this magically fixes things.

All the best.
Comment 4 claire robinson 2013-08-07 12:00:08 CEST
I'll check /mnt/etc/shorewall/interfaces with this next install
Comment 5 claire robinson 2013-08-07 12:50:06 CEST
Checked it right after saying No to installing updates and it is set to eth0
Comment 6 Colin Guthrie 2013-08-07 13:09:23 CEST
Thanks Claire :)

OK, now just need to test if simply adding the udev rule mentioned above to the stage2 lists is sufficient. In retrospect, I think it should actually work fine and be a rather simple fix. I've now committed the change to drakx but I cannot test right now :(

If someone spins a new stage2 then it *should* work (although I cannot guarantee that!)
Comment 7 Thomas Backlund 2013-08-08 13:43:34 CEST
new stage2 submitted

CC: (none) => tmb

Comment 8 Colin Guthrie 2013-08-08 14:12:35 CEST
/me hopes it works (crosses fingers)
Comment 9 Thomas Backlund 2013-08-08 15:34:22 CEST
Nope, didn't work.

However, there is an other option available...

what if we make shorewall(-ipv6) ship a default /etc/shorewall(6)/interfaces

that will allow any interface to pass outgoing traffic ?

that will make this stuff work oob regardless of naming...

this can be done by simply adding the line:

net     +      detect



the "+" acts as a wildcard...
Comment 10 Colin Guthrie 2013-08-08 15:38:26 CEST
Dang. But yes, that seems like a sensible approach generally.

We will likely have to disable the code that runs in drakx that updates that file on install however to prevent it re-breaking the default. We should also check that the code in drakx-net understand the "+" interface when parsing the files...
Comment 11 Sander Lepik 2013-08-08 16:31:17 CEST
(In reply to Thomas Backlund from comment #9)
> this can be done by simply adding the line:
> 
> net     +      detect
> 
> 
> 
> the "+" acts as a wildcard...

Sounds like a good idea as we had similar problems with Mageia 3 too where NM controlled 3G modems were blocked by shorewall.
Comment 12 Dave Hodgins 2013-08-09 01:03:07 CEST
What impact will this have on drakgw, for sharing the internet
connection with other local machines?
Comment 13 Thomas Backlund 2013-08-10 14:52:40 CEST
(In reply to Sander Lepik from comment #11)
> (In reply to Thomas Backlund from comment #9)
> > this can be done by simply adding the line:
> > 
> > net     +      detect
> > 
> > 
> > 
> > the "+" acts as a wildcard...
> 
> Sounds like a good idea as we had similar problems with Mageia 3 too where
> NM controlled 3G modems were blocked by shorewall.

Seems to work fine on alpha1 live medias, so I've pushed a shorewall-4.5.10.1-5.mga4 with the change...


(In reply to Dave Hodgins from comment #12)
> What impact will this have on drakgw, for sharing the internet
> connection with other local machines?

That we need to review / test / fix... 
I guess drakgw should nuke that line when configuring shared internet connection...
Comment 14 Thomas Backlund 2013-08-10 16:52:43 CEST
(In reply to Thomas Backlund from comment #13)
> (In reply to Sander Lepik from comment #11)
> > (In reply to Thomas Backlund from comment #9)
> > > this can be done by simply adding the line:
> > > 
> > > net     +      detect
> > > 
> > > 
> > > 
> > > the "+" acts as a wildcard...
> > 
> > Sounds like a good idea as we had similar problems with Mageia 3 too where
> > NM controlled 3G modems were blocked by shorewall.
> 
> Seems to work fine on alpha1 live medias, so I've pushed a
> shorewall-4.5.10.1-5.mga4 with the change...
> 

I just finished a network install with boot.iso, and it now works oob.

drakx has added a: "net eth0 detect" to the line, even if drakx-net knows it by its real name, so a few fixes is needed to match but it does not break down for now atleast...

and I wonder if some of the issues are more related to timing issues with new systemd/udev/kernel than to the dropping og the "renaming part"
Comment 15 Derek Jennings 2013-08-28 18:53:14 CEST
I just did an install, and found that :-

On running drakfirewall for the first time afer the install drakfirewall listed three interface for me to choose to protect +, enp0s3, and eth0

If I select either +, or enp0s3 then the firewall works as expected, but if I select eth0 the firewall does not protect from incoming connections, but outgoing connections work OK.


Since most users will be expecting their interface to be eth0 I would expect them to automatically select eth0 while wondering what on earth this enp0s3 is.

The second time I start drakfirewall the '+' interface has vanished leaving just enp0s3 and eth0.

CC: (none) => derekjenn

Comment 16 Colin Guthrie 2013-08-28 20:44:51 CEST
Yeah eth0 likely shouldn't be shown at all. As of the the other interfaces, + is special shorewall syntax so drakfirewall should be taught about that and handle it accordingly (e.g. selecting it automatically greys out+selects the others).

As for the enp0s3, this should likely be replaced with the nicer name for the interface e.g. on my system I have a wlp1s0 device, one which I can do:

[root@jimmy ~]# udevadm info --query=all --path=/class/net/wlp1s0
P: /devices/pci0000:00/0000:00:1c.0/0000:01:00.0/net/wlp1s0
E: DEVPATH=/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/net/wlp1s0
E: DEVTYPE=wlan
E: ID_BUS=pci
E: ID_MM_CANDIDATE=1
E: ID_MODEL_FROM_DATABASE=Centrino Advanced-N 6235 AGN
E: ID_MODEL_ID=0x088e
E: ID_NET_NAME_MAC=wlxc8f7338386eb
E: ID_NET_NAME_PATH=wlp1s0
E: ID_OUI_FROM_DATABASE=Intel Corporate
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Network controller
E: ID_VENDOR_FROM_DATABASE=Intel Corporation
E: ID_VENDOR_ID=0x8086
E: IFINDEX=2
E: INTERFACE=wlp1s0
E: SUBSYSTEM=net
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/wlp1s0
E: TAGS=:systemd:
E: USEC_INITIALIZED=3424


So I'd suggest we use ID_MODEL_FROM_DATABASE, which in my case would be "Centrino Advanced-N 6235 AGN" which should be much more user friendly.
Manuel Hiebel 2013-08-28 21:15:50 CEST

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=11101

Manuel Hiebel 2013-08-28 21:17:21 CEST

Blocks: (none) => 11103

Comment 17 Derek Jennings 2013-08-29 01:30:01 CEST
I spent far too long playing with the stage2 installer today trying to work out what is happening.

Just before the service summary, steps.pm sets up the firewall by calling net/shorewall.pm write()  which sets the interfaces according to cat /proc/net/dev or detect_devices::get_net_interfaces()

At this time the interface has already been enumerated as eth0

I tried to define a udev rule to force the interface to a different name but nothing worked.  There does not appear to be a udev rule already setting the name to eth0 so I do not understand the process by which it gets named.

>So I'd suggest we use ID_MODEL_FROM_DATABASE, which in my case would be "Centrino >Advanced-N 6235 AGN" which should be much more user friendly.

I don't think I would like to have to type that on the command line too often.
A long name might also cause probs for some apps like the network applet if they have limited space to display the name.
Comment 18 Colin Guthrie 2013-08-29 10:27:07 CEST
(In reply to Derek Jennings from comment #17)
> I spent far too long playing with the stage2 installer today trying to work
> out what is happening.
> 
> Just before the service summary, steps.pm sets up the firewall by calling
> net/shorewall.pm write()  which sets the interfaces according to cat
> /proc/net/dev or detect_devices::get_net_interfaces()
> 
> At this time the interface has already been enumerated as eth0
> 
> I tried to define a udev rule to force the interface to a different name but
> nothing worked.  

Ahh sorry you spent time on this, as we were already aware that this was the problem.

I actually already committed a udev rule that *should* have named the network interfaces accordingly http://gitweb.mageia.org/software/drakx/commit/?id=14e4a36465175c7a761d212905e02eb4fd28531b, but it seems something is preventing it from working. Perhaps the network is already initialised when udev is started and we don't call an appropriate udevadm trigger or something to kick the rules into life.

> There does not appear to be a udev rule already setting the
> name to eth0 so I do not understand the process by which it gets named.

This is the default scheme used by the kernel. We will likely add a patch to the kernel that will allow us to specify a starting point number different from 0 i.e. eth1000 as this will allow us to keep the old naming rules on upgrade without introducing a race condition in userspace (which has always been present and sometimes results in eth0_rename interfaces existing on some boots...

> > So I'd suggest we use ID_MODEL_FROM_DATABASE, which in my case would be "Centrino >Advanced-N 6235 AGN" which should be much more user friendly.
> 
> I don't think I would like to have to type that on the command line too
> often.

No, not on the command line. It's just what IMO should be shown to the user when selecting interfaces in GUIs like drakfirewall.

> A long name might also cause probs for some apps like the network applet if
> they have limited space to display the name.

The network applet already shows nice friendly names IIRC. But not poked at it for a while.
Comment 20 claire robinson 2013-11-19 09:17:18 CET
beta 1 was certainly able to connect OK so I think so yes.

I'll close this one :)

Thanks

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Comment 21 Colin Guthrie 2013-11-19 09:45:12 CET
(for reference, it's more the stage1 refactor, but the above commit did help too!)

Note You need to log in before you can comment on or make changes to this bug.