21 Commits

Author SHA1 Message Date
tomFlowee 041a6f486f Fix potential hijack of the pipe.
The pipe is between me and myself, so checking was minimal, but lets
not assume and add some checks to avoid overflow attacks.
2026-03-27 10:39:15 +01:00
tomFlowee d046c171f6 New feature; add encrypt-at-rest
When a jail is encryted at rest using 'encfs' we detect that and ask for
a password upon starting the jail.

This sounded like a neat little idea which ended up taking nearly 4 days
to do...
EncFS needs to be running as root, as it is a FUSE system and it will
actually stop root from reading/writing files if it is running as a
user. It also is very picky about not running in a namespace, it manages
to hang indefinitely otherwise where a shutdown can't complete because
the process doesn't want to die :-)

So, it runs as root, takes the password via a pipe and we have a
watchdog proces to kill it when the jail is shut down.
2024-05-20 22:21:03 +02:00
tomFlowee 4c1505b8fa Move chdir() to the main.cpp 2024-05-20 22:12:45 +02:00
tomFlowee cfebf56ea2 Give auto-deleted jobs a unique name
Avoid actually starting an existing profile by adding a random number to
our profile name.
2024-02-26 11:11:25 +01:00
tomFlowee f7c9347c4c Process data sent from runner to listener
The pipe was always there, but we didn't really use it so far.
This now uses the pipe to send back the PID of the 'jailer' which we
store in a 'state' file.
2024-02-25 19:22:08 +01:00
tomFlowee eaedd64568 Re-view the process hierarchy
After introducing a new process that dispatches new processes _inside_
the jail, there is no point leaving the root owned 'runner' in memory.
So we move its functionality to the new mini-dispatcher (since renamed
to jailer) and remove it from the tree.
2024-02-21 14:25:15 +01:00
tomFlowee 4becd867af Allow sharing jails
When a request comes for a profile that already has someone running,
we now send a message to that jail and make them run the second
application in there directly.

The basis here is that it is impossible to recreate the 'jail' exactly
with things like tmpfs. So requests like "start a new firefox window in
the same process" need to actually run in the jail we created before.
So due to that I leave a process that I call 'mini-dispatch' which
itself lives inside of the jail, so it can trivially exec a new process
there.
2024-02-21 11:21:37 +01:00
tomFlowee e75359bcbe Rename the 'middle' process to dispatcher 2024-02-20 22:15:20 +01:00
tomFlowee 1df8778a60 Close pipes
The child runner isn't supposed to use the pipes its parent
owned, so simply close them and avoid everyone inheriting them.
2024-02-20 21:57:25 +01:00
tomFlowee ce7046efa2 Rename from 'securityManager' to 'IsolationRunner'.
The defaults are not 'secure', as they would be annoying to the max.
This is an isolation runner, removing a lot of attack vectors, for sure
but the name would give the wrong impression with defaults like we have
now.
2024-02-19 12:54:52 +01:00
tomFlowee 279e6b5078 Add ability to point to the ruleset 2024-02-19 09:44:46 +01:00
tomFlowee 02a723827c Make sure that only one is running at a time 2024-02-19 09:23:40 +01:00
tomFlowee 2489e77a09 Fix copy command to be much more useful.
It can create directories now to copy into.
2024-02-17 21:53:28 +01:00
tomFlowee 24873bbf60 Rework the message and its iterator.
This allows us to add more options and data fields.
2021-08-14 22:40:26 +02:00
tomFlowee e81cf7973f Fixlets and docs
Added plenty of small docs.
Changed the message to be pre-fixed with a message-size in order to allow
us to get interrupted on read() and know
if we need to read more.

Also fixes the bug that the server shuts down after one process as
reported by some.
2021-08-14 17:15:02 +02:00
tomFlowee f3870aec3f Redirect to namespaces
Instead of using a new user to run something secure, we now use
namespaces in order to isolate an application.
2021-05-25 14:24:44 +02:00
tomFlowee bf53034748 Finish Proof of concept.
Starting this tool will now allow one to
- use dbus to request the running of an executable
- the tool creates assigns a userId and creates
  a dir in like /data/1100
- a tiny priviledged part changes ownerhip of that dir
  to the chosen userId.
- it also runs the executable in that dir with this uid.

The effect is that no applications or users (without root)
can read the private files from those apps and they can't
read them from each other.

Running them as different users additionally means all the
standard protections apply and RPC is private between
components of one app.
For instance useful if you have a neochat daemon that listens to the
network while the main app may or may not be running. All using the same
UID naturally.
2021-05-20 19:18:55 +02:00
tomFlowee f04aac9fa4 Cleanup and start a new class. 2021-05-20 12:43:04 +02:00
tomFlowee e5dd3bffe3 Add the DBus interface to listen for run requests. 2021-05-19 15:08:22 +02:00
tomFlowee 4d1e913d01 Make communication work better 2021-05-19 12:08:57 +02:00
tomFlowee b2fd26c471 First iteration that sets up IPC 2021-05-18 23:10:33 +02:00