diff -urN e-smith-samba-2.4.0.old/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol e-smith-samba-2.4.0/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol --- e-smith-samba-2.4.0.old/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol 2020-06-29 10:28:03.771000183 +1000 +++ e-smith-samba-2.4.0/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol 2020-06-29 10:30:59.000000000 +1000 @@ -1,12 +1,23 @@ { # Normally this should not be set as the automatic negotiation phase in the SMB protocol takes care of choosing the appropiate protocol. - $OUT = ""; - if ($smb{ServerMinProtocol}) - { - $OUT .= "min protocol = $smb{ServerMinProtocol}\n"; - } - if ($smb{ServerMaxProtocol}) - { - $OUT .= "max protocol = $smb{ServerMaxProtocol}"; - } +$OUT = ""; +our %ProtocolOrder = ( CORE => 1, # samba client default without explicit option; not available for server +COREPLUS => 2, # not available for server +LANMAN1 => 3, #samba server default without explicit option +LANMAN2 => 4, +NT1 => 5, # CIFS or SMB1 +SMB2_02 => 6, +SMB2_10 => 7, +SMB2 => 7, # yes SMB2 default to 2_10 +SMB2_22 => 8, +SMB2_24 => 9, +); +$serverMinProt = $smb{ServerMinProtocol} || "LANMAN1"; +$serverMaxProt = $smb{ServerMaxProtocol} || "SMB2"; +#checking option is possible +$serverMinProt = ( exists($ProtocolOrder{$serverMinProt}) ) ? $serverMinProt : "LANMAN1"; +$serverMaxProt = ( exists($ProtocolOrder{$serverMaxProt}) && $ProtocolOrder{$serverMaxProt} >= 3) ? $serverMaxProt : "SMB2"; +$serverMinProt = ( $ProtocolOrder{$serverMaxProt} >= $ProtocolOrder{$serverMinProt} ) ? $serverMinProt : $serverMaxProt; +$OUT .= "min protocol = $serverMinProt\n"; +$OUT .= "max protocol = $serverMaxProt"; } diff -urN e-smith-samba-2.4.0.old/root/etc/e-smith/templates/etc/smb.conf/11smbPorts e-smith-samba-2.4.0/root/etc/e-smith/templates/etc/smb.conf/11smbPorts --- e-smith-samba-2.4.0.old/root/etc/e-smith/templates/etc/smb.conf/11smbPorts 2020-06-29 10:28:03.772000160 +1000 +++ e-smith-samba-2.4.0/root/etc/e-smith/templates/etc/smb.conf/11smbPorts 2020-06-29 10:34:32.000000000 +1000 @@ -1,5 +1,7 @@ { - my $smb_ports = $smb{SMBPorts} || 139; +my $smb_ports = $smb{SMBPorts} || "139 445"; - "smb ports = $smb_ports"; +$smb_ports = "$smb_ports 445" unless ( $smb_ports =~ /445/ || $ProtocolOrder{$serverMinProt} <= 5 );# $ProtocolOrder{$serverMinProt} > 5 + +"smb ports = $smb_ports"; }