# Installation portability and account access

RustSearch supports the documented Debian/Ubuntu Koha layout on native ARM64 or
x86-64 Linux. Hosting-provider names and SSH authentication methods do not define
its permission policy. An SSH PEM key authenticates the administrator; helpers,
workers and engines run under their own local identities.

## Root cause addressed

The launcher intentionally sets `umask 077` for private extracted setup files.
Previously, recursive directory creation for the maintenance lock could create
`/usr/local/lib/koha-rustsearch` as root-owned `0700`. A child helper directory
could be `0755` and its Perl script `0644`, while the Koha account still could not
traverse the parent. Native engine and registry parent creation had the same
intermediate-directory risk.

The installer now provisions code and registry directory traversal explicitly,
independently of inherited umask. It adds execute/search bits only on verified,
root-owned RustSearch runtime directories. A `0700` code parent becomes `0711`;
no read/listing bits are added. Existing restrictive umasks remain unchanged.
Private extraction folders, SSH home directories/keys, plugin trees, index data,
backups and integrity blobs are excluded from permission normalization. No
recursive permission broadening is used.

## Checks and failure behavior

- Maintenance-lock, lifecycle-helper, worker, engine and registry creation use the
  shared access contract. Install and update paths verify staged code access as
  the actual selected instance's Koha account, before using it. Fresh engine
  provisioning checks read/execute access before creating its service unit.
- Staged helper and worker readability is verified by opening the files as the
  real service identity; root's ability to read them is insufficient evidence.
- Existing symlinks, foreign ownership and writable code directories are refused
  with a path-specific error. ACLs are preserved. An ACL or security policy that
  still blocks the account produces an actionable failure rather than a blanket
  chmod or disabled security mechanism.
- Execution checks detect denied mode bits and noexec mounts. Candidate execution
  failures also identify mount/security-policy review as a possible next step.
- Check-only mode does not repair existing directory permissions. As with earlier
  setup, missing code staging/lock directories and the read-only helper may be
  created for inspection; existing blocked parents produce an explicit failure.
- Directly resuming `install.sh` changes to its own extracted bundle directory so
  logs are not accidentally written under an unwritable `/etc/koha` working path.
- Passwordless sudo and interactive sudo authentication retain their existing
  supported flows. Installing from a root-only SSH session still requires the
  documented ordinary administrator account with sudo access. No SSH key modes,
  sudo policy, ACL, SELinux or AppArmor policy is changed by this hardening.

This is defensive handling of supported layouts, not certification of every
Amazon AMI, Vultr image or custom ISO. Unsupported or locally hardened layouts
must produce a clear diagnostic and preserve unrelated permissions.

## Verification scope

Tests cover umasks 022/027/077; existing 0700/0750/0711/0755 parents; private child
files; check-only behavior; writable and foreign-owned directories; symlink escape;
real named-user ACL denials; and actual service-account reads. Disposable Ubuntu
24.04 container runs include an explicit noexec filesystem. An isolated root test
on the ARM64 Koha host reproduces the original denied-read case and verifies the
traversal correction with its real Koha account. No production code directories,
services, indexes or catalogs are changed by these test fixtures. The full Python
setup/update/package suite is rerun after the changes. Native Rust search behavior
and the schema-7 requirement are unchanged.
