How to configure Samba to use SMBv2 and disable SMBv1 on Linux or Unix

ADVERTISEMENTS



Configure Samba to use SMBv2 and disable SMBv1 on Linux or Unix

I am a new Linux user and for security reasons and to avoid ransomware, I would like to disable the SMB1 protocol in samba configuration on a CentOS Linux version 7 server. Is it possible to disable SMBv1 on a Linux or UNIX-like operating system? WannaCrypt/WannaCry targets the Microsoft Windows operating system. The attack spreads by phishing emails but also uses the EternalBlue exploit and DoublePulsar backdoor developed by the U.S. National Security Agency (NSA). If you are using older and unsupported operating systems such as Windows XP and Windows Server 2003, you will get infected. All of your files will be encrypted. To get back your files, you need to pay ransom payments in the cryptocurrency Bitcoin. Microsoft has released software updates for Windows XP and Windows Server 2003. You must apply those patches ASAP on Windows operating systems. In short Linux/Unix users are not affected by this attack. However, you must disable SMBv1 on Samba server running on Linux or Unix-like system.

Let us see how to disable SMBv1 on a Linux or Unix like systems.

Disable SMBv1 on Linux or Unix when using Samba

Samba is an open-source implementation of the SMB or CIFS protocol, which allows PC-compatible machines (especially Windows oese) to share files, printers, and other information with Linux and vice-versa.

Configuration to enable SMBv2

Edit smb.conf file, run:

$ sudo vi /etc/samba/smb.conf

Find the [global] section and append the following line:

min protocol = SMB2

Here is my updated file:



protocol = SMB2

protocol = SMB3

Understanding min and max protocol levels in smb.conf

client min protocol – This setting controls the minimum protocol version that the client will attempt to use. client max protocol – The value of the parameter (a string) is the highest protocol level that will be supported by the client. SMB2: Re-implementation of the SMB protocol. Used by Windows Vista and later versions of Windows. SMB2 has sub protocols available: SMB2_02 : The earliest SMB2 version.

: The earliest SMB2 version. SMB2_10 : Windows 7 SMB2 version. (By default SMB2 selects the SMB2_10 variant.)

: Windows 7 SMB2 version. (By default SMB2 selects the SMB2_10 variant.) SMB2_22 : Early Windows 8 SMB2 version.

: Early Windows 8 SMB2 version. SMB2_24: Windows 8 beta SMB2 version. SMB3: The same as SMB2. Used by Windows 8. SMB3 has sub protocols available. SMB3 has sub protocols available: SMB3_00 : Windows 8 SMB3 version. (mostly the same as SMB2_24)

: Windows 8 SMB3 version. (mostly the same as SMB2_24) SMB3_02 : Windows 8.1 SMB3 version.

: Windows 8.1 SMB3 version. SMB3_10 : early Windows 10 technical preview SMB3 version.

: early Windows 10 technical preview SMB3 version. SMB3_11: Windows 10 technical preview SMB3 version (maybe final). By default SMB3 selects the SMB3_11 variant.

The following seems to work with Windows 10/Linux clients too as noted by many in the comments section below:For samba version 4.x, you can setSave and close the file.

Hence setting the following gives best option:

client min protocol = SMB2 client max protocol = SMB3

See smb.conf here for more information.

Restart the samba server

Run the following command on CentOS 7/RHEL 7/Fedora Linux:

$ sudo systemctl restart smb.service

Run the following command on Debian 8.x/Ubuntu 16.04 LTS Linux:

$ sudo systemctl restart smbd.service

NOTE: Please note that Samba version 4.11 removes SMB1 protocol version by default. However, on an older Linux and Unix distro you need to disable it manually to avoid security issues.

Conclusion

And there you have it, SMBv1 disabled on a Linux or Unix samba server to avoid security issues. Please read our comment section below for detailed discussion.