Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Odd Openstack Access Behavior #1166

Closed
badllama opened this issue Feb 1, 2019 · 17 comments
Closed

Odd Openstack Access Behavior #1166

badllama opened this issue Feb 1, 2019 · 17 comments

Comments

@badllama
Copy link

badllama commented Feb 1, 2019

Hey folks,

I'm working on getting Security Monkey working with Openstack and I'm trying to tune the permissions with the team that supports our Openstack environment. They would like to use an existing readonly role, rather than create a new one, and it looks like the permissions are equivalent to those specified in the iam_openstack.md doc. This existing readonly role enables visibility to all of the assets via CLI and Horizon. However, Security Monkey is only getting a subset of the security groups. The main question that I have is why there might be a discrepancy between what's visible in CLI/Horizon versus Security Monkey?

Thanks for the help!

@mstair
Copy link
Contributor

mstair commented Feb 1, 2019

Hi @badllama. What version of OpenStack are you running? Are you just seeing subset of security groups from the same tenant? Do you have multiple regions in your setup?

@badllama
Copy link
Author

badllama commented Feb 1, 2019

We're on Pike and it's just one region for the purposes of your question. In a single tenant, if I see 10 security groups in Horizon, SM only sees 4. It's the same account for both access methods, so by definition, it'd be the same role.

@mstair
Copy link
Contributor

mstair commented Feb 1, 2019

I'll look around at what might be problem or where to check for debug. Can you try, in your config.py to set SECURITYGROUP_INSTANCE_DETAIL = NONE, to isolate some issue capturing instance details, then restart the SM services?

@badllama
Copy link
Author

badllama commented Feb 1, 2019

Looks like that made it worse, now it can't 'see' any security groups. Lots of 'Problem connecting...' messages.

@mstair
Copy link
Contributor

mstair commented Feb 1, 2019

Odd, that just limits the code that gets run, nothing additional. I should have mentioned that SECURITYGROUP_INSTANCE_DETAIL = FULL is the default, so make sure you are updating that entry vs adding another (look for SECURITYGROUP_INSTANCE_DETAIL).

@badllama
Copy link
Author

badllama commented Feb 1, 2019

Ok, nope, I did something silly. I flipped that to 'NONE' and now it can pull all of the Security Groups. What is that actually limiting?

@mstair
Copy link
Contributor

mstair commented Feb 4, 2019

It will not try to associate security group assignment to instances, https://github.com/Netflix-Skunkworks/cloudaux/blob/master/cloudaux/orchestration/openstack/security_group.py#L16.

Can you try to set SECURITYGROUP_INSTANCE_DETAIL = SUMMARY?

@badllama
Copy link
Author

badllama commented Feb 4, 2019

SUMMARY results in the same behavior as FULL, which is to say that I have problems connecting again. Is there a specific permission that enables that access? It seems like it may be associated with the nova IAM policy as opposed to the neutron policy, given that it's trying to access information about compute nodes.

@mstair
Copy link
Contributor

mstair commented Feb 4, 2019

Oh good call, yes, its calling the compute service for instance details. See bottom of https://github.com/Netflix/security_monkey/blob/develop/docs/iam_openstack.md for os_compute_api:servers:show policy note.

@badllama
Copy link
Author

badllama commented Feb 4, 2019

Ok, was sort of hoping that there was more than that. We already have that permission applied to the nova policy for our role. Would there be more robust failure messages somewhere in logs that I could go check out?

In the course of troubleshooting, I've successfully run the find_changes process (with instance_detail set to FULL) with a different role assigned to the account we're using. We don't want to use the other role because it's TOO permissive. So the problem appears to be IAM-related, but I can't for the life of me figure out where the permissions discrepancy is. I'm sort of hoping that a more robust error message might point to what permission is missing.

@mstair
Copy link
Contributor

mstair commented Feb 4, 2019

I am assuming you already checked the /var/log/security_monkey logs, there is an exception table in the db, I need to go back and remember how you query it.

I use a more permissive account as we do some inline mitigation for issues, so have not used a more restrictive user outside of writing up the instructions. Perhaps with "os_compute_api:servers:show:host_status"?

@badllama
Copy link
Author

badllama commented Feb 4, 2019

Yeah, the security_monkey log just shows "Skipping (SG RULE INFO) due to a region-level exception "Problem Connecting to openstack_securitygroup/PROJECTNAME/None:\n'NoneType' object is not iterable" Perhaps that's more helpful to you than it is to me?

I can try the host_status perm.

@mstair
Copy link
Contributor

mstair commented Feb 4, 2019

It is helpful, let me run this down. Go ahead and set back to NONE to get you running, with understanding you won't have instance mappings.

@badllama
Copy link
Author

badllama commented Feb 4, 2019

Thanks for all the help @mstair, it's much appreciated.

@mstair
Copy link
Contributor

mstair commented Feb 5, 2019

You mind adding os_compute_api:os-security-groups to your nova policy for your read-only account and trying FULL again? I don't readily have access to a setup where I can modify OS project policies.

https://github.com/openstack/nova/blob/stable/pike/nova/policies/security_groups.py

@badllama
Copy link
Author

badllama commented Feb 5, 2019

That did it, looks like everything is working just fine now. Thanks again!

@mstair
Copy link
Contributor

mstair commented Feb 5, 2019

Great, I'll update docs!

@badllama badllama closed this as completed Feb 5, 2019
mstair added a commit to mstair/security_monkey that referenced this issue Feb 6, 2019
mikegrima added a commit that referenced this issue Feb 6, 2019
#1166, adding security group policy for nova service in iam docs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants