Skip to content

Commit 1605c7c

Browse files
author
Thanos Ploumis
committed
Replace self_signed certs with ssl/proper and delete self_signed
1 parent 537c4fc commit 1605c7c

File tree

108 files changed

+2473
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+2473
-138
lines changed

core/src/main/groovy/noe/server/Httpd.groovy

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ abstract class Httpd extends ServerAbstract {
5050
String cachePath // directory for mod_cache caching
5151
File postInstallErrFile
5252
File postInstallOutFile
53-
File sslCertDir
5453

5554
Httpd(String basedir, version) {
5655
super(basedir, version)
@@ -67,11 +66,10 @@ abstract class Httpd extends ServerAbstract {
6766
this.cachePath = this.basedir + platform.sep + 'cache'
6867
postInstallErrFile = new File(getHttpdServerRootFull(), 'httpdPostInstallErr.log')
6968
postInstallOutFile = new File(getHttpdServerRootFull(), 'httpdPostInstallOut.log')
70-
String sslStringDir = PathHelper.join(platform.tmpDir, "ssl", "self_signed")
71-
this.sslCertDir = new File(sslStringDir)
72-
this.sslCertificate = new File(sslCertDir, "server.crt").absolutePath
73-
this.sslKey = new File(sslCertDir, "server.key").absolutePath
74-
this.keystorePath = new File(sslCertDir, "server.jks").absolutePath
69+
String sslStringDir = PathHelper.join(platform.tmpDir, "ssl", "proper", "generated", "ca", "intermediate")
70+
this.sslCertificate = new File(sslStringDir, "localhost.server.cert.pem").absolutePath
71+
this.sslKey = new File(sslStringDir, "localhost.server.key.pem").absolutePath
72+
this.keystorePath = new File(sslStringDir,"localhost.server.keystore.jks").absolutePath
7573
}
7674

7775
static ServerAbstract getInstance(String basedir, version, String httpdDir = '', NoeContext context = NoeContext.forCurrentContext()) {

core/src/main/groovy/noe/server/ServerAbstract.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ abstract class ServerAbstract implements IApp {
9898
this.serverRoot = basedir
9999
this.host = (host) ?: DefaultProperties.HOST
100100
this.ignoreShutdownPort = true
101-
this.sslCertificate = getDeplSrcPath() + "${platform.sep}ssl${platform.sep}self_signed${platform.sep}server.crt"
102-
this.sslKey = getDeplSrcPath() + "${platform.sep}ssl${platform.sep}self_signed${platform.sep}server.key"
103-
this.keystorePath = getDeplSrcPath() + "${platform.sep}ssl${platform.sep}self_signed${platform.sep}server.jks"
104-
this.truststorePassword = 'changeit'
105-
this.sslKeystorePassword = 'changeit'
101+
this.sslCertificate = getDeplSrcPath() + "${platform.sep}ssl${platform.sep}proper${platform.sep}generated${platform.sep}ca${platform.sep}intermediate${platform.sep}localhost.server.cert.pem"
102+
this.sslKey = getDeplSrcPath() + "${platform.sep}ssl${platform.sep}proper${platform.sep}generated${platform.sep}ca${platform.sep}intermediate${platform.sep}localhost.server.key.pem"
103+
this.keystorePath = getDeplSrcPath() + "${platform.sep}ssl${platform.sep}proper${platform.sep}generated${platform.sep}ca${platform.sep}intermediate${platform.sep}localhost.server.keystore.jks"
104+
this.truststorePassword = 'testpass'
105+
this.sslKeystorePassword = 'testpass'
106106
this.pid = null
107107
setRunAs(loadRunAs())
108108
this.processCode = String.valueOf(Math.abs(this.hashCode()))

core/src/main/groovy/noe/server/Tomcat.groovy

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class Tomcat extends ServerAbstract implements WorkerServer {
4242
def rootBasedir
4343
File postInstallErrFile
4444
File postInstallOutFile
45-
File sslCertDir //Path to directory holding ssl certificates
4645

4746
Tomcat(String basedir, version) {
4847
super(basedir, version)
@@ -62,11 +61,10 @@ class Tomcat extends ServerAbstract implements WorkerServer {
6261
this.cfgHost = (cfgHost) ?: ''
6362
postInstallErrFile = new File(basedir, 'tomcatPostInstallErr.log')
6463
postInstallOutFile = new File(basedir, 'tomcatPostInstallOut.log')
65-
String sslStringDir = PathHelper.join(platform.tmpDir, "ssl", "self_signed")
66-
this.sslCertDir = new File(sslStringDir)
67-
this.sslCertificate = new File(sslCertDir, "server.crt").absolutePath
68-
this.sslKey = new File(sslCertDir, "server.key").absolutePath
69-
this.keystorePath = new File(sslCertDir, "server.jks").absolutePath
64+
String sslStringDir = PathHelper.join(platform.tmpDir, "ssl", "proper", "generated", "ca", "intermediate")
65+
this.sslCertificate = new File(sslStringDir, "localhost.server.cert.pem").absolutePath
66+
this.sslKey = new File(sslStringDir, "localhost.server.key.pem").absolutePath
67+
this.keystorePath = new File(sslStringDir,"localhost.server.keystore.jks").absolutePath
7068

7169
}
7270

core/src/main/groovy/noe/workspace/WorkspaceAbstract.groovy

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,25 +120,22 @@ abstract class WorkspaceAbstract implements IWorkspace {
120120
}
121121

122122
/**
123-
* Copies self-signed, pre-generated certificates from noe core to ${tmpdir}/ssl/self_signed directory.
123+
* Copies intermediate certs, pre-generated certificates from noe core to ${tmpdir}/ssl/proper/generated/ca/intermediate directory.
124124
*
125125
*/
126126
void copyCertificates() {
127-
List<String> certificates = ["server.crt", "server.jks", "server.key", "server.p12"]
128-
String sslStringDir = PathHelper.join(platform.tmpDir, "ssl", "self_signed")
129-
File sslDir = new File(sslStringDir)
130-
String resourcesPath = "ssl/self_signed/" //resources jar path is always separated by /
127+
String sslIntermediateDir = PathHelper.join(platform.tmpDir, "ssl", "proper", "generated", "ca", "intermediate")
128+
File intermediateTmpDir = new File(sslIntermediateDir)
129+
String intermediatePath = "ssl/proper/generated/ca/intermediate/"
131130

132-
if (!sslDir.exists()) {
133-
JBFile.mkdir(sslDir)
131+
if (!intermediateTmpDir.exists()) {
132+
JBFile.mkdir(intermediateTmpDir)
134133
}
135134

136-
JBFile.makeAccessible(sslDir)
135+
JBFile.makeAccessible(intermediateTmpDir)
137136

138-
for (String certName : certificates) {
139-
File certFile = Library.retrieveResourceAsFile("${resourcesPath}${certName}")
140-
JBFile.move(certFile, sslDir)
141-
}
137+
File sslIntermediateFile = Library.retrieveResourceAsFile("${intermediatePath}")
138+
JBFile.move(sslIntermediateFile, intermediateTmpDir)
142139
}
143140

144141
void downloadClusterBench() {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Small docker image specification to generate certificates on system that does include docker but not Java or OpenSSL
2+
# docker build . -t "mydockerimage"
3+
# docker run --rm -v $PWD/ca:/ca:z mydockerimage bash generate-trustchain.sh
4+
5+
FROM alpine
6+
7+
MAINTAINER Honza Kasik (https://github.com/honza-kasik)
8+
9+
RUN apk update && \
10+
apk add --no-cache openssl && \
11+
apk add --no-cache bash && \
12+
apk add --no-cache openjdk8-jre-base && \
13+
rm -rf /var/cache/apk/*
14+
15+
VOLUME /ca
16+
17+
COPY conf /conf
18+
COPY generate-trustchain.sh /generate-trustchain.sh
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
This directory contains script to generate whole trustchain for testing purposes.
2+
Complete description of generated structere may be found in [generate-trustchain.sh](generate-trustchain.sh).
3+
4+
## How to run
5+
6+
For quick, OS-independent generation, run following commands to perform build using docker:
7+
8+
```bash
9+
IMAGE_NAME="my_cool_docker_image"
10+
docker build . -t ${IMAGE_NAME}
11+
docker run --rm -v $PWD/ca:/trustchain/ca:z ${IMAGE_NAME} bash generate-trustchain.sh
12+
13+
```
14+
15+
See [Dockerfile](Dockerfile) for further information on which version of Java (keytool) and OpenSSL is being used.
16+
17+
You can also run the script manually, if you have all dependencies installed (see [Dockerfile](Dockerfile)):
18+
19+
```bash
20+
./generate-trustchain.sh
21+
```
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIGTDCCBDSgAwIBAgIJANQ0pcZU/eCxMA0GCSqGSIb3DQEBCwUAMIGyMQswCQYD
3+
VQQGEwJDWjEXMBUGA1UECAwOQ3plY2ggUmVwdWJsaWMxDTALBgNVBAcMBEJybm8x
4+
HjAcBgNVBAoMFVJlZ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zx/cv6P2JI=
36+
-----END CERTIFICATE-----
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1000
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
V 290315113640Z 1000 unknown /C=CZ/ST=Czech Republic/O=Red Hat Czech, s.r.o./OU=EAP QE/CN=intermediate_mod_cluster_test_certificate/[email protected]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
unique_subject = yes

0 commit comments

Comments
 (0)