-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preloading Modules / Dockerization of FAME / Dockerception (combined PR of all changes, do not merge!) #67
base: master
Are you sure you want to change the base?
Preloading Modules / Dockerization of FAME / Dockerception (combined PR of all changes, do not merge!) #67
Conversation
This allows for install scripts which require root privilegs.
Recent versions of the python:2-slim docker container did not use bash as the default shell and thus broke virtualenv's 'activate' script.
Hi Luca, Great work!
PS: if you want to rebuild the docker based images, don't forget to delete them else the worker script ignores it because they already exist. |
Thanks for your suggestion regarding running docker containers from within docker containers. I have to admit that I already thought of that solution but I did not have time to implement it yet, because there were other things to implement in FAME that had a higher priority for the time being. Though, it's still on our todo list and will be implemented in the near future. |
requirement which was introduced by using remote kvm hosts via ssh
install scripts of virtualization modules were not run (but required for e.g. the kvm module); also, bash scripts are now run before the python requirements installer (was necessary because the kvm module requires libvirt-python which, in turn, depends on libvirt-dev and must be installed prior to the python module)
if the module had more than the required IsolatedProcessingModule class, the agent fails because other classes most probably do not have a 'name' member
when a module is enabled, the worker must install module dependencies
The FAME containers are now configurable with environment variables only. Thus, the requirement for binding the fame/conf directory into the container can be dropped.
Because of the set logic behind the logging mechanism, only one message per minute was logged for recurring messages. This commit relaxes the logic to a list-based implementation which keeps the previously dropped messages.
If triggered_by or acts_on were changed in the interface, all modules following the updated one also had the new values for triggereb_by or acts_on set to the new value.
Pull request for Preloading modules created |
Pull request for LDAP authentication created |
previously this broke the worker because it could not import jinja2
this prevents python form buffering output on stdout/stderr; otherwise at least the worker may delay log messages on stdout significantly
Hi @lucebac , I am trying to figure out all the functionalities you proposed in this PR. From my understanding, here is what's included in the PR:
Am I missing anything? |
Hi @Augustin-FL, you ask a tough question. It's been a while since I've implemented these changes and this branch and the master have severely diverged in the meantime. But I believe you got the most important changes correctly. However, there are a couple things I remember which need to be considered while inspection the changes/diff:
If you really want to use parts of this code it's probably best to just cherry-pick the respective commits (or copy the files over) instead of trying to get this monster of a MR into a state which can be merged. I am happy to answer any question for which I still remember the answer but I cannot promise that I remember everything in the necessary level of detail. |
Yep, I'm aware about that :) In the meantime, several feature have been implemented. I was asking this question to check what are the leftover. Fyi, here is how I see things : Already implemented
More discussion needed
Do you agree with me? (@gaelmuller If you have any opinion on this, I'd be also happy to have it) |
AFAIR, the local worker was only required because of how the analysis target files were shared with the worker. With my changes this is no longer necessary: workers do not rely on the data being present on the filesystem but instead just download them over the REST API (like they did with everything else already - think of the modules zip, the analysis results, etc).
That's up to your liking. I, personally, just prefer to not store unneeded code in a container to have the image as small as possible - that's all there was to my decision.
Mostly, yes. But also worker crashes cause an analysis to stall because the analysis job won't be picked up again. It does not appear often but if it does, it's very convenient to be able to just click a buttont to resume an analysis instead of having to schedule a new one - depending on which modules are involved in the analysis that may even save a significant amount of time (for example sandbox analyses which usually take several minutes to complete).
It's not just error tolerance. I also changed how the modules are being updated. If I'm not mistaken, the web server used to be the component responsible for updating the modules zip. However, this stalls the web interface for as long as the update takes and may even cause the webserver to time out if pulling the git repo takes too long. To avoid that, I introduced a new job for this so that a worker now picks up this task and updates the modules asynchronously (which, coincidentally, also doesn't crash the web interface anymore if there is an exception during the module update). |
EDIT: All changes proposed and committed in this pull request will be re-submitted one by one to make reviewing/changing easier for all of us. Please do not merge! The new PR(s) are:
We needed to dockerize FAME for our internal use. Fortunately, we can share these changes with the FAME community and that's what this PR is meant for.
In addition to just dockerizing FAME there were also changes to the core of FAME that were necessary for the dockerization. These changes allowed us to move certain things around and, from our perspective, improved the general code base by e.g. separating webserver related code from worker code and the like.
Disclaimer
We tried to change the code of FAME in a way such that it can still be run without the need of Docker. Nevertheless, we are not able to properly test upgrading older setups to the new codebase because our setup was already built with the dockerized version of FAME. We appreciate any volunteers who are able to provide some testing with upgrading to the new codebase!
Changes (Summary)
requirements.txt
files for pythonKnown Issues
Currently, there are still some known issues or possible issues that might occur (especially with the new docker-based community modules) which have not been resolved at the point of creating this PR. Nevertheless, we are working towards fixing those and will provide fixes within the next couple of days (or 1-2 weeks, depending on internal workload).
antivirus modules might not work due to the changes to the core code; if they still do, we would like to port these to the workers as well before this PR is merged to be conistent with the improved design principles