GhostManager / Ghostwriter

The SpecterOps project management and reporting engine
https://ghostwriter.wiki
BSD 3-Clause "New" or "Revised" License
1.23k stars 174 forks source link

Backup not backing up archives, evidence, templates #373

Open domwhewell-sage opened 6 months ago

domwhewell-sage commented 6 months ago

Describe the bug The ghostwriter-cli backup command currently only backs up the postgres database.

To Reproduce To transfer to another server, run these commands: On Server 1

  1. Run ghostwriter-cli backup to backup the postgres database and download the .tar.gz file from /var/lib/docker/volumes/ghostwriter_production_postgres_data_backups/_data/
  2. Take a copy of .env to keep the admin passwords etc.
  3. Take a copy of the ssl/ folder
  4. Take a copy of /var/lib/docker/volumes/ghostwriter_production_data/_data/

On Server 2

  1. Upload the .env file to the root of the Ghostwriter/ directory
  2. Upload the ssl/ folder to the root of the Ghostwriter/ directory
  3. Run ghostwriter-cli install (Unsure if this is necessary as restoring data but did it anyway)
  4. Upload the copy of the ghostwriter_production_data from the old server to /var/lib/docker/volumes/ghostwriter_production_data/_data/ on this server
  5. Upload the backup of the postgres database to /var/lib/docker/volumes/ghostwriter_production_postgres_data_backups/_data/ and run ghostwriter-cli restore to restore the postgres database from the old server

Expected Behavior The ghostwriter-cli backup command should backup more of the required files than the postgres database and potentially place a copy in the current working directory rather than having to extract it from the /var/lib/docker/volumes/ folder

Screenshots N/A

Server Specs: N/A

Additional context N/A

chrismaddalena commented 6 months ago

This is the intended behavior, but we can look into adding functionality to backup volume data. Ghostwriter CLI runs the PostgreSQL backup command to create a SQL backup. It's possible to backup everything else, but the backups are stored in a volume right now. That will probably need to change. Restoring the volume data it will also require more work.

In the meantime, I'll update the help text to mention volume data is not backed up (current help text is: "Creates a backup of the PostgreSQL database").

domwhewell-sage commented 6 months ago

Hi @chrismaddalena, that sounds good. My intention was to setup a weekly backup on our production server using the Ghostwriter CLI backup command, and then move that backup off-site so in a worst case scenario I could rebuild the server.

The .env and ssl/ files and folders should probably be left as optional for the user to manually take copy's as they are sensitive and possibly unique to their individual use case.

github-actions[bot] commented 1 month ago

This issue has been labeled as stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 weeks ago

This issue is closed because it has been inactive for 14 days since being labeled stale. Feel free to re-open the issue with a comment. If this needs further discussion (e.g., a feature request), it might be better to open a topic under the Discussions tab.