Supermicro BMC virtual media ("CD-ROM image" over a Windows share) only
offers the SMB1 dialect "NT LM 0.12", which Samba rejects with
server min protocol = SMB2. Add an opt-in "Allow legacy clients" SMB
setting that renders server min protocol = NT1 and
ntlm auth = ntlmv1-permitted. Off by default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -204,6 +204,7 @@ func (s *Server) smbSettings(w http.ResponseWriter, r *http.Request) {
|
||||
c.SMB.Enabled = r.FormValue("enabled") != ""
|
||||
c.SMB.Workgroup = strings.ToUpper(strings.TrimSpace(r.FormValue("workgroup")))
|
||||
c.SMB.ServerString = strings.TrimSpace(r.FormValue("server_string"))
|
||||
c.SMB.Legacy = r.FormValue("legacy") != ""
|
||||
if err := shares.ValidateComment(c.SMB.ServerString); err != nil {
|
||||
s.sharesFail(w, r, "Not saved: server description: "+err.Error(), smbForm{}, nfsForm{})
|
||||
return
|
||||
|
||||
@@ -226,3 +226,24 @@ func TestSharesNFSFlow(t *testing.T) {
|
||||
t.Errorf("delete: %d %v", rec.Code, f.calls)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSharesSMBLegacySetting(t *testing.T) {
|
||||
srv, _, _ := newTestServer(t)
|
||||
f := &shareRunner{users: "alice:1001:\n"}
|
||||
withShareRunner(srv, f)
|
||||
postForm(srv, "/shares/smb/save", url.Values{"name": {"iso"}, "path": {"/tank/data"}, "users": {"alice"}, "browseable": {"1"}})
|
||||
rec := postForm(srv, "/shares/smb/settings", url.Values{"enabled": {"1"}, "workgroup": {"workgroup"}, "server_string": {"NAS"}, "legacy": {"1"}})
|
||||
if rec.Code != http.StatusSeeOther || !srv.shares.Get().SMB.Legacy {
|
||||
t.Fatalf("legacy not saved: %d %s", rec.Code, rec.Body.String())
|
||||
}
|
||||
if conf := f.written(shares.DefaultSMBConf); !strings.Contains(conf, "server min protocol = NT1") {
|
||||
t.Errorf("smb.conf without SMB1:\n%s", conf)
|
||||
}
|
||||
if !strings.Contains(get(srv, "/shares").Body.String(), `name="legacy" value="1" checked`) {
|
||||
t.Errorf("legacy checkbox not shown as checked")
|
||||
}
|
||||
postForm(srv, "/shares/smb/settings", url.Values{"enabled": {"1"}, "workgroup": {"WORKGROUP"}, "server_string": {"NAS"}})
|
||||
if srv.shares.Get().SMB.Legacy || !strings.Contains(f.written(shares.DefaultSMBConf), "server min protocol = SMB2") {
|
||||
t.Errorf("legacy not cleared")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<label class="check"><input type="checkbox" name="enabled" value="1" {{if .C.SMB.Enabled}}checked{{end}}> SMB server enabled</label>
|
||||
<label>Workgroup <input name="workgroup" value="{{.C.SMB.Workgroup}}"></label>
|
||||
<label>Description <input name="server_string" value="{{.C.SMB.ServerString}}"></label>
|
||||
<label class="check"><input type="checkbox" name="legacy" value="1" {{if .C.SMB.Legacy}}checked{{end}}> Allow legacy clients (SMB1 + NTLMv1) — IPMI/BMC virtual media, old devices; less secure</label>
|
||||
<div class="field"><span class="field-name"> </span><span><button type="submit" class="secondary">Save SMB settings</button></span></div>
|
||||
</form>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user