Bra*_*roy 7 permissions security mount samba password
在工作中,我们为工作组使用服务器,我们都有自己的帐户。我们还拥有我们小组所属机构的存储空间。所以每个人的存储都挂载在/etc/fstab文件中,eg
//external/storage /mounting/point cifs noperm,cred=/home/user/.smbcredentials,domain=WORK,iocharset=utf8,vers=3.0,sec=ntlmv2i,uid=user,gid=WORKGROUP,dir_mode=0770,file_mode=0770 0 0
Run Code Online (Sandbox Code Playgroud)
每个人都将他们的凭据放入他们的/home/user/.smbcredentials文件中,例如
user=user
password=pass
Run Code Online (Sandbox Code Playgroud)
但是,该文件是纯文本的。权限是正确的,因此只有用户可以查看/更改文件,但据sudo我所知也可以。问题在于,该密码也是作为机构一部分的用户敏感信息的密码(因此存储与敏感信息链接到同一帐户)。那么,我担心的是,如果服务器甚至只是用户的帐户被泄露,这可能会产生严重的后果,因为密码是以纯文本形式提供的。
我的问题是:如何才能使其更加安全?肯定有明文密码的替代方案吗?
目前,不支持加密凭据。从smbclient关于-Uand -Awhich 是在幕后传递的内容的联机帮助页中:
-A|--authentication-file=filename
This option allows you to specify a file from which to read the
username and password used in the connection.
...
Make certain that the permissions on the file restrict access from
unwanted users.
-U|--user=username[%password]
Sets the SMB username or username and password.
...
A third option is to use a credentials file which contains the
plaintext of the username and password. This option is mainly
provided for scripts where the admin does not wish to pass the
credentials on the command line or via environment variables. If
this method is used, make certain that the permissions on the file
restrict access from unwanted users. See the -A for more details.
...
Run Code Online (Sandbox Code Playgroud)
即使在目前的 20.04 中也是如此。您必须使用纯文本凭据。
您指出“用户帐户被破坏的风险”是一种风险,并且这些凭据也是管理员凭据:
该机构所需的密码是一个通用的密码(管理、邮件、存储)。
IT 安全规则#2 是最小特权和特权分离的概念。这是区分管理员帐户和非管理员帐户的地方。 所有优秀的组织都会在某些方面发挥作用,从而阻止对其他系统的“管理员”访问。存储和电子邮件访问只是必须审核访问尝试或限制某人访问信息的方式的问题。
另一个问题是,如果您的系统遭到黑客攻击,您会遇到许多其他问题,其中最重要的是某个特定用户的密码泄漏(您可以通过在 Active Directory / LDAP 系统中强制更改密码来解决此问题)。
在不泄露密码的情况下执行此操作的唯一其他方法可能是在安装周围编写包装器,手动请求凭据,然后直接执行安装命令而不暴露凭据文件或密码。这里棘手的部分是,这必须由用户手动输入并执行,这意味着自动 fstab 挂载将不起作用。它还需要专门的访问权限(或特定的sudoers条目才能正常工作),因为您将传递安装选项,并且root当前只能在所有设置中执行此操作mount。
至于你的评论的其余部分:
...也许我建议他们允许(或者更好的是,要求)使用不同的密码进行 samba/存储访问
...您必须与samba.org 上的Samba 开发人员讨论这个问题。虽然这个请求很可能已经在某个地方,但 Windows 互操作性是一个痛苦,所以......