From cede0c2decccceff8a35d73a026c1f875e42c0cf Mon Sep 17 00:00:00 2001 From: brasseld Date: Wed, 10 Oct 2018 12:14:33 +0200 Subject: [PATCH] feat(http): Add better SSL support for trust origin and client authentication Closes gravitee-io/issues#1492 --- .../endpointConfiguration.controller.ts | 59 ++++- .../endpoint/endpointConfiguration.html | 205 ++++++++++++++++-- 2 files changed, 233 insertions(+), 31 deletions(-) diff --git a/src/management/api/proxy/backend/endpoint/endpointConfiguration.controller.ts b/src/management/api/proxy/backend/endpoint/endpointConfiguration.controller.ts index 438172ca5b..77dba88496 100644 --- a/src/management/api/proxy/backend/endpoint/endpointConfiguration.controller.ts +++ b/src/management/api/proxy/backend/endpoint/endpointConfiguration.controller.ts @@ -61,6 +61,10 @@ class ApiEndpointController { this.creation = true; } + this.endpoint.ssl = this.endpoint.ssl || {trustAll: false}; + this.endpoint.ssl.trustStore = this.endpoint.ssl.trustStore || {type: ''}; + this.endpoint.ssl.keyStore = this.endpoint.ssl.keyStore || {type: ''}; + // Keep the initial state in case of form reset this.initialEndpoint = _.cloneDeep(this.endpoint); @@ -75,9 +79,52 @@ class ApiEndpointController { name: 'SOCKS5 tcp proxy', value: 'SOCKS5' }]; + + this.$scope.trustStoreTypes = [ + { + name: 'None', + value: '' + }, { + name: 'Java Trust Store (.jks)', + value: 'JKS' + }, { + name: 'PKCS#12 (.p12) / PFX (.pfx)', + value: 'PKCS12' + }, { + name: 'PEM (.pem)', + value: 'PEM' + }]; + + this.$scope.keyStoreTypes = [ + { + name: 'None', + value: '' + }, + { + name: 'Java Trust Store (.jks)', + value: 'JKS' + }, { + name: 'PKCS#12 (.p12) / PFX (.pfx)', + value: 'PKCS12' + }, { + name: 'PEM (.pem)', + value: 'PEM' + }]; } update(api) { + if (this.endpoint.ssl.trustAll) { + delete this.endpoint.ssl.trustStore; + } + + if (this.endpoint.ssl.trustStore && (!this.endpoint.ssl.trustStore.type || this.endpoint.ssl.trustStore.type === '')) { + delete this.endpoint.ssl.trustStore; + } + + if (this.endpoint.ssl.keyStore && (!this.endpoint.ssl.keyStore.type || this.endpoint.ssl.keyStore.type === '')) { + delete this.endpoint.ssl.keyStore; + } + let group: any = _.find(this.api.proxy.groups, { 'name': this.$stateParams.groupName}); if (!_.includes(group.endpoints, this.endpoint)) { @@ -109,18 +156,6 @@ class ApiEndpointController { group.endpoints = _.cloneDeep(this.initialEndpoints); this.$state.go('management.apis.detail.proxy.endpoints'); } - - toggleTrustAll() { - if (this.endpoint.ssl.trustAll === true) { - this.endpoint.ssl.enabled = true; - } - } - - toggleSSL() { - if (!this.endpoint.ssl.enabled) { - this.endpoint.ssl.trustAll = false; - } - } } export default ApiEndpointController; diff --git a/src/management/api/proxy/backend/endpoint/endpointConfiguration.html b/src/management/api/proxy/backend/endpoint/endpointConfiguration.html index cc9b2ad4c5..9f2fd83b20 100644 --- a/src/management/api/proxy/backend/endpoint/endpointConfiguration.html +++ b/src/management/api/proxy/backend/endpoint/endpointConfiguration.html @@ -233,41 +233,208 @@
- SSL Support -
-
-
- - Enable client SSL - -
-
+ SSL / TLS +
- Enable trust all
+ Trust all server certificates
- Use this with caution (if over Internet). The gateway will trust all server certificates. The connection will still be + Use this with caution (if over Internet). The gateway must trust any origin certificates. The connection will still be encrypted but this mode is vulnerable to 'man in the middle' attacks.
+
+ + + + + {{trustStore.name}} + + +
Type of the trust store
+
+
+
+
+ + + +
Path to the JKS file
+
+
+
+ + + +
JKS binary content
+
+
+
+ + + +
Trust store password
+
+
+
+
+
+ + + +
Path to the PKCS#12 file (.p12 or .pfx)
+
+
+
+ + + +
PKCS#12 binary content
+
+
+
+ + + +
Trust store password
+
+
+
+
+
+ + + +
Path to the cert file (.pem)
+
+
+
+ + + +
Certificate
+
+
+
+
+
+ +
+ +
+ + SSL - Client Authentication + +
- - -
Use a client certificate if server requires it.
+ + + + {{keyStore.name}} + + +
Type of the key store
+
+
+ + + +
Path to JKS file
+
+
+
+ + + +
JKS binary content
+
+
+
+ + + +
Key store password
+
+
+
+
+
+ + + +
Path to the PKCS#12 file (.p12 or .pfx)
+
+
+
+ + + +
PKCS#12 binary content
+
+
+
+ + + +
Key store password
+
+
+
+
+
+ + + +
Path to the cert file (.pem)
+
+
+
+ + + +
Certificate
+
+
+
+ + + +
Path to the private key file (.pem)
+
+
+
+ + + +
Private Key
+
+
+