Skip to content

Commit 002d976

Browse files
authored
Add settings to mark cryptographic algorithms in vpn customer gateways as excluded or obsolete (#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 b31c2f4 commit 002d976

File tree

20 files changed

+2122
-357
lines changed

20 files changed

+2122
-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
@@ -503,6 +503,7 @@ public class EventTypes {
503503
public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE = "VPN.S2S.CUSTOMER.GATEWAY.CREATE";
504504
public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE = "VPN.S2S.CUSTOMER.GATEWAY.DELETE";
505505
public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE = "VPN.S2S.CUSTOMER.GATEWAY.UPDATE";
506+
public static final String EVENT_S2S_VPN_GATEWAY_OBSOLETE_PARAMS = "VPN.S2S.GATEWAY.OBSOLETE.PARAMS";
506507
public static final String EVENT_S2S_VPN_CONNECTION_CREATE = "VPN.S2S.CONNECTION.CREATE";
507508
public static final String EVENT_S2S_VPN_CONNECTION_DELETE = "VPN.S2S.CONNECTION.DELETE";
508509
public static final String EVENT_S2S_VPN_CONNECTION_RESET = "VPN.S2S.CONNECTION.RESET";
@@ -1151,6 +1152,7 @@ public class EventTypes {
11511152
entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, Site2SiteCustomerGateway.class);
11521153
entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, Site2SiteCustomerGateway.class);
11531154
entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, Site2SiteCustomerGateway.class);
1155+
entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_OBSOLETE_PARAMS, Site2SiteCustomerGateway.class);
11541156
entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, Site2SiteVpnConnection.class);
11551157
entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, Site2SiteVpnConnection.class);
11561158
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
@@ -74,6 +74,7 @@ private AlertType(short type, String name, boolean isDefault) {
7474
public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PUBLIC.IFACE.MTU", true);
7575
public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PRIVATE.IFACE.MTU", true);
7676
public static final AlertType ALERT_TYPE_EXTENSION_PATH_NOT_READY = new AlertType((short)33, "ALERT.TYPE.EXTENSION.PATH.NOT.READY", true);
77+
public static final AlertType ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS = new AlertType((short)34, "ALERT.S2S.VPN.GATEWAY.OBSOLETE.PARAMETERS", true);
7778
public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_BACKUP_STORAGE, "ALERT.STORAGE.BACKUP", true);
7879
public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_OBJECT_STORAGE, "ALERT.STORAGE.OBJECT", true);
7980

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,10 @@ public class ApiConstants {
13641364

13651365
public static final String RECURSIVE_DOMAINS = "recursivedomains";
13661366

1367+
public static final String VPN_CUSTOMER_GATEWAY_PARAMETERS = "vpncustomergatewayparameters";
1368+
public static final String OBSOLETE_PARAMETERS = "obsoleteparameters";
1369+
public static final String EXCLUDED_PARAMETERS = "excludedparameters";
1370+
13671371
/**
13681372
* This enum specifies IO Drivers, each option controls specific policies on I/O.
13691373
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).

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

Lines changed: 16 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,12 +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;
3341

3442
@Override
3543
public long getEntityOwnerId() {
3644
return Account.ACCOUNT_ID_SYSTEM;
3745
}
3846

47+
public Long getDomainId() {
48+
return domainId;
49+
}
50+
3951
@Override
4052
public void execute() {
4153
Map<String, Object> capabilities = _mgr.listCapabilities(this);
@@ -76,6 +88,10 @@ public void execute() {
7688
response.setExtensionsPath((String)capabilities.get(ApiConstants.EXTENSIONS_PATH));
7789
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));
7890
response.setAdditionalConfigEnabled((Boolean) capabilities.get(ApiConstants.ADDITONAL_CONFIG_ENABLED));
91+
if (capabilities.containsKey(ApiConstants.VPN_CUSTOMER_GATEWAY_PARAMETERS)) {
92+
Map<String, Object> vpnCustomerGatewayParameters = (Map<String, Object>) capabilities.get(ApiConstants.VPN_CUSTOMER_GATEWAY_PARAMETERS);
93+
response.setVpnCustomerGatewayParameters(vpnCustomerGatewayParameters);
94+
}
7995
response.setObjectName("capability");
8096
response.setResponseName(getCommandName());
8197
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;
@@ -153,6 +155,10 @@ public class CapabilitiesResponse extends BaseResponse {
153155
@Param(description = "true if additional configurations or extraconfig can be passed to Instances", since = "4.20.2")
154156
private Boolean additionalConfigEnabled;
155157

158+
@SerializedName(ApiConstants.VPN_CUSTOMER_GATEWAY_PARAMETERS)
159+
@Param(description = "Excluded and obsolete VPN customer gateway cryptographic parameters")
160+
private Map<String, Object> vpnCustomerGatewayParameters;
161+
156162
public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
157163
this.securityGroupsEnabled = securityGroupsEnabled;
158164
}
@@ -280,4 +286,8 @@ public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {
280286
public void setAdditionalConfigEnabled(Boolean additionalConfigEnabled) {
281287
this.additionalConfigEnabled = additionalConfigEnabled;
282288
}
289+
290+
public void setVpnCustomerGatewayParameters(Map<String, Object> vpnCustomerGatewayParameters) {
291+
this.vpnCustomerGatewayParameters = vpnCustomerGatewayParameters;
292+
}
283293
}

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;
@@ -528,6 +529,8 @@ public class ApiResponseHelper implements ResponseGenerator {
528529
@Inject
529530
RoutedIpv4Manager routedIpv4Manager;
530531
@Inject
532+
Site2SiteVpnManager site2SiteVpnManager;
533+
@Inject
531534
ResourceIconManager resourceIconManager;
532535

533536
public static String getPrettyDomainPath(String path) {
@@ -3884,6 +3887,16 @@ public Site2SiteCustomerGatewayResponse createSite2SiteCustomerGatewayResponse(S
38843887
response.setRemoved(result.getRemoved());
38853888
response.setIkeVersion(result.getIkeVersion());
38863889
response.setSplitConnections(result.getSplitConnections());
3890+
3891+
Set<String> obsoleteParameters = site2SiteVpnManager.getObsoleteVpnGatewayParameters(result);
3892+
if (CollectionUtils.isNotEmpty(obsoleteParameters)) {
3893+
response.setContainsObsoleteParameters(obsoleteParameters.toString());
3894+
}
3895+
Set<String> excludedParameters = site2SiteVpnManager.getExcludedVpnGatewayParameters(result);
3896+
if (CollectionUtils.isNotEmpty(excludedParameters)) {
3897+
response.setContainsExcludedParameters(excludedParameters.toString());
3898+
}
3899+
38873900
response.setObjectName("vpncustomergateway");
38883901
response.setHasAnnotation(annotationDao.hasAnnotations(result.getUuid(), AnnotationService.EntityType.VPN_CUSTOMER_GATEWAY.name(),
38893902
_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)