aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
AgeCommit message (Collapse)Author
2024-12-07system: prevent duplicate Wayland opOphestra Umiker
Wayland is implemented as an Op to enforce dependency and cleanup, its implementation does not allow multiple instances on a single sys object, nor would doing that make any sense. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-12-06proc: cleaner extra filesOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-12-06app: integrate security-context-v1Ophestra Umiker
Should be able to get rid of XDG_RUNTIME_DIR share after this. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-12-06system/wayland: integrate security-context-v1Ophestra Umiker
Had to pass the sync fd through sys. The rest are just part of a standard Op. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-21app: add nixos-based config test caseOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-19app: validate usernameOphestra Umiker
This value is used for passwd generation. Bad input can cause very confusing issues. This is not a security issue, however validation will improve user experience. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-18cmd/fshim/ipc: install signal handler on shim startOphestra Umiker
Getting killed at this point will result in inconsistent state. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-18app: alternative inner home pathOphestra Umiker
Support binding home to an alternative path in the mount namespace. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-17fmsg: add to wg prior to enqueueOphestra Umiker
Adding after channel write is racy. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-17app/start: check for cleanup and abort conditionOphestra Umiker
Dirty fix. Will rewrite after fsu integration complete. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-17app: append # for ChangeHosts message with numerical uidOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-16app: integrate fsuOphestra Umiker
This removes the dependency on external user switchers like sudo/machinectl and decouples fortify user ids from the passwd database. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-09app/config: rename map_real_uid from use_real_uidOphestra Umiker
This option only changes mapped uid in the user namespace. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-06app: support full /dev accessOphestra Umiker
Also moved /dev/fortify to /fortify since it is impossible to create new directories in /dev from the init namespace and bind mounting its contents has undesirable side effects. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-04linux: provide access to stdoutOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-04app: separate auto etc from permissive defaultsOphestra Umiker
Populating /etc with symlinks is quite useful even outside the permissive defaults usage pattern. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-04app/config: UseRealUID as true in templateOphestra Umiker
The template is based on a Chromium setup, which this workaround was created for. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-04fmsg: drop messages when msgbuf is full during withholdOphestra Umiker
Logging functions are not expected to block. This change fixes multiple hangs where more than 64 messages are produced during withhold. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-04cmd/fsu: remove import of internal packageOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-04app: support mapping target uid as privileged uid in sandboxOphestra Umiker
Chromium's D-Bus client implementation refuses to work when its getuid call returns a different value than what the D-Bus server is running as. The reason behind this is not fully understood, but this workaround is implemented to support chromium and electron apps. This is not used by default since it has many side effects that break many other programs, like SSH on NixOS. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-04app: format mapped uid instead of real uidOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-03system/dbus: buffer xdg-dbus-proxy messagesOphestra Umiker
Pointing xdg-dbus-proxy to stdout/stderr makes a huge mess. This change enables app to neatly print out prefixed xdg-dbus-proxy messages after output is resumed. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-11-02cmd: shim and init into separate binariesOphestra Umiker
This change also fixes a deadlock when shim fails to connect and complete the setup. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-28app/start: skip cleanup if shim is nilOphestra Umiker
Shim is created before any system operation happens. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-28shim: expose checkPid in constructorOphestra Umiker
This will be supported soon when launching via fsu. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-27system/dbus: compare sealed value by stringOphestra Umiker
Stringer method of dbus.Proxy returns a string representation of its args stream when sealed. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-27system: move sd_booted implementation to os abstractionOphestra Umiker
This implements lazy loading of the systemd marker (they are not accessed in init and shim) and ensures consistent behaviour when running with a stub. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-27fmsg: initialise dequeue prior to withhold/resumeOphestra Umiker
This fixes the hang on resume when no messages were ever printed. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-27shim: user switcher process management structOphestra Umiker
This change moves all user switcher and shim management to the shim package and withholds output while shim is alive. This also eliminated all exit scenarios where revert is skipped. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-26fmsg: support temporarily withholding outputOphestra Umiker
Trying to print to a shared stdout is a terrible idea. This change makes it possible to withhold output for the lifetime of the sandbox. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25app: separate nixos test cases from testsOphestra Umiker
Test cases are very long, separating them improves editor performance. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25app: test app permissive defaults sealing behaviourOphestra Umiker
This test seals App against a deterministic os stub and checks the resulting sys and bwrap values against known correct ones. The effects of sys and bwrap on the OS and sandbox is deterministic and tested in their own respective packages. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25system: print number of ops completed at point of failureOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25system: include more info in ACL StringerOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25app/start: cleaner command not found messageOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25internal: ReadDir wrapper return fs.DirEntryOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25app/seal: symlink /etc entries in permissive defaultOphestra Umiker
Fortify overrides /etc/passwd and /etc/group in the sandbox. Bind mounting /etc results in them being replaced when the passwd database is updated on host. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25app/config: support creating symlinks within sandboxOphestra Umiker
This is already supported by the underlying bwrap helper. This change exposes access to it in Config. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25shim: kill shim if setup becomes impossibleOphestra Umiker
This prevents a hang when setup faults but the shim keeps waiting on the socket. Setup is automatically aborted when the shim is killed. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25internal: use fallback paths when XDG_RUNTIME_DIR is not absoluteOphestra Umiker
There are scenarios where XDG_RUNTIME_DIR is set to an empty string or garbage. This check tries to ensure reasonable behaviour in most of those cases. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-23internal: wrap calls to os standard library functionsOphestra Umiker
This change helps tests stub out and simulate OS behaviour during the sealing process. This also removes dependency on XDG_RUNTIME_DIR as the internal.System implementation provided to App provides a compat directory inside the tmpdir-based share when XDG_RUNTIME_DIR is unavailable. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-23system: sys comparison methodOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-23system: return sys in queueing methodsOphestra Umiker
This enables building an instance in a single statement. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-21shim: abort setup on failed start and process exitOphestra Umiker
Shim setup listens on a socket in the process share, if shim setup hasn't happened on exit revert will fail. This change makes sure shim setup is aborted on a doomed launch. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-21fmsg: produce all output through fmsgOphestra Umiker
The behaviour of print functions from package fmt is not thread safe. Functions provided by fmsg wrap around Logger methods. This makes prefix much cleaner and makes it easy to deal with future changes to logging. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-21app: move wayland mediation to shim packageOphestra Umiker
Values used in the Wayland mediation implementation is stored in various struct fields strewn across multiple app structs and checks are messy and confusing. This commit unifies them into a single struct and access it using much better looking methods. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-20migrate to git.ophivana.moe/security/fortifyOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-20app: move app ID to app structOphestra Umiker
App ID is inherent to App, and it makes no sense to generate it as part of the app sealing process. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-18state: store launch method instead of launcher pathOphestra Umiker
Launcher path is constant for each launch method on the same system. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-18app/share: fix order to ensure SharePath before any of its subdirectoriesOphestra Umiker
shareTmpdirChild happened to request an ephemeral dir within SharePath and was called before shareRuntime which ensures that path. This commit moves SharePath initialisation to shareSystem and moves shareTmpdirChild into ShareSystem. Further cleanup and tests are desperately needed for the app package but for now this fix will have to do. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>