-
Notifications
You must be signed in to change notification settings - Fork 233
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
feat(crowdsec): Update module (v2.1.1) #687
Conversation
Thank you very much for the update. Here is some notes:
If you have more question don't hesitate. |
@adulau : Thanks for your answer. I'll convert this PR to a draft, if you don't mind, while I make the PR on the misp-objects repo, then make the corresponding changes here. |
@adulau : After discussion with the CrowdSec team, I will keep the "ip-src" as ip-range misp-attributes. But I have then a new question: As the CrowdSec plugin is configured to enrich "ip-src" ( Thus, I will modify the code to bypass such ip range enrichment. I could just failed silently but I wonder if there is a way to warn the user ? To explain the problem a little better, here are a few screenshots. Once an IP has been successfully enriched, we will have a CrowdSec object with a lot of attributes, and especially a "ip-src" IP range attribute. In the UI, an user will see "*" to enrich it: If he clicks on the "*" on the right, he will see: And it will failed with an error: This behavior is OK for me. But the next one is more problematic: On the left menu, we can see "Enrich Event" : And then: Here, if the user click on Enrich, it will end with a blank screen ( and a PHP warning/error depending on the PHP display error config, I assume): I guess MISP is trying here to enrich multiple attributes at the same time, and the error thrown by the ip range one is not handled properly. If we make the modification to not enrich an ip-range during the "handler" method, is there a way, to tell the user that something went wrong ? Or should we just bypass the enrichment silently ? Thanks ! |
@adulau : I figured out that the blank screen I had : was due to the "DEBUG=1" setting in my docker Finally, if I detect that a value to enrich is not a valid IP, I will return an error:
Thanks |
Thanks a lot for the feedback. For the issue when the DEBUG is enabled. I shared it with my colleague for the MISP core part. For the other issue, you were faster than me ;-) Do you want to add some specific tests for crowdsec? is there a way to test the API without an API key? |
API key is mandatory. So, I think it will be impossible to add relevant tests in the We added some basic unit tests in our development repo by mocking the API response, but I guess the Thanks |
@adulau : thanks for the merge. Do you know when this will be rolled out to the MISP ecosystem? I mean: I'm running a MISP instance using the MISP docker repository and the misp-modules container still have an old version of the crowdsec-ip-context definition. Should I wait for something or edit some docker env variable ? Thanks again [EDIT]: I guess I have to wait for a bump from the pymisp library. for the submodule to point to the new commit. |
You can already use it. I did an update of the submodule on 2.4 and develop in MISP. If you update your MISP and update the object via the UI, you'll get the latest misp object template. And it will be available in the next release of PyMISP. |
If you are fine with the module, I think it can be already merged. |
I've updated my misp-core container using your last commit (docker env And I can see in the UI that I have the last template (version 4 with reputation attribute): But when I try to enrich, there is an error and I can see in the
And indeed, when I browse files in the misp-modules container, I can see than the content of the I assume the python code in the misp-modules container comes from some pymisp install (which does not have the last object). All works great if I modify manually this file and update the content with the last version. In any case, I'm going to update the code here to move forward. Thanks |
@adulau : I've updated the code and set this PR in "Ready for review" state. As said above, I was not able to test on my docker environment without editing manually the If you think all is well, let's merge. We can also wait for a pymisp update, I don't know which is the best option. Thanks |
Added
Notes/Questions
We're in the process of improving the crowdsec module so that it has more options and the template reflects the new fields.
We have a questions concerning MISP-Objects
in particular ours: see here
We've noticed that the ip-range property has an associated misp-attribute "ip-src", which is incorrect and can cause problems if we try to query Crowdsec CTI on it. We've fixed it in this PR, but let us know if it breaks anything.
In this PR, we've passed in a custom "crowdsec_template" object during MISP object instantiation, so we can be sure that a change to the MISP object won't break the module.
We imagine that this isn't necessarily good practice, and that you'd prefer us to update the MISP/misp-objects repo.
If we update this repo, is there a risk that someone will change it in the future and break our CrowdSec module without an alert being raised?
Finally, should we make a PR on the https://github.com/MISP/misp-objects repo first, and modify this PR (by removing the "crowdsec_template" custom object) once the repo misp-object PR has been merged?
Thanks