Commit graph

197 commits

Author SHA1 Message Date
ppom
a8cd1af78d
Set CapabiltyBoundingSet again 2026-02-12 12:00:00 +01:00
ppom
2f57f73ac9
Fix systemd functionality
- Non-absolute WorkingDirectory was refused by systemd
- Plugin specific-conf updated

Improvements:
- ReadOnlyPaths=/
- ProtectHome=true in release builds
- SystemCallFilter further restricted

Disabled:
- DynamicUser: breaks stdio communication, FIXME!
- RestrictAddressFamilies: seems impossible to override to default.
- CapabilityBoundingSet: too restrictive
2026-02-12 12:00:00 +01:00
ppom
3c20d8f008
Fix merging of systemd options 2026-02-12 12:00:00 +01:00
ppom
5a030ffb7e
Make systemd default options more accessible for users by moving them up 2026-02-12 12:00:00 +01:00
ppom
a4ea173c13
Do not permit options key when stream/action is not a plugin 2026-02-12 12:00:00 +01:00
ppom
109fb6d869
Adapt reaction core to plugin interface change 2026-02-09 12:00:00 +01:00
ppom
62933b55e4
Start plugins after start commands
Because stop commands run after plugins' shutdown, so it seems better
that commands embrace ({ plugins }).

Fix outdated comment about aborting on startup.
2026-02-09 12:00:00 +01:00
ppom
41bc3525f8
Fix time-based test sometimes failing by increasing sleep 2026-02-09 12:00:00 +01:00
ppom
7cd4a4305d
fix: merge plugins in configuration 2026-02-09 12:00:00 +01:00
ppom
516e6956ab
fix double-printing of square brackets in plugin logs 2026-02-09 12:00:00 +01:00
ppom
915e308015
Better plugin process management
following stderr: task doesn't use shutdown anymore. It will simply follow
stderr until the end of reaction, which at worst is a negligible
memory leak if reaction continues running.
I tried closing stderr on the plugin side with a raw syscall of the file
descriptor, but reaction side doesn't see that stderr is closed.
So I can't rely on that.
Quitting when shutdown.wait() returns is too early, because that's also
what makes reaction asking for the plugin to close(), and it can print
important logs during its shutdown.
The task ignoring all the shutdown part is dead simple and is most likely
correct everytime.

updated the wording of plugin-related errors.

also replaced futures::select! { future, sleep() } with more concise and
macro-less tokio::timeout.
2026-02-09 12:00:00 +01:00
kol3rby
959c32c01e Fix project not compiling on BSD & Solaris systems 2026-02-09 11:03:00 +01:00
ppom
f414245168
Separate treedb into its own crate 2025-12-14 12:00:00 +01:00
ppom
c595552504
plugin: Remove action oneshot response 2025-12-07 12:00:00 +01:00
ppom
96a551f7b9
Remove debug 2025-12-07 12:00:00 +01:00
ppom
114dcd9945
Remove extra space in plugin relogging 2025-12-07 12:00:00 +01:00
ppom
aac9a71d4e
DB migration for previous commit change 2025-12-07 12:00:00 +01:00
ppom
79d85c1df1
Reduce usage of chrono
TODO: handle migrations
2025-12-07 12:00:00 +01:00
ppom
e22429f92e
Add time to Exec messages, so that plugin actions don't have to calc this 2025-12-07 12:00:00 +01:00
ppom
2216edfba0
shutdown: permit ShutdownController to be cloned
When multiple tasks can ask to quit
2025-12-07 12:00:00 +01:00
ppom
552b311ac4
Move shutdown module to reaction-plugin and use in cluster 2025-12-07 12:00:00 +01:00
ppom
71d26766f8
plugin: Stream plugins now pass time information along their lines
This will permit the cluster to accurately receive older-than-immediate
information, and it will permit potential log plugins (journald?) to go
back in time at startup.
2025-12-07 12:00:00 +01:00
ppom
a70b45ba2d
Move parse_duration to reaction-plugin and fix dependency tree 2025-12-07 12:00:00 +01:00
ppom
9235873084
Expose parse_duration to the plugin
It may be better to put it in the reaction-plugin module instead
2025-12-07 12:00:00 +01:00
ppom
db622eec53
show plugin stream exit error only when not quitting 2025-12-07 12:00:00 +01:00
ppom
cd2d337850
Fixed communication error: do not use serde_json::Value
So maybe serde_json's Value can't be serialized with postbag.
Recreated my own Value that can be converted from and to serde_json's.

