Skip to content

core.mount

← Module catalog

soul-sidesoulstack.systemsystemroot required

Manage mount points and /etc/fstab entries.

core.mount manages two things independently: the /etc/fstab entry (persist across a reboot) and the actual mount (runtime). present holds both sides at once (an fstab entry + mounted), absent removes both; mounted and unmounted touch only runtime, without touching fstab. The current status is read via findmnt, and all states are idempotent. Requires root.

Requirements

  • Rootrequired
  • Sidesoul-side
  • Collectionsoulstack.system
  • Categorysystem
Capabilitiesrun_as_rootexec_subprocessfs_write_root

States

core.mount.present — The entry is in /etc/fstab AND the filesystem is mounted (persist + runtime).

Changes when

fstab changed (an entry was added or updated), or the filesystem was not mounted and is mounted now.

Stays unchanged when

The entry is already in fstab and the filesystem is already mounted — both conditions held.

Parameters

ParamTypeRequired / defaultDescription
pathstringrequiredMount point (target).
sourcestringrequiredSource (device/UUID/network share).
fstypestringrequiredFilesystem type (ext4/nfs/…).
optsstringoptionalMount options (default "defaults").

Example — Persistent mount of a data volume

- name: Mount data volume persistently
module: core.mount.present
params:
path: /data
source: /dev/sdb1
fstype: ext4
opts: "defaults,noatime"

Output

FieldTypeDescription
pathstring
sourcestring
fstypestring
mountedtrue
in_fstabtrue

Notes

  • present and absent touch both axes (fstab + runtime); mounted and unmounted touch only runtime and do not touch the fstab entry.
  • An erroneous present writes a persistent fstab entry and tries to mount the source at every boot — the cost of a mistake in source/opts repeats on every boot, unlike a one-time mounted.
  • The mount point is created at mount time if the directory does not exist (mkdir -p, mode 0755).
  • The dump and pass fields in fstab are fixed at 0 0 (not controlled by params); the entry line is <source> <path> <fstype> <opts> 0 0.
  • fstab is edited preserve-by-default: atomically (temp+rename), preserving the existing mode and owner; fstab owner/group are not accepted as params.
  • Requires root: mount / umount and editing /etc/fstab.

Security & defaults

  • Mounting an untrusted source (especially a network NFS/SMB) is the main risk: the module trusts the contents of the mounted filesystem. A source under an attacker's control can slip in setuid files or a symlink outside the mount point.
  • source, path, fstype, opts must come from the Destiny/scenario author, not from untrusted input.
  • Protection against setuid/devices is set by the author via opts (nosuid,nodev,noexec) — the module does not impose them (default defaults).
  • DoS through options and source: a hard NFS mount to an unreachable host hangs and blocks processes that access the mount point; tmpfs without size= will exhaust memory.
  • Argument injection is closed: the positional source/path are separated by -- from the mount/umount options, and no shell is involved.

See also