Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Indexer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Indexer
Commits
9d0a6a4a
Commit
9d0a6a4a
authored
5 years ago
by
Maximilien de Bayser
Browse files
Options
Downloads
Patches
Plain Diff
Revert "skip SSL on ES request at indexer-core, NEED TO REMOVE before merge to master"
This reverts commit
5f7eacb9
.
parent
cf330aea
No related branches found
No related tags found
1 merge request
!6
Trusted ibm
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexer-core/src/main/java/org/opengroup/osdu/indexer/util/ElasticClientHandler.java
+5
-41
5 additions, 41 deletions
...org/opengroup/osdu/indexer/util/ElasticClientHandler.java
with
5 additions
and
41 deletions
indexer-core/src/main/java/org/opengroup/osdu/indexer/util/ElasticClientHandler.java
+
5
−
41
View file @
9d0a6a4a
...
...
@@ -14,30 +14,21 @@
package
org.opengroup.osdu.indexer.util
;
import
java.security.SecureRandom
;
import
java.security.cert.X509Certificate
;
import
java.util.Base64
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.X509TrustManager
;
import
org.apache.http.Header
;
import
org.apache.http.HttpHost
;
import
org.apache.http.HttpStatus
;
import
org.apache.http.conn.ssl.SSLSocketFactory
;
import
org.apache.http.impl.nio.client.HttpAsyncClientBuilder
;
import
org.apache.http.message.BasicHeader
;
import
org.elasticsearch.client.RestClient
;
import
org.elasticsearch.client.RestClientBuilder
;
import
org.elasticsearch.client.RestClientBuilder.HttpClientConfigCallback
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.indexer.IElasticSettingService
;
import
org.opengroup.osdu.core.common.model.search.ClusterSettings
;
import
org.opengroup.osdu.core.common.model.indexer.IElasticSettingService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.Base64
;
@Component
public
class
ElasticClientHandler
{
...
...
@@ -94,35 +85,8 @@ public class ElasticClientHandler {
new
BasicHeader
(
"xpack.security.transport.ssl.enabled"
,
tls
),
new
BasicHeader
(
"Authorization"
,
basicAuthenticationHeaderVal
),
};
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"SSL"
);
// set up a TrustManager that trusts everything
sslContext
.
init
(
null
,
new
TrustManager
[]
{
new
X509TrustManager
()
{
public
X509Certificate
[]
getAcceptedIssuers
()
{
System
.
out
.
println
(
"getAcceptedIssuers ============="
);
return
null
;
}
public
void
checkClientTrusted
(
X509Certificate
[]
certs
,
String
authType
)
{
System
.
out
.
println
(
"checkClientTrusted ============="
);
}
public
void
checkServerTrusted
(
X509Certificate
[]
certs
,
String
authType
)
{
System
.
out
.
println
(
"checkServerTrusted ============="
);
}
}
},
new
SecureRandom
());
builder
.
setHttpClientConfigCallback
(
new
HttpClientConfigCallback
()
{
@Override
public
HttpAsyncClientBuilder
customizeHttpClient
(
HttpAsyncClientBuilder
httpClientBuilder
)
{
return
httpClientBuilder
.
setHostnameVerifier
(
SSLSocketFactory
.
ALLOW_ALL_HOSTNAME_VERIFIER
)
.
setSSLContext
(
sslContext
);
}
}).
setDefaultHeaders
(
defaultHeaders
);
//builder.setDefaultHeaders(defaultHeaders);
builder
.
setDefaultHeaders
(
defaultHeaders
);
return
new
RestHighLevelClient
(
builder
);
}
catch
(
AppException
e
)
{
throw
e
;
...
...
@@ -135,4 +99,4 @@ public class ElasticClientHandler {
e
);
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Gokul Nagare
@gokul_nagare
mentioned in commit
d5255c23
·
4 years ago
mentioned in commit
d5255c23
mentioned in commit d5255c238ba67a6989a5a7dbc26c03b56b0b4f9e
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment