-
Notifications
You must be signed in to change notification settings - Fork 22
/
Dockerfile
69 lines (60 loc) · 2.67 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FROM alfresco/alfresco-base-java:11
MAINTAINER "Angel Borroy" <[email protected]>
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.name="Alfresco Base SSL" \
org.label-schema.vendor="Alfresco"
# Install openssl tool
RUN yum -y update && \
yum -y install openssl openssl-devel && \
yum clean all
# Put keytool in the path
RUN ln -s /usr/lib/jvm/jre/bin/keytool /usr/local/bin
# Copy OpenSSL configuration and generator script
COPY ["ssl-tool/openssl.cnf", "ssl-tool/run.sh", "./"]
# Allow script to be executed and make keytool program available in PATH
RUN chmod +x ./run.sh && \
alternatives --install /usr/bin/keytool keytool /usr/java/default/bin/keytool 20000
# Default values for env variables
ENV ALFRESCO_VERSION=enterprise \
KEY_SIZE=2048 \
KEYSTORE_TYPE=JCEKS \
TRUSTSTORE_TYPE=JCEKS \
KEYSTORE_PASS=keystore \
TRUSTSTORE_PASS=truststore \
ENC_STORE_PASS=encryption \
ENC_METADATA_PASS=metadata \
CA_CERT_DNAME="/C=GB/ST=UK/L=Maidenhead/O=Alfresco Software Ltd./OU=Unknown/CN=Custom Alfresco CA" \
REPO_CERT_DNAME="/C=GB/ST=UK/L=Maidenhead/O=Alfresco Software Ltd./OU=Unknown/CN=Custom Alfresco Repository" \
SOLR_CERT_DNAME="/C=GB/ST=UK/L=Maidenhead/O=Alfresco Software Ltd./OU=Unknown/CN=Custom Alfresco Repository Client" \
BROWSER_CERT_DNAME="/C=GB/ST=UK/L=Maidenhead/O=Alfresco Software Ltd./OU=Unknown/CN=Custom Browser Client" \
CA_SERVER_NAME=localhost \
ALFRESCO_SERVER_NAME=localhost \
SOLR_SERVER_NAME=localhost \
ALFRESCO_FORMAT=current
# Exposing working folders:
# - keystores folder, where generated keystores, truststores and password files are produced
# - ca is the OpenSSL CA folder, where CA internal files are produced
# - certificates folder, that includes private and public keys generated
VOLUME ["/tmp/keystores", "/tmp/ca", "/tmp/certificates"]
# Generating keystores, truststores and password files
CMD ["sh", "-c", "[ \"$(ls -A /tmp/keystores)\" ] && echo \"Keystores folder is populated. Skipping generation...\" || \
./run.sh \
-alfrescoversion $ALFRESCO_VERSION \
-keysize $KEY_SIZE \
-keystoretype $KEYSTORE_TYPE \
-truststoretype $TRUSTSTORE_TYPE \
-keystorepass $KEYSTORE_PASS \
-truststorepass $TRUSTSTORE_PASS \
-encstorepass $ENC_STORE_PASS \
-encmetadatapass $ENC_METADATA_PASS \
-cacertdname \"$CA_CERT_DNAME\" \
-repocertdname \"$REPO_CERT_DNAME\" \
-solrcertdname \"$SOLR_CERT_DNAME\" \
-browsercertdname \"$BROWSER_CERT_DNAME\" \
-caservername \"$CA_SERVER_NAME\" \
-alfrescoservername \"$ALFRESCO_SERVER_NAME\" \
-solrservername \"$SOLR_SERVER_NAME\" \
-alfrescoformat \"$ALFRESCO_FORMAT\" \
&& cp -r /keystores /tmp/ \
&& cp -r /ca /tmp/ \
&& cp -r /certificates /tmp/"]