Skip to content

Commit a61d653

Browse files
committed
Removed server.xsl
acl:delegates moved from owner's template to secretary's Updated post_push hook to actually tag images with source commit hash Client keystore mounting refactored -- gets copied from $CLIENT_KEYSTORE_MOUNT
1 parent d78dd9d commit a61d653

7 files changed

+49
-101
lines changed

Dockerfile

+5-9
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ ENV SOURCE_COMMIT=$SOURCE_COMMIT
3434

3535
WORKDIR $CATALINA_HOME
3636

37-
# add XSLT stylesheet that makes changes to server.xml
38-
39-
COPY platform/server.xsl conf/server.xsl
40-
4137
# add XSLT stylesheet that makes changes to ROOT.xml
4238

4339
COPY platform/context.xsl conf/context.xsl
@@ -64,12 +60,16 @@ ENV HTTP_REDIRECT_PORT=443
6460

6561
ENV HTTP_COMPRESSION=on
6662

63+
ENV HTTPS=false
64+
6765
ENV SERVER_CERT=/var/linkeddatahub/ssl/server/server.crt
6866

69-
ENV SECRETARY_CERT="$CATALINA_HOME/webapps/ROOT/ssl/cert.pem"
67+
ENV SECRETARY_CERT=/var/linkeddatahub/ssl/secretary/cert.pem
7068

7169
ENV SECRETARY_CERT_ALIAS=secretary
7270

71+
ENV CLIENT_KEYSTORE_MOUNT=/var/linkeddatahub/ssl/secretary/keystore.p12
72+
7373
ENV CLIENT_KEYSTORE="$CATALINA_HOME/webapps/ROOT/ssl/keystore.p12"
7474

7575
ENV CLIENT_TRUSTSTORE="$CATALINA_HOME/webapps/ROOT/ssl/client.truststore"
@@ -148,8 +148,4 @@ ENV JENA_HOME=/jena
148148

149149
ENV PATH="${PATH}:${JENA_HOME}/bin"
150150

151-
# persist SSL-related files in a volume
152-
153-
VOLUME /var/linkeddatahub/ssl "$CATALINA_HOME/webapps/ROOT/ssl"
154-
155151
ENTRYPOINT ["/bin/sh", "entrypoint.sh"]

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ services:
5252
volumes:
5353
- ./ssl/server:/var/linkeddatahub/ssl/server
5454
- ./ssl/owner:/var/linkeddatahub/ssl/owner
55-
- ./ssl/secretary:/usr/local/tomcat/webapps/ROOT/ssl
55+
- ./ssl/secretary:/var/linkeddatahub/ssl/secretary
5656
- ./uploads:/var/www/linkeddatahub/uploads
5757
- ./config/dev.log4j.properties:/usr/local/tomcat/webapps/ROOT/WEB-INF/classes/log4j.properties:ro
5858
- ./config/system-varnish.trig:/var/linkeddatahub/datasets/system.trig:ro

hooks/post_push

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22

3-
echo "$IMAGE_NAME" "$DOCKER_REPO":"$SOURCE_COMMIT"
3+
docker tag "$IMAGE_NAME" "$DOCKER_REPO":"$SOURCE_COMMIT"
44

5-
docker tag "$IMAGE_NAME" "$DOCKER_REPO":"$SOURCE_COMMIT"
5+
docker push "$DOCKER_REPO":"$SOURCE_COMMIT"

platform/entrypoint.sh

+33-60
Original file line numberDiff line numberDiff line change
@@ -48,38 +48,6 @@ if [ -n "$HTTPS" ] ; then
4848
HTTPS_PARAM="--stringparam https $HTTPS "
4949
fi
5050

51-
if [ -n "$HTTPS_SCHEME" ] ; then
52-
HTTPS_SCHEME_PARAM="--stringparam https.scheme $HTTPS_SCHEME "
53-
fi
54-
55-
if [ -n "$HTTPS_PORT" ] ; then
56-
HTTPS_PORT_PARAM="--stringparam https.port $HTTPS_PORT "
57-
fi
58-
59-
if [ -n "$HTTPS_MAX_THREADS" ] ; then
60-
HTTPS_MAX_THREADS_PARAM="--stringparam https.maxThreads $HTTPS_MAX_THREADS "
61-
fi
62-
63-
if [ -n "$HTTPS_CLIENT_AUTH" ] ; then
64-
HTTPS_CLIENT_AUTH_PARAM="--stringparam https.clientAuth $HTTPS_CLIENT_AUTH "
65-
fi
66-
67-
if [ -n "$HTTPS_PROXY_NAME" ] ; then
68-
HTTPS_PROXY_NAME_PARAM="--stringparam https.proxyName $HTTPS_PROXY_NAME "
69-
fi
70-
71-
if [ -n "$HTTPS_PROXY_PORT" ] ; then
72-
HTTPS_PROXY_PORT_PARAM="--stringparam https.proxyPort $HTTPS_PROXY_PORT "
73-
fi
74-
75-
if [ -n "$HTTPS_COMPRESSION" ] ; then
76-
HTTPS_COMPRESSION_PARAM="--stringparam https.compression $HTTPS_COMPRESSION "
77-
fi
78-
79-
if [ -n "$KEY_ALIAS" ] ; then
80-
KEY_ALIAS_PARAM="--stringparam https.keyAlias '$KEY_ALIAS' "
81-
fi
82-
8351
transform="xsltproc \
8452
--output conf/server.xml \
8553
$HTTP_PARAM \
@@ -91,14 +59,6 @@ transform="xsltproc \
9159
$HTTP_CONNECTION_TIMEOUT_PARAM \
9260
$HTTP_COMPRESSION_PARAM \
9361
$HTTPS_PARAM \
94-
$HTTPS_SCHEME_PARAM \
95-
$HTTPS_PORT_PARAM \
96-
$HTTPS_MAX_THREADS_PARAM \
97-
$HTTPS_CLIENT_AUTH_PARAM \
98-
$HTTPS_PROXY_NAME_PARAM \
99-
$HTTPS_PROXY_PORT_PARAM \
100-
$HTTPS_COMPRESSION_PARAM \
101-
$KEY_ALIAS_PARAM \
10262
conf/letsencrypt-tomcat.xsl \
10363
conf/server.xml"
10464

@@ -148,6 +108,11 @@ if [ -z "$CLIENT_KEYSTORE" ] ; then
148108
exit 1
149109
fi
150110

111+
if [ -z "$CLIENT_KEYSTORE_MOUNT" ] ; then
112+
echo '$CLIENT_KEYSTORE_MOUNT not set'
113+
exit 1
114+
fi
115+
151116
if [ -z "$SECRETARY_CERT_ALIAS" ] ; then
152117
echo '$SECRETARY_CERT_ALIAS not set'
153118
exit 1
@@ -396,7 +361,7 @@ if [ -z "$OWNER_URI" ] ; then
396361
exit 1
397362
fi
398363

399-
printf "\n### Owner's WebID URI: %s\n" "$owner_uri"
364+
printf "\n### Owner's WebID URI: %s\n" "$OWNER_URI"
400365

401366
# strip fragment from the URL, if any
402367

@@ -431,6 +396,12 @@ rm -f root-owner.trig root-owner.nq split.root-owner.nq
431396
echo "<${root_admin_app}> <http://xmlns.com/foaf/0.1/maker> <${OWNER_URI}> ." >> "$based_context_dataset"
432397
echo "<${root_end_user_app}> <http://xmlns.com/foaf/0.1/maker> <${OWNER_URI}> ." >> "$based_context_dataset"
433398

399+
# copy mounted client keystore to a location where the webapp can access it
400+
401+
mkdir -p "$(dirname "$CLIENT_KEYSTORE")"
402+
403+
cp -f "$CLIENT_KEYSTORE_MOUNT" "$(dirname "$CLIENT_KEYSTORE")"
404+
434405
# if CLIENT_TRUSTSTORE does not exist:
435406
# 1. import the certificate into the CLIENT_TRUSTSTORE
436407
# 2. initialize an Agent/PublicKey with secretary's metadata and key modulus
@@ -444,7 +415,7 @@ if [ ! -f "$CLIENT_TRUSTSTORE" ]; then
444415
exit 1
445416
fi
446417

447-
printf "\n### Secretary's WebID URI: %s\n" "$owner_uri"
418+
printf "\n### Secretary's WebID URI: %s\n" "$SECRETARY_URI"
448419

