Skip to content

Commit 95efad3

Browse files
Prachi DamleDaanHoogland
authored andcommitted
CLOUDSTACK-6581: IAM - Shared Network -Root Admin user is allowed to deploy VM in a shared network that is scoped for a specific domain/account.
Changes: - Strict access check in NetworkModel is needed as CS 4.3 - We cannot go through accountMgr since accountMgr is relaxed for rootAdmin
1 parent 8985b8b commit 95efad3

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474

7575
<bean id="networkModelImpl" class="com.cloud.network.NetworkModelImpl">
7676
<property name="networkElements" value="#{networkElementsRegistry.registered}" />
77+
<property name="securityCheckers" value="#{securityCheckersRegistry.registered}" />
7778
</bean>
7879

7980
<bean id="configurationServerImpl" class="com.cloud.server.ConfigurationServerImpl" />

‎server/src/com/cloud/network/NetworkModelImpl.java‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
import org.apache.log4j.Logger;
3636

37+
import org.apache.cloudstack.acl.SecurityChecker;
3738
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
3839
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
3940
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
@@ -219,6 +220,16 @@ public void setNetworkElements(List<NetworkElement> networkElements) {
219220
static HashMap<Service, List<Provider>> s_serviceToImplementedProvidersMap = new HashMap<Service, List<Provider>>();
220221
static HashMap<String, String> s_providerToNetworkElementMap = new HashMap<String, String>();
221222

223+
List<SecurityChecker> _securityCheckers;
224+
225+
public List<SecurityChecker> getSecurityCheckers() {
226+
return _securityCheckers;
227+
}
228+
229+
public void setSecurityCheckers(List<SecurityChecker> securityCheckers) {
230+
_securityCheckers = securityCheckers;
231+
}
232+
222233
/**
223234
*
224235
*/
@@ -1586,7 +1597,15 @@ public void checkNetworkPermissions(Account owner, Network network, AccessType a
15861597
+ ", permission denied");
15871598
}
15881599
} else {
1589-
_accountMgr.checkAccess(owner, accessType, network);
1600+
// Go through IAM (SecurityCheckers)
1601+
for (SecurityChecker checker : _securityCheckers) {
1602+
if (checker.checkAccess(owner, accessType, null, network)) {
1603+
if (s_logger.isDebugEnabled()) {
1604+
s_logger.debug("Access to " + network + " granted to " + owner + " by " + checker.getName());
1605+
}
1606+
break;
1607+
}
1608+
}
15901609
}
15911610
}
15921611

0 commit comments

Comments
 (0)