Closed frakman1 closed 2 years ago
Thank you for the update. I just tested it.
I updated the docker-compose.yml
file and re-ran the steps above starting from ./start.py
because I was in a new shell and lost my environment variables. When I did all that, FACT runs but it seems I lost all my previous analysis and it starts with a fresh installation. I thought the fact-data
folder I specified above would get re-used.
Is the docker-compose up-d database
supposed to be a one-time operation?
What is the correct way to restart FACT without losing history?
Normally you shouldn't lose the contents of your database. Since FACT 4.0 switched from MongoDB to PostgreSQL and FACT_docker now uses a database in a separate docker container, you would lose your database contents if you switch the container (e.g. by downloading a newer version of the image). But theoretically the old database container should still be there (since it shouldn't be automatically removed). Do you see other instances of the DB container if you run docker container ls -a
? It should be possible to export the DB contents and import it in the new container.
I thought the fact-data folder I specified above would get re-used.
This folder is used for something different than the DB: The fact-data folder contains the actual files from the firmware and the DB contains analysis, comparison results and metadata (and some more stuff like cached binary search results). In the old version (pre 4.0) there was another folder with the actual DB contents.
Maybe we need to find a way to mount the DB's contents like before if this happens regularly. It should also be possible with PostgreSQL.
No, I don't see any other database containers.
$ docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7d429567122c fkie-cad/fact-core-frontend:4.0.1 "/usr/local/bin/entr…" About an hour ago Up About an hour 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp fact_docker-fact-frontend-1
c107ccae74f2 fkie-cad/fact-core-backend:4.0.1 "/usr/local/bin/entr…" About an hour ago Up About an hour fact_docker-fact-backend-1
52574f66feea postgres "docker-entrypoint.s…" About an hour ago Up About an hour 5432/tcp fact_docker-database-1
52c205a8b010 redis "docker-entrypoint.s…" About an hour ago Up About an hour 6379/tcp fact_docker-redis-1
22227f15e563 fkiecad/radare-web-gui:latest "python3 src/serve.py" 20 hours ago Up 20 hours radare_app_1
34e62c69975b radare_server "/docker-entrypoint.…" 20 hours ago Up 20 hours 80/tcp, 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp radare_server_1
Also, do I need to run all this every time?
docker-compose up -d database
./start.py initialize-db --network fact_docker_fact-network
docker-compose up
I think the initialize-db
is what broke it.
Normally, I just run docker-compose up
and docker-compose down
in other docker projects.
Is that also true for FACT?
"initialize-db" executes the init_postgres.py
script from FACT and this script should not affect your data (I just tested it on my local FACT installation). But it should not be necessary to run this more than once.
The docker-compose up -d database
should run the db container in the background (but it should probably also work to just use docker-compose up
to start all containers at once).
I'm still not sure what may have erased your database, but I think a newly created database container is the most probable cause (if the DB container is replaced, the DB contents are also replaced). I think it would be best to use a common docker volume for the database as described here so that the database contents are not lost if the container is replaced.
I think it would be best to use a common docker volume for the database as described here so that the database contents are not lost if the container is replaced.
I think this would be an excellent addition.
Did you get a chance to test out if the error still occurs when you try to generate a PDF report?
I added a volume in #30 but was unable to try it out yet if it works as expected
I'm running a new full analysis of the firmware now. It takes several hours so I'll report back when it's done.
FYI, it would be nice if there was a 'full' Analysis Preset pull-down option (or just a Select All
, Select None
option) when selecting the plugins to run in the Upload Firmware page. Then I can uncheck the ones I don't want intead of manually checking all but one or two right now.
Yes, the PDF report feature is now working after applying #28 Thank you for your support.
FYI, it would be nice if there was a 'full' Analysis Preset pull-down option
You can add custom presets easily be adding new entries in the main.cfg
file under section [default-plugins]
(the config file in the FACT_docker folder should get mounted into the FACT docker container)
It happened again. (Firmware database lost). I think I know why now after reading your explanation.
docker-compose down
stops and removes containers.
What I should have used is docker-compose start
and stop
FYI, it would be nice if there was a 'full' Analysis Preset pull-down option
You can add custom presets easily be adding new entries in the
main.cfg
file under section[default-plugins]
(the config file in the FACT_docker folder should get mounted into the FACT docker container)
This is excellent news! Thank you. I got it to work:
For reference, I added the following in main.cfg
full = unpacker, file_type, crypto_hints, binwalk, users_and_passwords, printable_strings, malware_scanner, software_components, ip_and_uri_finder, crypto_material, qemu_exec, file_system_metadata, input_vectors, interesting_uris, string_evaluator, source_code_analysis, exploit_mitigations, device_tree, cpu_architecture, elf_analysis, file_hashes, cve_lookup, init_systems, kernel_config, hardware_analysis, cwe_checker, known_vulnerabilities, tlsh, hashlookup, information_leaks
I got the list of plugins from the fact_docker-fact-frontend-1
docker container within the /opt/FACT_core/src/plugins/analysis
directory.
I noticed that after doing a docker-compose stop
(or even down
) that the radare containers stay up.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
22227f15e563 fkiecad/radare-web-gui:latest "python3 src/serve.py" 2 days ago Up 2 days radare_app_1
34e62c69975b radare_server "/docker-entrypoint.…" 2 days ago Up 2 days 80/tcp, 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp radare_server_1
I am guessing that one of the intermediate containers start it but does not shut it down afterwards. Perhaps worth looking into.
I noticed that after doing a docker-compose stop (or even down) that the radare containers stay up.
Created #32 to track this.
Using docker-compose with version 4.0.1 of FACT. Running on Ubuntu 20.04.2 docker version: 20.10.7 docker-compose version: 1.29.2
I analysed some firmware and clicked on the Generate PDF report button that resulted in an error.
Error trace:
Steps to create FACT: