Files
mars_nwe_pcab/SQLITE-IDENTITIES.md

7.9 KiB
Raw Blame History

MARS NWE — SQLite identities (development update)

Base: 0.9.1-3 with RetroBrowser token fix and Directory Wizard.

Scope

This adds a SQLite-backed Unix identity resolver for new NetWare users, not a replacement for the NetWare credential store. Existing Bindery records, passwords, groups, trustees, login scripts, and Linux account mappings remain unchanged. The only active on-wire mode is NetWare 3.x/Bindery. The wizard shows NetWare 4.x/NDS as unavailable. No fake tree advertisement or NDS login is provided. NDS requires SAP 0x0278, NCP 104/NDAP fragmentation, name/schema operations, NDS challenge/response and authenticated NCP connection binding.

Build and deployment

Apply exactly one patch to the corresponding source base, with git apply --check first:

  • MARS_NWE-sqlite-identities.patch — previous directory wizard already applied.
  • MARS_NWE-directory-and-sqlite.patch — tokenfix already applied, no wizard yet.
  • For pristine 0.9.1-3, apply MARS_NWE-directory-wizard-with-tokenfix.patch, then MARS_NWE-sqlite-identities.patch.

Do not mix these alternatives. Before applying, commit or back up local modifications. The source archive we received lacks upstream-adapter/mars_admin.inc, mars_scripts.inc, mars_acl.inc, and mars_trustee.inc. Use your complete working repository with these original files. Do not overwrite newer adapters with older copies. patch-upstream.sh fails on missing or unknown source anchors. The original source tree may be reused by setting MARS_SOURCE_DIR if needed; rebuild.sh removes only upstream/patched and upstream/build, not upstream/original. It requires the existing upstream tree or network access for the original clone.

sudo apt-get install libsqlite3-dev libcivetweb-dev libjson-c-dev libssl-dev
make check-identity check-directory check-native
node tests/test_directory_ui.cjs
./rebuild.sh

A full rebuild of nwbind/nwconn/nwserv and other linked components is required, not just make native. On a test system first, back up the running configuration, Bindery DB and all volumes/ownership/trustees. Run sudo ./install.sh only after successful full build. The existing installer stops the running service; schedule downtime. Restart using sudo systemctl start mars_vme.service. Reload web frontend. Do not install on a production server until the native and upstream builds and real logins are tested.

Guided operation

Live-Bindery → + Benutzer (SQLite). Enter NetWare name and password. The API checks the live nwbind handshake and full object list, reserves a unique UID/GID, verifies actual lookup inside nwbind, and invokes its original create-user operation. No useradd is performed. The existing manual Linux mapping flow is still available as + Benutzer (Linux-Konto). Use Identitäten prüfen to see reserved IDs and matching live Bindery mappings. Wizard step 1 reports SQLite availability and the actual protocol mode. Password changes, groups and login scripts use the existing Bindery actions.

The live handshake verifies lookup in nwbind, not full client login or nwconn permissions. If the operation fails or times out, the UID remains reserved. Inspect the live Bindery list before repeating. Never manually reassign reserved IDs. New user creation is blocked if the list is truncated. After deletion, old UID/GID values are never recycled; files may still be owned by them. No automatic migration of existing Linux accounts or SUPERVISOR is performed. The existing initial setup still requires a valid local supervisor mapping. Existing configured Unix-authentication policies may not be compatible with virtual accounts; use normal NetWare password authentication.

Storage and security

Database: /var/lib/mars-identities/identities.sqlite3. Root-owned directory (0755), root-owned DB (0644) so MARS processes can resolve identities after privilege drop. It contains non-secret identity metadata (NetWare name, synthetic alias, UID/GID, created_at), not passwords. Names are locally readable like /etc/passwd. The protected Bindery remains authoritative for credentials, enabled state, object IDs, membership and rights. Back up the SQLite DB, Bindery and volume ownership together while stopped. Do not regenerate the SQLite DB on an existing volume; ownership depends on stable numbers. Reserve 200000000–200099999 exclusively for MARS; audit host NSS, subordinate IDs and existing numeric file ownership before deploying. The resolver checks NSS for UID/GID/name collisions, refuses conflicts and never uses UID 0. The alias prefix marsv is reserved. No global NSS edits, no shell login, no synthetic home export. Direct manual assignment of reserved aliases through the web API is blocked. No migration of file ownership is performed.

Use an isolated retro LAN, preferably HTTPS for web administration. Classic NetWare/IPX password mechanisms do not provide modern transport security.

Testing / release gate

make check-identity tests local SQLite allocation and C linker wrappers, including real Linux DAC separation when run as root, and mocked Bindery API interactions. make check-directory and node tests/test_directory_ui.cjs verify the existing wizard. These do not prove NetWare login or trustee behavior. Required end-to-end acceptance on a test installation: create two users, verify no entries in /etc/passwd, log in from XP and DOS, test separate private files, EVERYONE membership, trustees, password change, disable/enable, reconnect after restart, deletion and no UID reuse. Test existing real Linux account login and permissions too. Audit numeric UID/GID use in upstream nwconn, nwbind, quota, print and trustee paths. Full source tree and CivetWeb dev headers were not available for this build in the development environment. No NDS login can be tested until a real NDAP implementation is available.

0.9.8-4: SQL users mapped to an existing Linux account

The default frontend action is now SQL-Benutzer mit Linux-Konto. Select an existing local account explicitly; its name, UID and primary GID are shown. Eligible accounts have UID 1000–59999, nonzero GID and names up to 19 characters (the Bindery UNIX_USER field limit). Root, nobody and reserved virtual aliases are excluded. No account is automatically selected or created.

SQLite adds local_mappings(name, unix_name, uid, gid, created_at) alongside the unchanged virtual identities table. Linux passwords and NetWare passwords are not stored in this mapping table. NetWare passwords remain in Bindery. The Bindery maps directly to the selected real Unix name; native Unix account lookup and supplementary groups are used at runtime. Stored UID/GID are audit snapshots, not an alternative NSS database or an automatic account migration. Account changes are reported by identity inspection; administrators must not recycle accounts or UIDs behind active mappings.

Several NetWare users can intentionally share one Linux account. They then share Unix file ownership and filesystem permissions. NetWare trustees can restrict NetWare access additionally but do not grant rights to Samba. No directories, ownership, ACLs, Linux groups, Samba configuration or passwords are changed by user creation. Old virtual identities continue working unchanged.

The API requires the selected UID/GID and an explicit shared-rights confirmation. SQL reservation precedes Bindery creation; failures retain the reservation and must be investigated, not retried blindly. Live Bindery readback verifies the new mapping. Legacy direct remapping is blocked for SQL-managed local mappings; no automatic migration of existing accounts or owned files is provided.

Tests cover mocked API errors and shared mappings, real isolated HTTP/SQLite/ Bindery creation of two users mapped to one local account, and the actual mobile Chromium selection dialog with mocked API. Simultaneous Samba/NetWare writes and file locking are not validated; a real XP login with newly mapped users remains a client acceptance test.