Skip to content

Caldera not saving operations while run on background or as service after restart #3018

@Karelabiss

Description

@Karelabiss

Describe the bug
We have found that Caldera could not save or remove operations after restart. But when caldera is run from terminal and stopped with ctrl+c operations are saved as they were created or removed.

In our case all other data were saved normally (facts, adversaries, ...). Only operation were having this problem.

To Reproduce
Steps to reproduce the behavior:

  1. Start Caldera as service or at background using
    python3.11 server.py & or as a service systemctl start caldera.service (nohup and & disown do not work too)
  2. Create operation and run it (or delete existing one)
  3. Restart Caldera (systemctl restart or systemctl stop -> start)
  4. After logon no changes were made in operations or files (only .json log file was created in event_logs directory)

Expected behavior
After restarting Caldera should show previously ran operations or not show previously removed operations.

Screenshots

  1. Freshly started Caldera with no operations as service (systemctl)
    image
    Freshly started caldera with no operations

  2. Created a operation
    image
    Created a operation

  3. Restarted Caldera as service (systemctl restart)
    image
    After restart no operation shown

  4. Event logs directory have saved all logs from operations
    image
    Log files in event_logs directory shown

Desktop:

  • Rocky Linux 8.9 Green Obsidian (minimal)
  • Ubuntu 20.04 Build "5.15.0-116-generic"
  • Kali linux WSL Build "5.15.153.1-microsoft-standard-WSL2"

Browsers:

  • Brave (v1.67.134)
  • MS Edge (v126.0.2592.102)
  • Mozilla Firefox (v128.0)

All dependencies on docs were installed on every machine (in python3.11 venv virtual enviroment).

Systemd .service script

[Unit]
Description=Caldera Service
After=network.target

[Service]
Type=simple
User=caldera
KillSignal=SIGINT #workaround (works with this parameter)
WorkingDirectory=/path-to-caldera/caldera
ExecStart=/path-to-caldera/caldera/venv/bin/python3.11 /path-to-caldera/caldera/server.py

[Install]
WantedBy=multi-user.target

Additional context
Found workaround for this with systemd .service file parameter KillSignal=SIGINT. Propably Caldera can't handle well sigterm or sigkill signal from systemctl command (systemctl stop) and works only for sigint signal from ctrl+c.

I found this same problem on docker as well but did not test it much so it is not included here.

Metadata

Metadata

Labels

bugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions