drakvuf-sandbox
drakvuf-sandbox copied to clipboard
Warn when Redis is misconfigured
Failing to install / forgetting setup Redis properly will result in crashes
- web UI shouldn't crash with a 500 ISE
It's possible for use the UI in a read-only way when Redis is down. The only thing that won't work is new sample submission. User should be somehow notified that Redis is misconfigured and that uploading failed.
- draksetup should warn about missing Redis
Installation works offline and it doesn't need Redis but adding a sanity check and notification that Redis should be configured would be a nice addition.
can you tell me the port number which redis is using or point me to the implementation file? I have made a function to check redis state rn and can continue from that
In both cases we're using https://karton-core.readthedocs.io/en/latest/karton_api.html#karton.core.config.Config
for drakrun: https://github.com/CERT-Polska/drakvuf-sandbox/blob/master/drakrun/drakrun/main.py#L611-L613
for drakcore: https://github.com/CERT-Polska/drakvuf-sandbox/blob/master/drakcore/drakcore/util.py#L21-L45
I think in terms of implementation, you should try to connect to the Redis specified in config.ini
and issue some simple command (for example PING
).
~I was trying to work on this but it seems karton
will protest if Redis
isn't available. SystemService
of karton is being used in a lot of places which apparantely is used to instantiate minio
backend also in some places~
https://github.com/CERT-Polska/drakvuf-sandbox/blob/9d3c096aaf6d3cb84676cb3d26fd9a3fdad6e0dc/drakcore/drakcore/app.py#L25-L26
~which is further used in many other api's. So, it seems that minio
will also be rendered useless if redis
fails, and if that happens the UI won't have anything to play around with in readOnly state ig.~
Also, drak-system
won't be able to run at all as it depends totally on the object returned by SystemService
in the end service.loop()
https://github.com/CERT-Polska/drakvuf-sandbox/blob/9d3c096aaf6d3cb84676cb3d26fd9a3fdad6e0dc/drakcore/drakcore/system.py#L24-L40
EDIT: the first problem is resolved by using get_minio_helper
which doesn't depend on karton