Bug 541958

Summary: Yast2 Samba Server module does not open enough in SuSEfirewall to allow traffic
Product: [openSUSE] openSUSE 11.4 Reporter: Johan Persson <johanp>
Component: YaST2Assignee: Lukas Ocilka <locilka>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P3 - Medium CC: dmueller, forgotten_xs3PtXj4XH, jsuchome, lnussel, locilka, martin.schlander, mge, samba-maintainers
Version: Milestone 5 of 6   
Target Milestone: Milestone 6 of 6   
Hardware: All   
OS: Other   
Whiteboard: maint:planned:update
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Fedora 11 iptables with samba client and server enabled
Output of iptables-save on openSUSE 11.1 with samba server/client and netbios server interfaces allowed

Description Johan Persson 2009-09-24 19:15:16 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/20090730 SUSE/3.5.2-1.2 Firefox/3.0.7, Ant.com Toolbar 1.3

The Yast2 module for Samba Server have a tick box marked "Open ports in firewall" that gives the illusion that marking this tick box would allow Samba traffic to go through the server to the samba server.

However that is not the case. Additional setting in the firewall is needed to make the samba server functional.

The following additional changes are necessary in "/etc/sysconfig/SuSEfirewall2"

1) Open TCP ports 135,139 and 445 
FW_SERVICES_EXT_TCP = "135 139 445"

2) Open UDP posrt 137 and 138
FW_SERVICES_EXT_UDP = "137 138"

3) Allow broadcasts
FW_ALLOW_FW_BROADCAST_EXT = "yes"

A configuration dialogue is needed as well since a trusted network needs to be assigned in order to browse, i.e. FW_TRUSTED_NETS, for example
FW_TRUSTED_NETS="192.168.0.0/24"

But this must be configured by the user so it matches the subnet that the Samba server sits on.

The alternative to do these fixes is to remove the "Open ports in firewall" and ask te user to do this manually since it is broken anyway.

Reproducible: Always

Steps to Reproduce:
1. Eetup a Samba server via Yast2
2.
3.


Expected Results:  
That the samba server is fully functional even with SuSEfirewall2 enabled

Note: Same problem with FTP Yast2 module which I have reported separately
Comment 1 Ludwig Nussel 2009-09-25 07:16:16 UTC
FW_CONFIGURATIONS_EXT="samba-server samba-client"
Comment 2 Lukas Ocilka 2009-09-25 12:09:31 UTC
Configurations 'samba-server' and 'samba-client' are maintained by Samba team.
Comment 3 Ludwig Nussel 2009-09-25 12:18:46 UTC
the question here is which method does the yast module use if the checkbox to open ports is ticked? Does it set FW_CONFIGURATIONS_*?
Comment 4 Lukas Ocilka 2009-09-25 12:38:36 UTC
"FIREWALL": CWMFirewallInterfaces::CreateOpenFirewallWidget($[
    "services": [ "service:samba-server" ],
    "display_details": true
]),

YaST currently doesn't support any other method than FW_CONFIGURATIONS_* for opening a firewall port(s).

BTW: samba-server should contain all ports required by server, using samba-client should not be needed. It comes from the understanding what *-server vs *-client means.
Comment 5 Bo Yang 2009-09-27 03:08:25 UTC
Shouldn't there be something like FW_ALLOW_FW_BROADCAST_UDP="137 138"?

@Johan:
   pls verify if there is something like the one mentioned above. thanks!
Comment 6 Johan Persson 2009-09-27 08:37:01 UTC
I'll do some more testing on a clean setup. I'm not an expert on everything samba needs to be working so the setting I'm using might be too much. I'll do some testing with various settings and report back to this thread.
Comment 7 Ludwig Nussel 2009-09-28 14:37:53 UTC
/etc/sysconfig/SuSEfirewall2.d/services/samba-server does not list any ports for UDP and BROADCAST.
Comment 8 Forgotten User OvlPd7Jcli 2009-10-08 19:54:36 UTC
Created attachment 321719 [details]
Fedora 11 iptables with samba client and server enabled
Comment 9 Forgotten User OvlPd7Jcli 2009-10-08 19:59:22 UTC
Created attachment 321720 [details]
Output of iptables-save on openSUSE 11.1 with samba server/client and netbios server interfaces allowed

Hi,

following a discussion on the -project mailing list, I decided to take a look at what Fedora and RHEL do in this field, since they have had a working implementation of samba and iptables for a long time, without the troubles we face on SUSE even after allowing samba client and server interfaces in SUSEfirewall using YaST.

You find attached the iptables generated on Fedora when the two options "samba client" and "samba server" are selected in their firewall tool (btw, it warns it uses an addtional helper called nf_conntrack_netbios_ns).

You also find attached what iptables-save returns on openSUSE 11.1 after allowing samba client, server and netbios server in YaST SuSEfirewall interface.

I hope this helps to finally find a solution :-)
Comment 10 Bo Yang 2010-02-26 02:34:21 UTC
reassigning..
Comment 11 Forgotten User xs3PtXj4XH 2010-07-04 15:25:36 UTC
Has this been fixed for 11.3?  The YaST2 Samba module should allow Netbios Server and Samba Client in the Firewall module.
Comment 12 Forgotten User xs3PtXj4XH 2010-07-12 08:20:44 UTC
This appears to still be an issue in openSuSE 11.3 RC2.  Selecting "Open Port In Firewall" permits other hosts to connect if they know the IP address of the SuSE Linux machine, but the machine is not visible in in the workgroup as NetBIOS traffic is not permitted. Additionally, attempting to display other hosts on the network through Dolphin gives the error message "Unable to find any workgroups in your local network".  Ticking the box in the Samba module really should enable "Samba Client" and "Netbios Server" in the Firewall module.

I have updated the distribution to reflect the current situation, but the issue is present in openSuSE 11.2 as well.
Comment 13 Jiří Suchomel 2010-07-13 08:06:51 UTC
Ludwig, have you checked that RHEL info from comment 9?
Comment 14 Ludwig Nussel 2010-07-13 08:36:42 UTC
see comment#7
Comment 15 Forgotten User xs3PtXj4XH 2010-08-07 16:37:11 UTC
Ludwig, I hope you've managed to make some progress.  I have tested against 11.3 Final and the issue persists.
Comment 16 Johan Persson 2010-11-05 07:16:33 UTC
Is there any updates on this issue? I just tried 11.3 ans as is pointed out this issue remain.

I fully understand if this is not a high priority since the people (like me) that want this can do the manual tweaking necessary. However I believe that unless this is properly fixed the option "Open ports in firewall" should be disable since it is highly misleading.

Unfortunately I'm not sure I have the expertise in network configuration not to open up too much. I thinks the following minimum needs to be achieved

* SMB Server detectable by clients on the network by browsing
* Full traffic (of course..) through the FW
* Discovery of other servers on the network through Dolphin

Basically a fully working SMB server. 

(There might be security implication by this but any person who enables SMB server would have to know that and be aware of the limitations/consequences)
Comment 17 Forgotten User xs3PtXj4XH 2010-12-13 15:32:57 UTC
I tend to agree Johan. Other clients on the network should at least be discoverable by default.  In any case, I have tested against 11.4 M4 now, and the Samba server module still does not open enough ports for proper Windows network browsing.  Dolphin complains that it cannot find any other workgroups or machines, just as before.
Comment 18 Ludwig Nussel 2010-12-14 16:06:24 UTC
(In reply to comment #4)
> "FIREWALL": CWMFirewallInterfaces::CreateOpenFirewallWidget($[
>     "services": [ "service:samba-server" ],
>     "display_details": true
> ]),

So after talking in circles for years this turns out to be the culprit! The broadcast definition is in the netbios-server service file! So yast needs to specify both samba-server and netbios-server here to allow access to the server itself and name resolution. Do'h!
Comment 19 Forgotten User xs3PtXj4XH 2010-12-15 03:54:52 UTC
Ludwig, I don't suppose you could check in the necessary change?
Comment 20 Forgotten User xs3PtXj4XH 2010-12-30 19:01:44 UTC
This bug is still present in 11.4 M5.
Comment 21 Lukas Ocilka 2011-01-06 16:19:03 UTC
Fix submitted to openSUSE:Factory in version 2.20.1
Comment 23 Forgotten User xs3PtXj4XH 2011-01-06 16:32:27 UTC
Thankyou so much Lukas.  Hope to see the change in M6 or beta.
Comment 25 Forgotten User xs3PtXj4XH 2011-01-10 06:43:23 UTC
It looks like "Samba Client" also has to be added to the list of permitted services before the user can view other automatically-discovered clients on the network through Dolphin as well.
Comment 26 Lukas Ocilka 2011-01-10 09:35:54 UTC
OK, I'll add "Samba Client" as well.
Comment 27 Forgotten User xs3PtXj4XH 2011-01-10 10:51:15 UTC
Much obliged Lukas.  Thankyou.
Comment 30 Lukas Ocilka 2011-01-10 13:42:37 UTC
Submitted new sources to openSUSE:Factory in version 2.20.2
Comment 32 Forgotten User xs3PtXj4XH 2011-01-30 17:22:00 UTC
Works nicely.  Yay!
Comment 33 Lukas Ocilka 2011-01-31 13:24:01 UTC
Thanks for testing :)