Skip to content
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

[BUG]Documentation #4

Closed
mclancy10006 opened this issue Oct 15, 2021 · 15 comments
Closed

[BUG]Documentation #4

mclancy10006 opened this issue Oct 15, 2021 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@mclancy10006
Copy link

you need to have a Case Template created in TheHive named 'ThePhish' or you get an error. When my only Case Template was named reported-email I kept getting errors and it would not kick off Analysis.

@mclancy10006 mclancy10006 added the bug Something isn't working label Oct 15, 2021
@emalderson
Copy link
Owner

Hello, I know. However, the case_from_email module should automatically create a case template named "ThePhish" if it does not exist yet, as you can see in the following lines of code:

# Create the case on TheHive and add the observables to it
def create_case(subject_field, observables_header, observables_body, attachments, hashes_attachments, eml_file_tuple, wsl):
# Create the case template first if it does not exist
if(len(api_thehive.find_case_templates(query = thehive4py.query.Eq("name", 'ThePhish')).json())) == 0:
task_notification = thehive4py.models.CaseTask(title = 'ThePhish notification')
task_analysis = thehive4py.models.CaseTask(title = 'ThePhish analysis')
task_result = thehive4py.models.CaseTask(title = 'ThePhish result')
case_template = thehive4py.models.CaseTemplate(name = 'ThePhish',
titlePrefix = '[ThePhish] ',
tasks = [task_notification, task_analysis, task_result])
response = api_thehive.create_case_template(case_template)
if response.status_code == 201:
log.info('Template ThePhish created successfully')
wsl.emit_info('Template ThePhish created successfully')
else:
log.error('Cannot create template: {0} ({1})'.format(response.status_code, response.text))
wsl.emit_error('Cannot create template: {0} ({1})'.format(response.status_code, response.text))
return

@mgrant0
Copy link

mgrant0 commented Oct 16, 2021

Any suggestions on how to proceed?

@emalderson
Copy link
Owner

As I said earlier, ThePhish automatically creates a case template named "ThePhish" if it does not exist yet. Check if the problem is on your side, maybe due to your configuration or work environment. Don't forget to specify your work environment following this Issue Template when opening issues related to possible bugs.

@janjaom
Copy link

janjaom commented Oct 22, 2021

About this problem is not having created the template, but I create the template manually with 3 tasks and it works fine!

@emalderson
Copy link
Owner

This is odd, the tool should create the template on its own. What version of TheHive4py do you have installed?

@mgrant0
Copy link

mgrant0 commented Oct 22, 2021

# apt policy thehive4
thehive4:
  Installed: 4.1.11-1
  Candidate: 4.1.11-1
  Version table:
 *** 4.1.11-1 500
        500 https://deb.thehive-project.org release/main amd64 Packages
        100 /var/lib/dpkg/status

@mgrant0
Copy link

mgrant0 commented Oct 22, 2021

One thing we discovered is that the Cortex user needs to have OrgAdmin permissions. Then it'll create the template.

@emalderson
Copy link
Owner

The version on which ThePhish has been tested is TheHive 4.1.9.
Anyway, I was asking for the version of TheHive4py, which is the Python API module used to interact with TheHive.

@mgrant0
Copy link

mgrant0 commented Oct 22, 2021

Seems to be thehive4py-1.8.1

@emalderson
Copy link
Owner

One thing we discovered is that the Cortex user needs to have OrgAdmin permissions. Then it'll create the template.

Maybe you mean the TheHive user, since the template is created on TheHive and it has nothing to do with Cortex. The fact that it must have the OrgAdmin permission is explained here.

@mgrant0
Copy link

mgrant0 commented Oct 22, 2021

sorry, yes

@emalderson
Copy link
Owner

The version is the right one, so it seems it was a problem of RBAC, right? As explained in the documentation, the TheHive user must have the OrgAdmin role.

@mgrant0
Copy link

mgrant0 commented Oct 22, 2021

It does seem to be an RBAC as you say. I see why we didn't read that page. We installed it straight on an instance. We haven't used the docker image yet. But we did create an OrgAdmin, we just did not initially use the OrgAdmin user in ThePhish config, only the real Admin.

I definitely think it's worth mentioning in your instructions to use a user with OrgAdmin.

@emalderson
Copy link
Owner

I will highlight this fact in the documentation for sure in the next commit, thanks for the suggestion!

@emalderson
Copy link
Owner

This problem has been fixed in the documentation, closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants