aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app
AgeCommit message (Collapse)Author
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-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-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-25app/start: cleaner command not found messageOphestra 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-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-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>
2024-10-16system: move enablements from state packageOphestra Umiker
This removes the unnecessary import of the state package. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-16app: port app to use the system packageOphestra Umiker
This commit does away with almost all baggage left over from the Ego port. Error wrapping also got simplified. All API changes happens to be internal which means no changes to main except renaming of the BaseError type. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-15app: filter /tmp from permissive defaultOphestra Umiker
Tmpdir is bind mounted over further along in execution so there is no point sharing it here. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-15helper/bwrap: ordered filesystem argsOphestra Umiker
The argument builder was written based on the incorrect assumption that bwrap arguments are unordered. The argument builder is replaced in this commit to correct that mistake. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-14init: custom init process inside sandboxOphestra Umiker
Bubblewrap as init is a bit awkward and don't support a few setup actions fortify will need, such as starting/supervising nscd. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-13shim: get rid of insane launch conditionOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-13app: generate and replace passwd and group filesOphestra Umiker
This ensures libc functions get correct user information. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-13app/config: map bwrap tmpfs in app configOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-13app/config: always use nobody UID within sandboxOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-13app/seal: skip /mnt in permissive defaultOphestra Umiker
This directory usually contains temporarily mounted stuff and shouldn't get into the sandbox. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-12app/seal: allow GPU access in permissive default when either X11/Wayland is ↵Ophestra Umiker
enabled Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-12app: filesystem struct that maps to all bwrap bind optionsOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-12app: supply template configOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-11app: integrate bwrap into environment setupOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-11app: migrate to new shim implementationOphestra Umiker
Both machinectl and sudo launch methods launch shim as shim is now responsible for setting up the sandbox. Various app structures are adapted to accommodate bwrap configuration and mediated wayland access. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-10app: tag ACL operations for revertOphestra Umiker
ACL operations are now tagged with the enablement causing them. At the end of child process's life, enablements of all remaining launchers are resolved and inverted. This allows Wait to only revert operations targeting resources no longer required by other launchers. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-10app: hardlink sockets to process-specific share local to XDG_RUNTIME_DIROphestra Umiker
This avoids adding ACLs to the PulseAudio directory. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-10app: remove bubblewrap launch methodOphestra Umiker
Launch methods serve the primary purpose of setting UID in the init namespace, which bubblewrap does not do. Furthermore, all applications will start within a bubblewrap sandbox once it has been implemented. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-09dbus/run: support running xdg-dbus-proxy in a restrictive bubblewrap sandboxOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-07dbus: use name resolved by exec.CommandOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-29dbus: configurable xdg-dbus-proxy outputOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-29dbus: toggleable xdg-dbus-proxy outputOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-25dbus: use generalised helper.Helper for xdg-dbus-proxyOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-24app: improve dbus proxy verbose messagesOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-22app: clean up interactions and handle all application state and setup/teardownOphestra Umiker
There was an earlier attempt of cleaning up the app package however it ended up creating even more of a mess and the code structure largely still looked like Ego with state setup scattered everywhere and a bunch of ugly hacks had to be implemented to keep track of all of them. In this commit the entire app package is rewritten to track everything that has to do with an app in one thread safe value. In anticipation of the client/server split also made changes: - Console messages are cleaned up to be consistent - State tracking is fully rewritten to be cleaner and usable for multiple process and client/server - Encapsulate errors to easier identify type of action causing the error as well as additional info - System-level setup operations is grouped in a way that can be collectively committed/reverted and gracefully handles errors returned by each operation - Resource sharing is made more fine-grained with PID-scoped resources whenever possible, a few remnants (X11, Wayland, PulseAudio) will be addressed when a generic proxy is available - Application setup takes a JSON-friendly config struct and deterministically generates system setup operations Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-17exit: move final and early code to internal packageOphestra Umiker
Exit cleanup state information is now stored in a dedicated struct and built up using methods of that struct. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-16move acl and xcb binding packages to top levelOphestra Umiker
These packages are reasonably clean and do not interact with other packages. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-16final: refactor for removal of system package and reduction of interactions ↵Ophestra Umiker
to state package State query command has been moved to main where it belongs, "system" information are now fetched in app.New and stored in *App with accessors for relevant values. Exit (cleanup-related) functions are separated into its dedicated "final" package. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-12verbose: remove system package interactionOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>