SD Core for Linux LC2.0-0

Security

Who you are, what that gets you, and what actually protects the database.

The identity model in SD Core for Linux is not OpenQM's. It is worth understanding before you test anything else, because several behaviors that look like bugs are consequences of it.

What ships secured, before you change anything#

A fresh install starts closed and stays closed until an administrator opens something remote. Nothing below is a setting you have to remember to apply — it is what create.account and the installer already do:

Every SD account an ordinary Linux user with no elevated rights of its own — see Being able to sudo gets you nothing
ssh ForceCommands straight into sd, no shell reachable that way — see ssh access
ssh and the API, per account off for a new account; SDSYS gives each account the route it needs (ssh, api, both) — see Managing accounts
sh, OS.EXECUTE, the editors, the embedded Python, and operating-system files named by path off for a new account, in two independent switches (sh-on, os-on) that SDSYS turns on account by account — see Security and the operating system
Saving a change to a VOC, a program file or a dictionary (and compiling) off for a new account, in three independent switches (voc-on, bp-on, dict-on) that SDSYS turns on account by account; reading is never stopped — see Managing accounts
NETDIRS a line in sd.conf, empty as delivered: directories outside every account, separated by semicolons, that an account without os-on may read and write by pathname as it does inside its own directory. Listing one opens it to every such account, on every route, so list only a directory meant for all of them — see Security and the operating system
The NET gate off for a new account: the net-on switch, which SDSYS turns on (modify.account name net-on), is what lets an account open a file held on another SD server, and the account must also be named in that server's list. Turning it on lets the account's programs read that server's files, and change them only where the server is defined as write and the other server's administrator allowed it; NETFILES in sd.conf (0 as delivered) must have bit 2 set before an API client may open an account;file file here — see Not in SD Core for Linux
File transfer off twice as delivered: the system switch XFER in sd.conf is 0, and a new account's xfer-on switch is off. SDSYS sets XFER=1 and turns xfer-on on for an account. Opening both lets that person bring plain-text files into their own account, and take copies of its records out, with an sftp client over their ssh login: one directory each way, within the size limits, and no shell — see ssh access
Scheduled jobs nothing is allowed or scheduled as delivered. An account's command runs unattended only when SDSYS lists its name for that account (set.batch add), and SDSYS's own jobs (set.job) exist only when SDSYS adds them. A listed command runs with nobody at the keyboard, as the account's Linux user; a set.job job runs one of two fixed commands (backup-all, update-accounts) as sdsys — see Scheduled jobs
The shared account the one door that is open in a new installation, on purpose: every account can read the data files of the shared account by file name, and none can write them — see The shared account
The API local-only (127.0.0.1:4247) until an administrator opens it to the network — see API access
SDSYS from a listed user's own login on this computer off: both lists (local.sdsys ssh and local.sdsys api) are empty. An administrator who lists a Linux user lets that user, from any session of theirs on this computer, become SDSYS with SDSYS's SD password; the Administrator set's Reaching SDSYS from Your Own Login says what that means and how to take a name off
SDSYS both remote doors shut: ssh only after an administrator has opened that door (remote.sdsys ssh on, then the password alone), and no API route from another computer until an administrator has opened that door for chosen addresses (remote.sdsys api on address, then SDSYS's SD password alone); on the machine itself the API accepts it only on the local Unix socket, from a process whose login is sdsys — the one thing this page treats as non-negotiable rather than a default

An ordinary account is not denied a console login here, unlike SD Core for Windows. SD's switches govern what a session inside SD can reach; being at the machine's own console is being on the machine as that Linux user, with that user's own permissions and password, and SD does not stand between the two. See Security and the operating system.

The administrator can open the API to the network — remote.api, remote.ssh — and SDSYS's own doors (remote.sdsys), and that is a decision for their own environment, not a default to second-guess. Securing the transport and shipping a closed-by-default system is what this installer is responsible for; what an administrator does with the accounts they create afterward is theirs.

Further hardening beyond the defaults is available, not built-in. An account can be locked into a single application by removing basic and run from its own VOC (so it can neither compile nor run anything else) and disabling its break key (pterm break off, so it cannot interrupt out to a TCL prompt). Neither is a keyword on create.account — both are done by hand, per account, when that account's whole purpose is one application and nothing else.

The shared account is open to read, by design#

The shared account that the installer makes is the one place where the default is open rather than closed. Every account, new or old, can open its data files by file name (shared.read is on unless SDSYS turns it off with shared-read-off), and none can write them until SDSYS gives it shared-write-on. Nobody but SDSYS can sign on to shared or change the structure of its files. So anything placed in shared is readable by every account that has not had the right taken away: put nothing in it that is not meant for everyone. An account with sh-on or os-on can also reach the files from the operating system. The verbs, programs and catalog of shared are never reached from another account. See Accounts.

Signing in asks for no password#

The operating system has already authenticated you. SD asks Linux who you are.

sd, no account named, logged in as sdsys, locally you land in SDSYS
sd, no account named, any other Linux login you land in the SD account with your own name
no SD account of that name refused — Account %1 not in register (5018)
not in sdusers refused at the door — not registered for SD use (5009)
sd -a<name> refused unless <name> is your own account (10051)
logto sdsys from any other account refused to every session that did not sign in as sdsys, whether or not it came in as root — 10002, audited; the administrator's own session, having gone to another account, may logto sdsys to come back (audited as logto account=sdsys)

As delivered, SDSYS is reached one way only: log in to the machine, locally, as the account literally named sdsys, its own password, and run sd. (An administrator can list Linux users who may also reach it from their own login on this computer; both lists are empty as delivered.) Being able to sudo — able to or not — grants nothing by itself, and there is no route from any other account into SDSYS once a session has started. See Accounts.

SDSYS has its own Linux login password, set once during installation (sudo passwd sdsys). It is an ordinary Linux password, not something SD stores or checks — see Accounts.

sd <command> never asks you to set a password. It runs and exits, so it is not a session anybody is being invited into.

Being able to sudo gets you nothing#

Being in the sudo group, having used it recently or not, is not being an SD administrator. The one and only privileged account is SDSYS, reached the one way described above. SD checks the kernel's own audit loginuid, which records who actually logged in and cannot be forged by sudo or su — every SD-level check rests on that, not on the account a shell happens to be running as.

This is deliberate and total, not a special case for remote sessions. SDSYS itself is refused ssh outright until the administrator opens that door (remote.sdsys ssh on), and then only with its password: nothing else stands between the network and the administrator while it is open, so open it only on a machine whose sdsys password is long and used nowhere else, and shut it again (remote.sdsys ssh off) when it is not needed. The API is shut to SDSYS from every other computer until the administrator opens that door for chosen addresses (remote.sdsys api on address), and then only SDSYS's own SD password stands between those addresses and the administrator; the same care applies, and remote.sdsys api off shuts it. Over the network port on this machine's own loopback it is always refused, and on this machine it is accepted only on the local Unix socket, from a process whose login is sdsys, with SDSYS's own SD password — see ssh access and API access. SDSYS's routes are a genuine login — local, or ssh with its password once remote.sdsys ssh on has opened that door — and the API doors above.

Taking an account out of use without deleting it#

modify.account fred suspended denies entry at all three ways in — ssh and the console, logto, and the API. It is reversible with nothing to remember: the VOC and every group membership are left exactly as they are — suspending sets one field, unsuspending clears it.

Understand what it is and is not, because the name oversells it.

It is an SD control. The three doors SD owns are shut
It is not a Linux control. Nothing is withdrawn there

So a suspended user's ssh connection is still accepted and SD still starts before refusing them. SDSYS can still logto into a suspended account, which is deliberate — that is how you look at one.

If you are suspending an account to contain somebody rather than to park it, lock the Linux account too (usermod -L, or passwd -l). Everything on this page rests on Linux identity; a control that does not touch Linux cannot be the whole answer.

Understand what the security position rests on#

NOTHING IN SD CHECKS A SECRET AT CONSOLE OR ssh LOGIN. ACCESS IS ENTIRELY OPERATING-SYSTEM GROUP MEMBERSHIP.

That is not a weakening. Every SD process opens the database directly, in your own process, under your own Linux identity (a real setuid, not a filtered token — see API access). There is no data server standing between you and the files. So:

While SD runs as the invoking user, account passwords organize access; they do not secure it.

A password gate inside SD is not a file security boundary. The old password model implied one the filesystem never enforced. This states the real position instead of dressing it up.

Passwords still matter for the API, which is a separate door and does require one — see API access.

And ordinary Linux file permissions are the actual wall, the same as they would be for that user logged in directly with no SD in the picture at all — not an SD-specific ACL scheme layered on top. umask (see the Administrator set's Accounts and security chapter) governs what permissions a file gets when SD, or a shelled-out command, creates one; it is a real, per-session mechanism here, unlike on some ports.

What actually protects the database#

The credential file#

$cred, where SD keeps the scrambled password verifiers, is owned by sdsys alone and mode 700 — nobody else can even list it, let alone read a verifier out of it. No password is stored there in any form SD could turn back into a password; what a verifier being readable would cost is somebody constructing one for a password of their own choosing and signing in as somebody else, including through the API. Check it directly:

sudo -u <some-other-account> ls /usr/local/sdsys/\$cred

should refuse for anyone but sdsys.

batch.jobs is read-only to ordinary accounts#

The allow-list Scheduled jobs reads from is sdsys:sdusers, mode 750 — every account can read it (needed, since login checks it on their behalf), nobody but sdsys can write it. A user who could add a line to their own record would be granting themselves the unattended command line.

Your own account's data#

Every SD process runs as the invoking Linux user, so ordinary Linux file permissions are what actually separates one account's data from another's — not a rule SD enforces from inside itself. SD has always refused to let you logto an account you are not a member of; whether the files agree with that, outside SD entirely, is a question of how the account directories under /home/sd/user_accounts are permissioned on this particular machine, the same as it would be for any other Linux service account layout. If your deployment needs guaranteed cross-account file isolation, check and set that permission scheme deliberately rather than assume it — this is one of the places "the only limits are those Linux imposes" cuts both ways.

Continued in#

Security and the operating system — reaching the operating system from inside SD, privileged work, and the audit trail.