449420
# strip fragment from the URL, if any
450421

@@ -479,29 +450,31 @@ if [ ! -f "$CLIENT_TRUSTSTORE" ]; then
479450
# if server certificate is self-signed, import it into client truststore
480451

481452
if [ "$SELF_SIGNED_CERT" = true ] ; then
482-
printf "\n### Importing server certificate into the client truststore\n\n"
483-
484-
keytool -importcert \
485-
-alias "$KEY_ALIAS" \
486-
-file "$SERVER_CERT" \
487-
-keystore "$CLIENT_TRUSTSTORE" \
488-
-noprompt \
489-
-storepass "$CLIENT_KEYSTORE_PASSWORD" \
490-
-storetype PKCS12 \
491-
-trustcacerts
453+
printf "\n### Importing server certificate into the client truststore\n\n"
454+
455+
mkdir -p "$(dirname "$CLIENT_TRUSTSTORE")"
456+
457+
keytool -importcert \
458+
-alias "$SECRETARY_CERT_ALIAS" \
459+
-file "$SERVER_CERT" \
460+
-keystore "$CLIENT_TRUSTSTORE" \
461+
-noprompt \
462+
-storepass "$CLIENT_KEYSTORE_PASSWORD" \
463+
-storetype PKCS12 \
464+
-trustcacerts
492465
fi
493466

494-
# import default CA certs from the JRE
495-
467+
printf "\n### Importing default CA certificates into the client truststore\n\n"
468+
496469
export CACERTS="${JAVA_HOME}/lib/security/cacerts"
497470

498471
keytool -importkeystore \
499-
-destkeystore "$CLIENT_TRUSTSTORE" \
500-
-deststorepass "$CLIENT_KEYSTORE_PASSWORD" \
501-
-deststoretype PKCS12 \
502-
-noprompt \
503-
-srckeystore "$CACERTS" \
504-
-srcstorepass changeit > /dev/null
472+
-destkeystore "$CLIENT_TRUSTSTORE" \
473+
-deststorepass "$CLIENT_KEYSTORE_PASSWORD" \
474+
-deststoretype PKCS12 \
475+
-noprompt \
476+
-srckeystore "$CACERTS" \
477+
-srcstorepass changeit
505478
fi
506479

507480
if [ -z "$LOAD_DATASETS" ]; then

platform/root-owner.trig.template

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@prefix adm: <ns#> .
22
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
33
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4-
@prefix acl: <http://www.w3.org/ns/auth/acl#> .
54
@prefix cert: <http://www.w3.org/ns/auth/cert#> .
65
@prefix dh: <https://www.w3.org/ns/ldt/document-hierarchy/domain#> .
76
@prefix sioc: <http://rdfs.org/sioc/ns#> .
@@ -21,8 +20,6 @@
2120
foaf:isPrimaryTopicOf <${OWNER_DOC_URI}> ;
2221
cert:key <acl/public-keys/${OWNER_KEY_UUID}/#this> .
2322

24-
<acl/agents/e413f97b-15ee-47ea-ba65-4479aa7f1f9e/#this> acl:delegates <${OWNER_URI}> .
25-
2623
# PUBLIC KEY
2724

2825
<acl/public-keys/${OWNER_KEY_UUID}/> a adm:PublicKeyItem ;

platform/root-secretary.trig.template

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@prefix adm: <ns#> .
22
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
33
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4+
@prefix acl: <http://www.w3.org/ns/auth/acl#> .
45
@prefix cert: <http://www.w3.org/ns/auth/cert#> .
56
@prefix dh: <https://www.w3.org/ns/ldt/document-hierarchy/domain#> .
67
@prefix sioc: <http://rdfs.org/sioc/ns#> .
@@ -35,4 +36,10 @@
3536

3637
# secretary is a member of the writers group
3738

38-
<acl/groups/writers/#this> foaf:member <${SECRETARY_URI}> .
39+
<acl/groups/writers/#this> foaf:member <${SECRETARY_URI}> .
40+
41+
# DELEGATION
42+
43+
# secretary delegates the owner agent
44+
45+
<${SECRETARY_URI}> acl:delegates <${OWNER_URI}> .

platform/server.xsl

-25
This file was deleted.

0 commit comments

Comments
 (0)