Files
mesh-controller/internal/catalogue/smb.go
T
jochen 19173aeb07
mesh/delivery checking
mesh/merge-gate out of date: judged against trunk 1826b68a22b5, the trunk is now 404b4409e70e; judged again on a recheck or when it is merged
mesh/repo-check out of date: judged against trunk 1826b68a22b5, the trunk is now 404b4409e70e; judged again on a recheck or when it is merged
Add the node seat node-smb-server, so the home server's SMB share can be a module's (hq issue 613, ADR 0341)
nfs-server's exports and adopt now say the local-network grant, and that
sharenfs is cleared only once the mesh's export covers every client the
property exported to.
2026-10-13 11:13:59 +02:00

54 lines
3.3 KiB
Go

package catalogue
// A machine's SMB shares, served to the devices on its own network that are not nodes (novox/hq
// ADR 0341).
//
// **One holder per machine.** Two modules writing one machine's Samba configuration is the conflict a
// seat exists to refuse, so the role is a node seat. It delivers nothing: its clients are devices that
// are not nodes, and a node that wants the same files mounts the NFS share (ADR 0263), so no provision
// is answered through it.
//
// **The data is the operator's** (ADR 0051). The holder never creates, chowns or removes anything under
// a shared path, and every client acts as the shared folder's owner. Its verbs read, and the one that
// takes over the configuration a person wrote by hand does it only on a person's word, keeping a dated
// copy of what it replaces.
// SMBServerSeat is the role of the machine that shares folders over SMB with its local network
// (novox/hq ADR 0341).
const SMBServerSeat = "node-smb-server"
// smbServerVerbs is the contract every holder of node-smb-server serves (novox/hq ADR 0341).
func smbServerVerbs() []Verb {
return []Verb{
{Name: "shares", Description: "Every SMB share this machine serves: its name, its path, read-write " +
"or read-only, the owner every client acts as (uid and gid), the logins allowed and whether each " +
"login's password was given or is kept as found, and whether the service serves it now. Also " +
"whether the configuration is the mesh's or still the hand-written one, and each hand-written " +
"share with whether the settings name it. A password is never shown.",
Input: schema(map[string]string{}, nil),
Replaces: []string{"testparm -s", "cat /etc/samba/smb.conf", "pdbedit -L"}},
{Name: "sessions", Description: "Which devices are connected to which share now, with the login and " +
"the protocol version each uses, as the SMB service knows them.",
Input: schema(map[string]string{}, nil),
Replaces: []string{"smbstatus"}},
{Name: "test", Description: "Whether this machine serves one share now and whether its SMB service " +
"is up and listening on 445: what a device on the local network is answered.",
Input: schema(map[string]string{"share": "the share, by its name"}, []string{"share"}),
Replaces: []string{"smbclient -L"}},
{Name: "reload", Description: "Have the SMB service read its configuration again now (smbcontrol " +
"reload-config) and answer the shares as it then serves them. The module's own process writes the " +
"configuration; this is for after a change made outside it. Changes no shared path.",
Input: schema(map[string]string{}, nil),
Replaces: []string{"smbcontrol smbd reload-config", "systemctl reload smb"}},
{Name: "adopt", Description: "Take over the SMB configuration a person wrote by hand: keep a dated " +
"copy of it beside it and write the mesh's own in its place — only when every hand-written share " +
"has its counterpart in the settings, so no share disappears. Without confirm, says what it would " +
"do and changes nothing: each hand-written share beside the mesh's rendering of it.",
Input: schema(map[string]string{
"confirm": "\"true\": change it (needs why); anything else is a dry run",
"why": "why, for the record",
}, nil, "confirm"),
Replaces: []string{"edit /etc/samba/smb.conf"}},
}
}