mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 11:52:37 +09:00
Feature #3175: Ask for SECGROUP USE auth in VM creation.
This only checks the sec groups requested directly in each NIC/SECURITY_GROUPS. The sec groups added from the vnet (and AR) are not checked for auth.
This commit is contained in:
1 parent
79c0a8071f
commit
e5261f610a
1 file changed
+21
@@ -3360,11 +3360,15 @@ void VirtualMachine::set_auth_request(int uid,
|
||||
int num;
|
||||
vector<Attribute * > vectors;
|
||||
VectorAttribute * vector;
|
||||
set<int>::iterator it;
|
||||
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
ImagePool * ipool = nd.get_ipool();
|
||||
VirtualNetworkPool * vnpool = nd.get_vnpool();
|
||||
SecurityGroupPool * sgpool = nd.get_secgrouppool();
|
||||
|
||||
SecurityGroup * sgroup;
|
||||
|
||||
num = tmpl->get("DISK",vectors);
|
||||
|
||||
@@ -3395,6 +3399,23 @@ void VirtualMachine::set_auth_request(int uid,
|
||||
}
|
||||
|
||||
vnpool->authorize_nic(vector,uid,&ar);
|
||||
|
||||
set<int> sgroups = nic_security_groups(vector);
|
||||
|
||||
for(it = sgroups.begin(); it != sgroups.end(); it++)
|
||||
{
|
||||
sgroup = sgpool->get(*it, true);
|
||||
|
||||
if(sgroup != 0)
|
||||
{
|
||||
PoolObjectAuth perm;
|
||||
sgroup->get_permissions(perm);
|
||||
|
||||
sgroup->unlock();
|
||||
|
||||
ar.add_auth(AuthRequest::USE, perm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user