Skip to content

Commit fb0cfe9

Browse files
abh1sardhslove
authored andcommitted
Add settings to mark cryptographic algorithms in vpn customer gateways as excluded or obsolete (apache#12193)
This PR introduces several configuration settings using which an operator can mark certain cryptographic algorithms and parameters as excluded or obsolete for VPN Customer Gateway creation for Site-to-Site VPN. Cloud providers following modern security frameworks (e.g., ISO 27001/27017) are required to enforce and communicate approved cryptographic standards. CloudStack currently accepts several weak or deprecated algorithms without guidance to users. This PR closes that gap by giving operators explicit control over what is disallowed vs discouraged, improving security posture without breaking existing deployments. These settings are: 1. vpn.customer.gateway.excluded.encryption.algorithms 2. vpn.customer.gateway.excluded.hashing.algorithms 3. vpn.customer.gateway.excluded.ike.versions 4. vpn.customer.gateway.excluded.dh.group 5. vpn.customer.gateway.obsolete.encryption.algorithms 6. vpn.customer.gateway.obsolete.hashing.algorithms 7. vpn.customer.gateway.obsolete.ike.versions 8. vpn.customer.gateway.obsolete.dh.group
1 parent 7a7e40e commit fb0cfe9

File tree

20 files changed

+2121
-357
lines changed

20 files changed

+2121
-357
lines changed

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ public class EventTypes {
510510
public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE = "VPN.S2S.CUSTOMER.GATEWAY.CREATE";
511511
public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE = "VPN.S2S.CUSTOMER.GATEWAY.DELETE";
512512
public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE = "VPN.S2S.CUSTOMER.GATEWAY.UPDATE";
513+
public static final String EVENT_S2S_VPN_GATEWAY_OBSOLETE_PARAMS = "VPN.S2S.GATEWAY.OBSOLETE.PARAMS";
513514
public static final String EVENT_S2S_VPN_CONNECTION_CREATE = "VPN.S2S.CONNECTION.CREATE";
514515
public static final String EVENT_S2S_VPN_CONNECTION_DELETE = "VPN.S2S.CONNECTION.DELETE";
515516
public static final String EVENT_S2S_VPN_CONNECTION_RESET = "VPN.S2S.CONNECTION.RESET";
@@ -1170,6 +1171,7 @@ public class EventTypes {
11701171
entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, Site2SiteCustomerGateway.class);
11711172
entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, Site2SiteCustomerGateway.class);
11721173
entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, Site2SiteCustomerGateway.class);
1174+
entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_OBSOLETE_PARAMS, Site2SiteCustomerGateway.class);
11731175
entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, Site2SiteVpnConnection.class);
11741176
entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, Site2SiteVpnConnection.class);
11751177
entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_RESET, Site2SiteVpnConnection.class);

api/src/main/java/org/apache/cloudstack/alert/AlertService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ private AlertType(short type, String name, boolean isDefault) {
7676
public static final AlertType EVENT_USER_SESSION_BLOCK = new AlertType((short)33, "USER.SESSION.BLOCK", true);
7777
public static final AlertType ALERT_TYPE_LOGIN = new AlertType((short)32, "ALERT.LOGIN", true);
7878
public static final AlertType ALERT_TYPE_EXTENSION_PATH_NOT_READY = new AlertType((short)33, "ALERT.TYPE.EXTENSION.PATH.NOT.READY", true);
79+
public static final AlertType ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS = new AlertType((short)34, "ALERT.S2S.VPN.GATEWAY.OBSOLETE.PARAMETERS", true);
7980
public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_BACKUP_STORAGE, "ALERT.STORAGE.BACKUP", true);
8081
public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_OBJECT_STORAGE, "ALERT.STORAGE.OBJECT", true);
8182
public static final AlertType ALERT_TYPE_WALL_RULE = new AlertType((short)90, "ALERT.WALL.RULE", true);

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,9 @@ public class ApiConstants {
14971497
public static final String VHBA_NAME = "vhbaname";
14981498

14991499
public static final String OPERATOR = "operator";
1500+
public static final String VPN_CUSTOMER_GATEWAY_PARAMETERS = "vpncustomergatewayparameters";
1501+
public static final String OBSOLETE_PARAMETERS = "obsoleteparameters";
1502+
public static final String EXCLUDED_PARAMETERS = "excludedparameters";
15001503

15011504
/**
15021505
* This enum specifies IO Drivers, each option controls specific policies on I/O.

api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
import org.apache.cloudstack.api.APICommand;
2222
import org.apache.cloudstack.api.ApiConstants;
2323
import org.apache.cloudstack.api.BaseCmd;
24+
import org.apache.cloudstack.api.Parameter;
2425
import org.apache.cloudstack.api.response.CapabilitiesResponse;
26+
import org.apache.cloudstack.api.response.DomainResponse;
2527
import org.apache.cloudstack.config.ApiServiceConfiguration;
2628

2729
import com.cloud.user.Account;
@@ -30,11 +32,22 @@
3032
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
3133
public class ListCapabilitiesCmd extends BaseCmd {
3234

35+
@Parameter(name = ApiConstants.DOMAIN_ID,
36+
type = CommandType.UUID,
37+
entityType = DomainResponse.class,
38+
description = "the domain for listing capabilities.",
39+
since = "4.23.0")
40+
private Long domainId;
41+
3342
@Override
3443
public long getEntityOwnerId() {
3544
return Account.ACCOUNT_ID_SYSTEM;
3645
}
3746

47+
public Long getDomainId() {
48+
return domainId;
49+
}
50+
3851
@Override
3952
public void execute() {
4053
Map<String, Object> capabilities = _mgr.listCapabilities(this);
@@ -84,6 +97,10 @@ public void execute() {
8497
response.setExtensionsPath((String)capabilities.get(ApiConstants.EXTENSIONS_PATH));
8598
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));
8699
response.setAdditionalConfigEnabled((Boolean) capabilities.get(ApiConstants.ADDITONAL_CONFIG_ENABLED));
100+
if (capabilities.containsKey(ApiConstants.VPN_CUSTOMER_GATEWAY_PARAMETERS)) {
101+
Map<String, Object> vpnCustomerGatewayParameters = (Map<String, Object>) capabilities.get(ApiConstants.VPN_CUSTOMER_GATEWAY_PARAMETERS);
102+
response.setVpnCustomerGatewayParameters(vpnCustomerGatewayParameters);
103+
}
87104
response.setObjectName("capability");
88105
response.setResponseName(getCommandName());
89106
this.setResponseObject(response);

api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.response;
1818

19+
import java.util.Map;
20+
1921
import org.apache.cloudstack.acl.RoleType;
2022
import org.apache.cloudstack.api.ApiConstants;
2123
import org.apache.cloudstack.api.BaseResponse;
@@ -185,6 +187,10 @@ public class CapabilitiesResponse extends BaseResponse {
185187
@Param(description = "true if additional configurations or extraconfig can be passed to Instances", since = "4.20.2")
186188
private Boolean additionalConfigEnabled;
187189

190+
@SerializedName(ApiConstants.VPN_CUSTOMER_GATEWAY_PARAMETERS)
191+
@Param(description = "Excluded and obsolete VPN customer gateway cryptographic parameters")
192+
private Map<String, Object> vpnCustomerGatewayParameters;
193+
188194
public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
189195
this.securityGroupsEnabled = securityGroupsEnabled;
190196
}
@@ -343,4 +349,8 @@ public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {
343349
public void setAdditionalConfigEnabled(Boolean additionalConfigEnabled) {
344350
this.additionalConfigEnabled = additionalConfigEnabled;
345351
}
352+
353+
public void setVpnCustomerGatewayParameters(Map<String, Object> vpnCustomerGatewayParameters) {
354+
this.vpnCustomerGatewayParameters = vpnCustomerGatewayParameters;
355+
}
346356
}

api/src/main/java/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ public class Site2SiteCustomerGatewayResponse extends BaseResponseWithAnnotation
114114
@Param(description = "Which IKE Version to use, one of ike (autoselect), IKEv1, or IKEv2. Defaults to ike")
115115
private String ikeVersion;
116116

117+
@SerializedName(ApiConstants.OBSOLETE_PARAMETERS)
118+
@Param(description = "Contains the list of obsolete/insecure cryptographic parameters that the vpn customer gateway is using.", since = "4.23.0")
119+
private String obsoleteParameters;
120+
121+
@SerializedName(ApiConstants.EXCLUDED_PARAMETERS)
122+
@Param(description = "Contains the list of excluded/not allowed cryptographic parameters that the vpn customer gateway is using.", since = "4.23.0")
123+
private String excludedParameters;
124+
117125
public void setId(String id) {
118126
this.id = id;
119127
}
@@ -202,4 +210,12 @@ public void setDomainPath(String domainPath) {
202210
this.domainPath = domainPath;
203211
}
204212

213+
public void setContainsObsoleteParameters(String obsoleteParameters) {
214+
this.obsoleteParameters = obsoleteParameters;
215+
}
216+
217+
public void setContainsExcludedParameters(String excludedParameters) {
218+
this.excludedParameters = excludedParameters;
219+
}
220+
205221
}

framework/config/src/main/java/org/apache/cloudstack/framework/config/ConfigKeyScheduledExecutionWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public ConfigKeyScheduledExecutionWrapper(ScheduledExecutorService executorServi
6666
this.unit = unit;
6767
}
6868

69-
protected ConfigKeyScheduledExecutionWrapper(ScheduledExecutorService executorService, Runnable command,
69+
public ConfigKeyScheduledExecutionWrapper(ScheduledExecutorService executorService, Runnable command,
7070
ConfigKey<?> configKey, int enableIntervalSeconds, TimeUnit unit) {
7171
validateArgs(executorService, command, configKey);
7272
this.executorService = executorService;

server/src/main/java/com/cloud/alert/AlertManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
112112
, AlertType.ALERT_TYPE_OOBM_AUTH_ERROR
113113
, AlertType.ALERT_TYPE_HA_ACTION
114114
, AlertType.ALERT_TYPE_CA_CERT
115-
, AlertType.ALERT_TYPE_EXTENSION_PATH_NOT_READY);
115+
, AlertType.ALERT_TYPE_EXTENSION_PATH_NOT_READY
116+
, AlertType.ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS);
116117

117118
private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L; // Thirty seconds expressed in milliseconds.
118119

server/src/main/java/com/cloud/api/ApiResponseHelper.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import com.cloud.dc.dao.VlanDetailsDao;
5151
import com.cloud.hypervisor.Hypervisor;
5252
import com.cloud.network.vpc.VpcGateway;
53+
import com.cloud.network.vpn.Site2SiteVpnManager;
5354
import com.cloud.storage.BucketVO;
5455
import org.apache.cloudstack.acl.ControlledEntity;
5556
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
@@ -529,6 +530,8 @@ public class ApiResponseHelper implements ResponseGenerator {
529530
@Inject
530531
RoutedIpv4Manager routedIpv4Manager;
531532
@Inject
533+
Site2SiteVpnManager site2SiteVpnManager;
534+
@Inject
532535
ResourceIconManager resourceIconManager;
533536

534537
public static String getPrettyDomainPath(String path) {
@@ -3893,6 +3896,16 @@ public Site2SiteCustomerGatewayResponse createSite2SiteCustomerGatewayResponse(S
38933896
response.setRemoved(result.getRemoved());
38943897
response.setIkeVersion(result.getIkeVersion());
38953898
response.setSplitConnections(result.getSplitConnections());
3899+
3900+
Set<String> obsoleteParameters = site2SiteVpnManager.getObsoleteVpnGatewayParameters(result);
3901+
if (CollectionUtils.isNotEmpty(obsoleteParameters)) {
3902+
response.setContainsObsoleteParameters(obsoleteParameters.toString());
3903+
}
3904+
Set<String> excludedParameters = site2SiteVpnManager.getExcludedVpnGatewayParameters(result);
3905+
if (CollectionUtils.isNotEmpty(excludedParameters)) {
3906+
response.setContainsExcludedParameters(excludedParameters.toString());
3907+
}
3908+
38963909
response.setObjectName("vpncustomergateway");
38973910
response.setHasAnnotation(annotationDao.hasAnnotations(result.getUuid(), AnnotationService.EntityType.VPN_CUSTOMER_GATEWAY.name(),
38983911
_accountMgr.isRootAdmin(CallContext.current().getCallingAccount().getId())));

server/src/main/java/com/cloud/network/vpn/Site2SiteVpnManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
package com.cloud.network.vpn;
1818

1919
import java.util.List;
20+
import java.util.Set;
2021

22+
import com.cloud.network.Site2SiteCustomerGateway;
2123
import com.cloud.network.dao.Site2SiteVpnConnectionVO;
2224
import com.cloud.vm.DomainRouterVO;
2325

2426
public interface Site2SiteVpnManager extends Site2SiteVpnService {
27+
Set<String> getExcludedVpnGatewayParameters(Site2SiteCustomerGateway customerGw);
28+
29+
Set<String> getObsoleteVpnGatewayParameters(Site2SiteCustomerGateway customerGw);
30+
2531
boolean cleanupVpnConnectionByVpc(long vpcId);
2632

2733
boolean cleanupVpnGatewayByVpc(long vpcId);

0 commit comments

Comments
 (0)