# Per-user PBS and Slurm connections The opt-in PBS bound executor lets an authority accept HTTPS machine keys and route jobs through each principal's own existing PBS account. The first slice requires broker and scheduler driver on the same authority. Remote drivers and client-supplied connections are refused. [Machine keys](machine_keys.md) describes the laptop workflow; [gateway](gateway.md) describes project limits and ownership. The same executor serves Slurm lanes; see [Slurm lanes](#slurm-lanes) below. An operator provisions a new immutable execution generation and private workspace for each connection. The external configuration has three matching records: - A gateway project `execution_bindings.PRINCIPAL` selects an `execution_id`, target, account, positive UID and `pbs` runtime profile. An array of tables gives the principal several generations; see [program grants](#program-grants-270). - `[pbs_executor] enabled = true` and `bindings.EXECUTION_ID` authorize the full binding, including authority/project/principal, and absolute `ssh_config`, `known_hosts` and `private_key` paths. - The target's `ssh` is exactly `vq-pbs-EXECUTION_ID`, `scheduler = "pbs"`, and its `scheduler_driver` names a local (`ssh = "localhost"`) driver. The target must appear in `broker.targets`. The `pbs` profile contains a canonical operator-assigned `site_id`, SHA-256 hashes of the SSH profile and private pinned known-hosts file, the actual key's OpenSSH `SHA256:` fingerprint, and the qualified `program` and full `source_sha` or a `programs` table of granted programs. The grant's `binding` has the same fields as the gateway execution target plus `schema_version = 1`, `authority`, `project` and `principal`. Keep all files in external operator storage, owned by the authority account, regular and mode 0600. Do not store private keys, site profiles or real deployment examples in Git. Use `ssh-keygen -y -f KEY` and `ssh-keygen -lf -` to derive the actual private key's fingerprint, and `sha256sum PROFILE KNOWN_HOSTS` to obtain file hashes. Configure the dedicated SSH profile with one explicit IdentityFile, the bound User, a single pinned UserKnownHostsFile, GlobalKnownHostsFile /dev/null, VerifyHostKeyDNS no, StrictHostKeyChecking yes, IdentityAgent none, IdentitiesOnly yes, ForwardAgent no, ControlMaster no, ControlPath none, PreferredAuthentications publickey, PasswordAuthentication no, KbdInteractiveAuthentication no, GSSAPIAuthentication no and HostbasedAuthentication no. The authority verifies the resolved `ssh -G` policy and real remote `id -u`. A necessary jump-host route needs its own operator qualification; final-hop checks do not certify a shared jump credential as cross-user isolation. Admission requires a running driver's matching capability, open admission, state-root agreement and exact qualified runtime pin. The executor fixes the program/source identity and refuses automatic retry/resume variants this slice does not support. Ordinary target submission supplies durable keyed replay; submission, scheduler polling/control, logs and result copying all select the same SSH profile. The retained private connection ledger prevents reuse of a site's account or UID by another principal and detects changed lane generations. Never delete it to make a changed connection pass. ## Program grants (#270) One lane may run several programs. Besides the legacy `program`/`source_sha` pin, a generation's `pbs` profile may carry `programs`, each with a runtime policy: - `kind = "git"`: `commits`, an allowlist of full 40-hex commits. The target's registry or deployment record must report the selected commit (the job's `expected_sha`, or else the target's current pin) and it must be in the allowlist. Commits listed for the legacy `program` extend its single pin, for example with selected main commits. The target still runs one verified runtime per program name; register a development build under its own program name when it must run alongside the release. - `kind = "digest"`: an absolute `executable`, its `sha256`, optional `companions` (absolute path to sha256), a `convention` (`crystal`, `orca`, `vasp` or `plain`), an optional `version` label and an optional `mpi` launcher. Before admission and again before delivery the executor runs `/usr/bin/sha256sum` on these files, the MPI launcher included, over the lane's own SSH profile and refuses any difference. A verification is reused for 60 seconds, one placement pass. `vq remote info` shows each grant's convention, sha256, version and launcher; the job's runtime block records the executable, its sha256, the version and the launcher with its sha256. The digest is the trust anchor, not the path or its owner: the executable may sit outside the principal's home, for example in a group-readable licensed tree owned by another user, as long as the lane account can read it. A rebuild changes the digest, and the grant refuses until it is updated. A digest program never runs a client command. The client sends only the convention's arguments and the gateway composes the command: | Convention | Client arguments | Job | |---|---|---| | `crystal` | `DECK [fort.9] [fort.98]` | copies the `.d12` deck to `INPUT`, runs the serial executable with `INPUT` on stdin in the job directory (also `TMPDIR`), deletes `fort.9`/`fort.98` unless named; keeps stdout as `OUTPUT` and exits 65 when CRYSTAL exits 0 with an `ERROR ****` line or without its `EEEEEEEEEE TERMINATION` line (#271) | | `orca` | `NAME.inp` | runs the executable by its absolute path, output to `NAME.out` | | `vasp` | `[WAVECAR] [CHGCAR]` | needs `INCAR`, `KPOINTS`, `POSCAR` and `POTCAR` at the top of the payload; runs VASP in the job directory under the `mpi` launcher; `OUTCAR`, `OSZICAR`, `vasprun.xml` and `CONTCAR` come back with the results; deletes `WAVECAR`/`CHGCAR` unless named | | `plain` | any | the executable followed by the arguments | The deck or the VASP inputs must be files of the uploaded payload. For VASP the payload carries the POTCAR, so licensed POTCAR data is retained with the job's inputs and results under the normal result retention. Grant each build under its own program name, for example `vasp-std` for `vasp_std` and `vasp-gam` for `vasp_gam`: the program name selects the executable. ### MPI launch `mpi = {launcher, sha256, arguments, processes_flag}` starts a digest program as `LAUNCHER ARGUMENTS... PROCESSES_FLAG $VQ_CPUS EXECUTABLE`: one rank per requested core, `OMP_NUM_THREADS=1`, on the job's single node (the Torque dialect requests `nodes=1:ppn=N`). The launcher is the site's MPI starter that matches the program's build; it is pinned by sha256 like the executable, so a site MPI update also refuses until the grant is updated. `arguments` are fixed site flags such as `["--bind-to", "core"]`; the client cannot add any. `processes_flag` defaults to `-np`. The launcher belongs to the grant, so each program on a lane can use its own MPI. The launch is generic: `vasp` requires it, `crystal` with `mpi` runs a parallel CRYSTAL build with `INPUT` both staged in the job directory and on the launcher's stdin, `plain` passes its arguments after the executable, and `orca` refuses it because ORCA starts its own ranks. A parallel CRYSTAL build may print its whole output on stderr, so the `crystal` MPI form keeps stdout and stderr together in `OUTPUT` and applies the #271 check to both. The job's stdout log then holds that output and its stderr log stays empty. If batch jobs on the site lack the MPI library path, don't use lane prologue lines or `scheduler_program_hooks`: they are part of the host configuration, so they change the lane and force a new generation. Instead, grant small wrapper scripts that set `OPAL_PREFIX`/`LD_LIBRARY_PATH` and `exec` the real file. Make one wrapper the `executable` and another the `mpi.launcher`, and pin the real program binary and the real `mpirun` as `companions`. Every file is verified by sha256, and ranks on the job's node inherit the launcher's environment. A parallel CRYSTAL grant, the prebuilt CRYSTAL23 1.0.1 Pcrystal under its OpenMPI build, ran on 8 ranks of one PBS node through the public gateway on 2026-11-15. Its SCF cycles matched the serial build's, and it completed with exit code zero. On a Slurm lane the allocation is one task with N CPUs, so the site's launcher flags must allow N ranks in it; that is not yet validated. Optional grant fields (`version`, `mpi`) stay off the wire when absent, so existing grants keep their digests. A restart guess such as `fort.20` travels in the payload. A lane must not define a `scheduler_program_hooks.NAME.command_wrapper` for a digest program; prologue and epilogue lines (module loads, licence variables) still apply. Register the program on the driver (`kind = "scheduler"` is enough) so ordinary scheduler submission accepts the name. Granting, changing or revoking programs keeps the lane: the connection ledger's lane digest excludes `programs`, so no new alias is needed. The binding digest does change. Update the gateway generation and the `[pbs_executor.bindings]` grant together, since config loading refuses a mismatch, and restart the driver so it advertises the new grant. A job admitted under an earlier binding of the same lane is delivered only while its program (and commit, or identical digest grant) is still granted. Changing the legacy pin or any connection field is still a new generation. `PBSExecutorConfig` refuses a grant whose key is not its `execution_id`, a lane alias in two grants and a site account or UID held by two principals. A gateway PBS generation must equal its executor grant field for field. Use a new execution ID, target and private connection directory for key rotation or a runtime/configuration change. Retain old grants, files, workspaces and runtime generations while existing jobs reference them. Removing a grant fails closed, including if the target is changed to a shared SSH alias. Revoke a laptop key through the gateway without cancelling its already accepted jobs. A separate pilot driver can set `VQ_STATE_DIR` and `VQ_CONFIG_DIR` without restarting an existing driver. Explicit `VQ_GATEWAY_STATE_DIR` and `VQ_BROKER_STATE_DIR` select the existing durable gateway and broker stores when that deployment requires them. Every participating process must use the same selected roots; these variables never move or migrate existing records. The local driver's executable wrapper must explicitly select its own config/state, since broker subprocesses clear inherited driver overrides. On Linux the colocated gateway and driver should use the same UID and primary GID so process-based state-root attestation can read the driver's environment. Grant the proxy socket's group through a supplementary group and explicit socket group/mode. A socket connection alone is insufficient state-root agreement; keep admission closed when that attestation is unavailable. Expose the separate gateway ASGI service's `/v1/` routes through the trusted HTTPS proxy, keeping browser routes on the hosted console. A machine key must not become a console/staff credential. Preserve verified-email, password/TOTP, CSRF and recent-MFA checks on browser issuance. A single-user live pilot should demonstrate public HTTPS authentication, idempotent submission, the expected PBS UID, completion, owned logs and checksummed result download. Deny a foreign API principal access to the known job ID. The maintainer chose single-user completion first in #243. Qualification between users remains open separately in #247 under #236 and needs another participant's separate PBS account and site-approved tests for peer workspace, process and scheduler-control denial and protected authority credentials/runtime. Different keys for one Unix account cannot demonstrate these properties. The single-user qualification recorded on 2026-11-09 passed the public HTTPS path, one PBS job in a mode-0700 workspace, the expected UID, released vibe-qc 0.18.11, completion with exit code zero and 15 checksum-verified result files. The same broker job and target job survived keyed recovery after correcting a local-driver alias handoff; replay created no duplicate. A foreign API principal received 404 for status, logs, manifests and an exact result download. Revoked test credentials received 401. This client allowed HTTPS while denying SSH and SSH credential reads. It does not substitute for a run initiated on the actual external laptop or for the remaining two-account OS/scheduler qualification. Site identities, raw evidence and deployment configuration remain external. ## Slurm lanes A Slurm lane (#270) uses the same executor, files and checks as a PBS lane. Only three things differ: - The binding carries a `slurm` runtime part instead of `pbs`. Its fields are the same: `site_id`, `profile_sha256`, `known_hosts_sha256`, `key_fingerprint`, the legacy `program` and `source_sha` pin, and any `programs` grants (#270). As for PBS, program grants are policy, not lane identity. - The grant lives under `[slurm_executor]` (`enabled = true`, `bindings.EXECUTION_ID`). Each key must equal its binding's `execution_id`, and the binding may carry no `pbs` or `container` part. - The target's `ssh` is exactly `vq-slurm-EXECUTION_ID` and its `scheduler = "slurm"`, with `scheduler_dialect = "slurm"`, a local (`ssh = "localhost"`) `scheduler_driver` and an entry in `broker.targets`. A synthetic example for one principal (all names, paths and hashes are placeholders): ```toml min_vq_version = "X.Y.Z" # the first release with the Slurm executor [gateway] execution_authority = "authority-one" [gateway.projects.group-a.execution_bindings.alice] execution_id = "alice-slurm-001" target = "cluster-alice-001" account = "worker_alice" uid = 21001 [gateway.projects.group-a.execution_bindings.alice.slurm] site_id = "cluster-site" profile_sha256 = "" known_hosts_sha256 = "" key_fingerprint = "SHA256:" program = "vibeqc-release" source_sha = "<40-hex release commit>" [slurm_executor] enabled = true [slurm_executor.bindings.alice-slurm-001] ssh_config = "/srv/vq-authority/connections/alice-slurm-001/ssh_config" known_hosts = "/srv/vq-authority/connections/alice-slurm-001/known_hosts" private_key = "/srv/vq-authority/connections/alice-slurm-001/id_ed25519" [slurm_executor.bindings.alice-slurm-001.binding] schema_version = 1 authority = "authority-one" project = "group-a" principal = "alice" execution_id = "alice-slurm-001" target = "cluster-alice-001" account = "worker_alice" uid = 21001 # plus a [slurm_executor.bindings.alice-slurm-001.binding.slurm] table # identical to the gateway binding's slurm table above [hosts.cluster-alice-001] ssh = "vq-slurm-alice-slurm-001" scheduler = "slurm" scheduler_dialect = "slurm" scheduler_driver = "driver" scratch_root = "/scratch/worker_alice/vq" submit_extra = ["--partition=compute", "--account=group-a"] fleet_role = "alias" fleet_canonical_host = "cluster" # the shared lane holding the deployment [broker] targets = ["cluster-alice-001"] # add to the existing list ``` A PBS binding or grant cannot authorize a Slurm lane, and the reverse. A `vq-slurm-` alias without a grant, or a protected lane switched to a shared alias, is refused rather than run under a shared account. Partitions, accounts and QOS go in the lane's `submit_extra`, for example `["--partition=compute", "--account=group-a"]`. They are part of the lane definition, so changing them later needs a new generation (see below). The runtime pin comes from the lane's verified deployment record, as for PBS: either its own `scheduler_runtime_deployments` entry, or an alias (`fleet_role = "alias"`, `fleet_canonical_host`) of the shared Slurm lane that holds the deployment. Either way the principal's account must be able to read and execute that runtime. Admission still needs `programs[PROGRAM] == "OK"` and `runtime_pins[PROGRAM] == source_sha` from the running driver's capacity receipt for this target, plus the real remote `id -u`. Config loading checks that each gateway Slurm generation equals its `[slurm_executor]` grant, one grant per lane, and one owner per site account or UID across the PBS and Slurm grants. PBS and Slurm generations also share the private connection ledger (historically named `pbs-connections/`). One site account or UID belongs to one principal whichever scheduler serves it. A Slurm entry records `[site_id, "slurm", account, uid]`. PBS entries and PBS binding digests are unchanged, so existing PBS lanes keep their claims. Grant a Slurm lane only on a driver that runs a vq version with this executor. An older vq refuses the `slurm` binding part, because the gateway configuration forbids unknown fields. It would also ignore an unknown `[slurm_executor]` section, so set `min_vq_version` in a configuration that uses it. A program granted on two lanes of one principal makes every submission of it without `--target` a 409. To add a Slurm lane beside a PBS lane that already runs a program, grant the Slurm runtime under its own program name, for example `vibeqc-marvin`, and register that name on the driver and in the target's registry. The existing program then keeps its default route. The single-user Slurm qualification recorded on 2026-11-15 passed the public HTTPS path, one job in a mode-0700 workspace on a site partition under the bound account and UID, vibe-qc 0.19.0 from a git-pinned per-SHA launcher, completion with exit code zero, the documented RHF/pob-TZVP water energy, and checksum-verified result files. As for PBS, the two-account qualification remains open (#247). The relay connector checks bound requests through the same bound executor. A relay deployment with scheduler bindings therefore needs the grant, the lane and its local driver on the connector's authority. This is untested on a live deployment; #270 P3 tracks it.