removed one useless tokio::spawn.
2025-12-07 12:00:00 +01:00
ppom
ebf906ea51
Better doc and errors 2025-12-07 12:00:00 +01:00
ppom
310d3dbe99
Fix plugin build, one secret key per cluster, more work on cluster init 2025-12-07 12:00:00 +01:00
ppom
58180fe609
fmt, clippy, tests, fix some tests after startup refacto 2025-12-07 12:00:00 +01:00
ppom
20921be07d
Fix daemon startup: all subsystems will cleanly exit
Regardless of which startup error makes reaction exit.

Also made plugin stderr task exit when the ShutdownToken asks for it.
Also updated Rust edition to 2024.
2025-12-07 12:00:00 +01:00
ppom
a7604ca8d5
WIP allow plugin to print error to stderr and capture them
I have a race condition where reaction quits before printing process' stderr.
This will be the occasion to rework (again) reaction's daemon startup
2025-12-07 12:00:00 +01:00
ppom
124a2827d9
Cluster plugin init
- Remove PersistData utility
- Provide plugins a state directory instead, by starting them inside.
- Store the secret key as a file inside this directory.
- Use iroh's crate for base64 encoding, thus removing one dependency.
- Implement plugin's stream_impl and action_impl functions,
  creating all necessary data structures.
2025-12-07 12:00:00 +01:00
ppom
c918910453
plugin: add simple way to store small data for plugins 2025-12-07 12:00:00 +01:00
ppom
8d864b1fb9
Add PersistData to trait 2025-12-07 12:00:00 +01:00
ppom
fa350310fd
plugin protocol: add manifest with version 2025-12-07 12:00:00 +01:00
ppom
0c4d19a4d7
plugins are now named
and fixed the virtual test
2025-12-07 12:00:00 +01:00
ppom
9f56e5d8d2
fmt 2025-12-07 12:00:00 +01:00
ppom
a5c563d55f
WIP systemd support
The logic seems to be fine.
Still need to think what security defaults are pertinent.
2025-12-07 12:00:00 +01:00
ppom
7cbf482e4d
plugin improvements
- fix panic of channel(0)
- cleaner plugin interface with one level of Result
- standalone metadata for stream plugins
- new test for plugin virtual
2025-12-07 12:00:00 +01:00
ppom
f08762c3f3
First shot of "virtual stream" plugin 2025-12-07 12:00:00 +01:00
ppom
160d27f13a
Fix tests 2025-12-07 12:00:00 +01:00
ppom
147a4623b2
First building version of reaction with plugins 2025-12-07 12:00:00 +01:00
ppom
d887acf27e
Adapt Config and plugin loading
daemon::Stream integration TBD
2025-12-07 12:00:00 +01:00
ppom
fc11234f12
Loading plugin not on config side, but stream/action manager side
Trying to implement this on the StreamManager first.
I get lifetime errors that make no sense to me, like futures should
hold any argument with 'static.

I wonder if I should try to convert everything stabby to abi_stable &
async_ffi. I'll try this and see if it solves anything.
2025-12-07 12:00:00 +01:00
ppom
05f30c3c57
First WIP iteration on the plugin system, reaction side.
Delaying the implementation of plugin Filters. I'm not sure it's useful,
(apart from JSON, what can be done?) and it's likely to be more painful
than the rest.
I'll probably just implement one custom JSON Filter like I did with
Pattern's IP support.
2025-12-07 12:00:00 +01:00
Baptiste Careil
c6e4af96cd
Fix some triggers no longer triggering after being loaded from db 2025-09-19 12:00:00 +02:00
ppom
974139610f
async db
Fixing deadlock on start.
FilterManager send a lot of write operations on start.
Each of them spawned a new Task to send the log in a channel.
All those writes were unlocked when the Database started, shortly after.
Now that the channel sending is awaited, it made a deadlock.

Database's API and startup has been rewritten, so that open_tree is made
accross the same channel used to log write operations.

Database is started as soon as it is opened.
The Database struct is now just a Sender to the real Database, now
DatabaseManager.

This removes the constraint for Tree opening happening before any write
operation!
2025-09-19 12:00:00 +02:00
ppom
aec3bb54ed
async db 2025-09-07 12:00:00 +02:00
ppom
582889f71e
WIP async db
Fixes inherent problem on sync db, which spawns a new task for
persistance. This makes the log unordered, which can cause inconsistence
issues.
2025-09-07 12:00:00 +02:00
ppom
ca89c7f72a
Fix filter commands executing before start commands
Now creating the socket file before starting its manager.
So I can launch start commands after its creation, and before creating
the filter managers.
2025-08-08 12:00:00 +02:00