NAME
restrict-shell - login shell giving a user the console of their own zone only
SYNOPSIS
/opt/omnicube/sbin/restrict-shell
DESCRIPTION
restrict-shell is a login shell, not an interactive one. It is meant to be the shell of an unprivileged account that must be able to reach the console of exactly one zone - the zone whose name is the account's own login name - and nothing else on the host. The account owner never obtains a command prompt on the global zone: when the console session ends, the shell logs out.
On invocation it performs, in order:
All privileged work is delegated to restrict-shell-cmd(8); restrict-shell itself runs entirely with the calling user's identity and holds no privilege. The pair is deliberately split this way so that only the small helper that validates its own arguments carries an exec_attr entry.
The shell sets its own PATH to /usr/bin:/usr/sbin:/sbin:/opt/ooce/bin:/usr/gnu/bin and does not source /opt/omnicube/lib/common/utils.sh, so none of the usual OmniCube SMF configuration, locking or run-level guard applies to it.
OPERANDS
This command takes no options and no operands. Anything passed on the command line is ignored; the zone to enter is determined solely by LOGNAME.
USAGE
Example 1: create a console account for zone win2022
The login name must equal the zone name, and the account needs the RBAC profile that allows it to run the privileged helper:
useradd -s /opt/omnicube/sbin/restrict-shell -m win2022 usermod -P 'OmniCube Restricted Shell' win2022 passwd win2022
usermod -P replaces the profiles= list in user_attr(5) — illumos has no + modifier — so on an account that already holds profiles, pass the whole comma-separated list. Verify with profiles -l win2022.
Example 2: restrict an ssh key to the zone console
Wiring the same shell in as a forced command keeps the restriction in place even for a key on an account whose shell is something else. In sshd_config:
Match User win2022
ForceCommand /opt/omnicube/sbin/restrict-shell
PermitTTY yes
AllowTcpForwarding no
X11Forwarding no
PermitTunnel no
Per-key equivalent in authorized_keys:
command="/opt/omnicube/sbin/restrict-shell",no-port-forwarding,\\ no-agent-forwarding,no-X11-forwarding ssh-ed25519 AAAA... op@ws
Example 3: what the session looks like
$ ssh win2022@node1 win2022 Use #~ to exit [Connected to zone 'win2022' console]
EXIT STATUS
FILES
ENVIRONMENT
SECURITY
The intent is containment by construction: the account has no shell, no argument it supplies is used, and the single privileged operation it can reach is parameterised only by its own login name.
LOGNAME is attacker-controlled in principle, but spoofing it buys nothing: restrict-shell-cmd(8) independently re-derives the caller from the real uid, which is preserved because its exec_attr entry uses euid=0 rather than uid=0. The validation here only fails fast with a clear message. Likewise, a wrong pid discovered by the ps scan is rejected by the helper rather than acted upon.
The account must hold the OmniCube Restricted Shell profile only. It must not hold OmniCube Administration, which is root-equivalent.
SEE ALSO
omnicube_utils(3), omnicube(7), manage_zone.sh(8), restrict-shell-cmd(8).
NOTES
The console is spawned by the helper as zlogin -e '#' -C zone, so the escape character is # and the sequence that disconnects the console is #.amp;. The hint printed by this shell says Use #~ to exit, which does not match that escape sequence; use #. to leave the console.
Because the exit status of the helper is not propagated, a refused or failed console attempt is indistinguishable from a normal logout for anything that inspects the shell's status. The refusal message itself is printed on standard error.
The shell assumes the convention that a zone's console account is named after the zone. An account whose name does not match a configured zone gets a refusal from the helper and an immediate logout.