You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SMB (Windows file share) connector with per-Knowledge-Base credentials
#156
Add an smb: connector that reads Windows file shares (SMB 2/3) directly, where every source entry, and therefore every Knowledge Base, authenticates with its own credentials. Two Knowledge Bases syncing from the same server, even from the same share, must be able to use two different accounts, and each must see exactly what its account is allowed to read on the share, nothing more.
That is the main point of this request. Reading SMB is the means; per-Knowledge-Base identity is what is missing today.
Use case
Many organizations keep most of their documents on Windows file servers, often behind DFS, protected by NTFS ACLs per team, department or project. We run Open WebUI and one oikb daemon on Kubernetes/OpenShift for many teams. Each team owns its Knowledge Bases and should sync them from the folders it can access, with its account:
sources:
- name: legal-contractssource: smb://files.corp.example.com/legal/contractskb-id: <legal-kb>auth:
user: svc-legalpassword: ${LEGAL_SMB_PASSWORD}domain: CORP
- name: hr-policies # same server, different share, different identitysource: smb://files.corp.example.com/hr/policieskb-id: <hr-kb>auth:
user: svc-hrpassword: ${HR_SMB_PASSWORD}domain: CORP
The Legal KB must never be able to receive HR files, even if someone points its source at the HR share: the Legal account gets "access denied", and that is the desired outcome.
Why there is no way to do this today
The only option is to mount the share and use the local-folder connector:
A mount has exactly one identity. Everything synced from that mount is read with one service account, so every KB synced from it can see whatever that account can read. NTFS ACLs per team cannot be honored. The only workaround is one mount per team, with a cluster admin involved every time, and still no per-KB isolation within a team.
Not self-service, and often impossible in containers. SMB mounts need a CSI driver or privileges. Restricted platforms (e.g. OpenShift's restricted-v2 SCC) don't allow kernel mounts in pods at all.
Costly change detection. The local-folder connector reads every file in full for SHA-256 on every scan, which means re-reading the whole share over the network on every interval.
The per-source auth: block added in 0.5.0 solved the identity problem for GitHub, GitLab, Gitea, Bitbucket, SharePoint and Confluence. File shares are left out.
Proposal
1. Credentials per source entry (the core requirement)
auth: on each entry (and --auth on the CLI): user, password, domain, or user in DOMAIN\user / user@domain form.
No sharing between entries: connections and sessions are keyed by server and identity, so two entries with different accounts on the same server never reuse each other's authenticated session. (With smbprotocol/smbclient, sessions are cached per server and username; entries must not fall back to another entry's registered session or to a process-wide default.)
Optional strict mode, e.g. a top-level require-source-auth: true or per entry auth: { required: true }: an SMB entry without its own credentials fails instead of falling back to environment variables (SMB_USER, SMB_PASSWORD, SMB_DOMAIN). In a multi-user deployment, a silent fallback to a shared account is a data-exposure risk.
Kerberos per entry (later): a keytab or credential-cache path per entry, with separate credential caches so entries don't share tickets.
DFS: referrals are followed using the entry's own credentials.
Failure isolation: "access denied" or "path not found" fails only that entry, with a clear message, and never deletes files from its KB (same as other connectors: fail during scan, before the diff).
oikb validate --deep: authenticates each entry with its own credentials and lists its folder, reporting per entry.
2. The connector itself
Source format:smb://server/share/path, with smb:server/share/path as a short form. UNC style \\server\share\path would be accepted and normalized.
Implementation idea:[smbprotocol](https://github.com/jborean93/smbprotocol). It is pure Python, supports SMB 2/3 with signing and encryption, NTLM and Kerberos, and DFS, and needs no kernel mount or privileges. It could be an optional extra, oikb[smb].
Change detection from metadata (size + last-write time, and file ID where available), so unchanged files are never downloaded, similar to ETags for object storage. Full-content hashing could be offered behind a flag.
Defaults: skip ~$* Office lock files, Thumbs.db, desktop.ini, hidden and system files. Support the usual include/exclude filters and max-size.
NFS is out of scope: in its usual setup (AUTH_SYS) it has no per-user credentials, so a mount plus polling (#21) is a reasonable answer there.
Why it matters
Security: with one shared identity, a Knowledge Base can contain documents its owner may not open on the share. Per-KB credentials make the KB's content match the share's own ACLs.
Self-service: teams connect their own folders without cluster admins creating mounts.
Consistency: the same auth: model as the other enterprise connectors.
We're happy to test against Windows Server and DFS shares, including mixed-permission folders, and to help with a PR.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Summary
Add an
smb:connector that reads Windows file shares (SMB 2/3) directly, where every source entry, and therefore every Knowledge Base, authenticates with its own credentials. Two Knowledge Bases syncing from the same server, even from the same share, must be able to use two different accounts, and each must see exactly what its account is allowed to read on the share, nothing more.That is the main point of this request. Reading SMB is the means; per-Knowledge-Base identity is what is missing today.
Use case
Many organizations keep most of their documents on Windows file servers, often behind DFS, protected by NTFS ACLs per team, department or project. We run Open WebUI and one oikb daemon on Kubernetes/OpenShift for many teams. Each team owns its Knowledge Bases and should sync them from the folders it can access, with its account:
The Legal KB must never be able to receive HR files, even if someone points its source at the HR share: the Legal account gets "access denied", and that is the desired outcome.
Why there is no way to do this today
The only option is to mount the share and use the local-folder connector:
restricted-v2SCC) don't allow kernel mounts in pods at all.The per-source
auth:block added in 0.5.0 solved the identity problem for GitHub, GitLab, Gitea, Bitbucket, SharePoint and Confluence. File shares are left out.Proposal
1. Credentials per source entry (the core requirement)
auth:on each entry (and--authon the CLI):user,password,domain, oruserinDOMAIN\user/user@domainform.smbprotocol/smbclient, sessions are cached per server and username; entries must not fall back to another entry's registered session or to a process-wide default.)require-source-auth: trueor per entryauth: { required: true }: an SMB entry without its own credentials fails instead of falling back to environment variables (SMB_USER,SMB_PASSWORD,SMB_DOMAIN). In a multi-user deployment, a silent fallback to a shared account is a data-exposure risk.oikb validate --deep: authenticates each entry with its own credentials and lists its folder, reporting per entry.2. The connector itself
smb://server/share/path, withsmb:server/share/pathas a short form. UNC style\\server\share\pathwould be accepted and normalized.[smbprotocol](https://github.com/jborean93/smbprotocol). It is pure Python, supports SMB 2/3 with signing and encryption, NTLM and Kerberos, and DFS, and needs no kernel mount or privileges. It could be an optional extra,oikb[smb].~$*Office lock files,Thumbs.db,desktop.ini, hidden and system files. Support the usual include/exclude filters andmax-size.NFS is out of scope: in its usual setup (AUTH_SYS) it has no per-user credentials, so a mount plus polling (#21) is a reasonable answer there.
Why it matters
auth:model as the other enterprise connectors.We're happy to test against Windows Server and DFS shares, including mixed-permission folders, and to help with a PR.
All reactions