mirror of
https://github.com/j3ssie/osmedeus.git
synced 2026-08-25 09:02:29 +02:00
- Track tmux sessions in ActiveRun and kill them on run cancel via new TmuxHooks indirection; expose killed_tmux_sessions in CLI and API responses - Add ExecuteSSHCommand with remote pidfile + process-group kill watcher so cancelling a run actually terminates remote scans (not just the local session) - Route ssh_exec/ssh_rsync/sync_* through the run's cancellable context via new RunContextHooks - Switch docker-publish to sequential per-arch buildx builds + imagetools manifest to avoid OOM on multi-arch builds; add docker-buildx-setup target - Cross-compile Dockerfile via BUILDPLATFORM/TARGETOS/TARGETARCH and retry SAST binary installs to survive QEMU-flaky downloads - Bump version to v5.0.3
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package executor
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/j3ssie/osmedeus/v5/internal/functions"
|
|
)
|
|
|
|
// init wires the functions package's lifecycle hooks into the run control
|
|
// plane:
|
|
// - tmux: sessions spawned by tmux_run get killed when a run is cancelled.
|
|
// Without this, detached `bosm-<rand8>` sessions survive parent termination
|
|
// and keep scanning long after the user clicked "stop" in the UI.
|
|
// - run context: ssh_exec / ssh_rsync / sync_* can look up the active run's
|
|
// cancellable context and derive their own deadlines from it, so run
|
|
// cancellation propagates to ad-hoc SSH/rsync calls.
|
|
func init() {
|
|
functions.RegisterTmuxHooks(&functions.TmuxHooks{
|
|
OnSessionCreated: func(runUUID, sessionName string) {
|
|
GetRunControlPlane().AddTmuxSession(runUUID, sessionName)
|
|
},
|
|
OnSessionDestroyed: func(runUUID, sessionName string) {
|
|
GetRunControlPlane().RemoveTmuxSession(runUUID, sessionName)
|
|
},
|
|
})
|
|
|
|
functions.RegisterRunContextHooks(&functions.RunContextHooks{
|
|
Lookup: func(runUUID string) context.Context {
|
|
ar := GetRunControlPlane().Get(runUUID)
|
|
if ar == nil {
|
|
return nil
|
|
}
|
|
return ar.Ctx
|
|
},
|
|
})
|
|
}
|