Require packet signing of clients who mount Samba
shares using the mount.cifs program (e.g., those who specify shares
in /etc/fstab). To do so, ensure signing options (either
sec=krb5i or sec=ntlmv2i) are used.
See the mount.cifs(8) man page for more information. A Samba
client should only communicate with servers who can support SMB
packet signing.
Packet signing can prevent man-in-the-middle attacks which modify SMB packets in transit.
The samba-common package should be installed.
The samba-common
package can be installed with the following command:
$ apt-get install samba-common
If the samba-common package is not installed, samba cannot be configured.
The samba
package can be removed with the following command:
$ apt-get remove samba
If there is no need to make the Samba software available, removing it provides a safeguard against its activation.
To require samba clients running smbclient to use packet signing, add the following to the [global] section of the Samba configuration file, /etc/samba/smb.conf:
client signing = mandatoryRequiring samba clients such as smbclient to use packet signing ensures they can only communicate with servers that support packet signing.
Packet signing can prevent man-in-the-middle attacks which modify SMB packets in transit.
The smb
service can be disabled with the following command:
$ sudo systemctl mask --now smb.service
Running a Samba server provides a network-based avenue of attack, and should be disabled if not needed.
Administrators should not use administrator accounts to access Samba file and printer shares. Disable the root user and the wheel administrator group:
[share] invalid users = root @wheelIf administrator accounts cannot be disabled, ensure that local system passwords and Samba service passwords do not match.
Typically, administrator access is required when Samba must create user and system accounts and shares. Domain member servers and standalone servers may not need administrator access at all. If that is the case, add the invalid users parameter to [global] instead.