Skip to content

Commit 593ad5b

Browse files
committed
Merge branch 'RM-3739_dockered_capsule_servers' into 'master'
RM-3739 dockered capsule servers See merge request cdoc2/cdoc2-java-ref-impl!49
2 parents df601cf + df8c9a1 commit 593ad5b

15 files changed

+337
-6
lines changed

test/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,12 @@ Result has to as follows:
4343

4444
All test vectors within testing will be created in the same temporary folder `/target`. Test
4545
results will be deleted after each test case execution automatically.
46+
47+
48+
### Running server scenario tests (experimental)
49+
50+
Create DB Docker image, follow https://github.com/open-eid/cdoc2-capsule-server/server-db/README.md
51+
52+
Login to docker (ghcr.io) - [Authenticating with personal access token](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic)
53+
54+
Run: `run-server-bats-tests.sh`

test/bats/aliases_server.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ then
2121
cd $TESTING_DIR
2222
fi
2323

24+
# alias cdoc-cli='java -Djavax.net.debug=ssl:handshake:verbose:keymanager:trustmanager -Djava.security.debug=access:stack -jar $CDOC2_DIR/cdoc2-cli/target/cdoc2-cli-$CDOC2_CLI_VER.jar'
2425
alias cdoc-cli='java -jar $CDOC2_DIR/cdoc2-cli/target/cdoc2-cli-$CDOC2_CLI_VER.jar'
2526
export CDOC2_CMD="java -jar $CDOC2_DIR/cdoc2-cli/target/cdoc2-cli-$CDOC2_CLI_VER.jar"
2627

test/bats/cdoc2_server_tests.bats

100644100755
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mkdir -p $TEST_RESULTS_DIR
2525
#https://github.com/bats-core/bats-core/issues/259
2626
run_alias() {
2727
shopt -s expand_aliases
28-
source "aliases.sh"
28+
source "aliases_server.sh"
2929
eval "$*"
3030
}
3131

@@ -83,6 +83,10 @@ run_alias() {
8383
assert_output --partial '/config'
8484
}
8585

86+
@test "preparing: Waiting server to start" {
87+
timeout 15s bash -c 'until curl -k --silent --show-error --connect-timeout 1 https://localhost:18443/actuator/health|grep UP; do echo "# Checking ...">&3; sleep 1;done'
88+
}
89+
8690
@test "server-test1: successfully encrypt CDOC2 container with server capsule and send capsule to server, then use GET server to decrypt" {
8791
local cdoc_file="ec_simple_to_server.cdoc"
8892
echo "# Crypt and send capsule to PUT server for file ${cdoc_file}">&3

test/bats/run-server-bats-tests.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
source variables_server.sh
4+
5+
# set up servers (could use --wait --wait-timeout 60s with latest docker compose healthchecks defined)
6+
docker compose -f "$TESTING_DIR/../config/server/docker-compose.yml" up -d
7+
8+
# not needed as already in bats dir?
9+
#cd "$TESTING_DIR"
10+
11+
/usr/bin/env bash test_set_server.sh
12+
13+
docker compose -f "$TESTING_DIR/../config/server/docker-compose.yml" down

test/bats/test_set_server.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ mkdir config
55
cd config/
66
mkdir localhost
77
cd localhost/
8-
cp ../../../../cdoc2-cli/config/localhost/localhost_pkcs12.properties .
9-
cp ../../../../cdoc2-cli/config/localhost/clienttruststore.jks .
8+
cp ../../../config/server/clientconf/localhost_pkcs12.properties .
9+
cp ../../../config/server/clientconf/clienttruststore.jks .
1010
cd ../../
1111
mkdir keys
1212
cd keys/
13-
cp ../../../cdoc2-cli/keys/cdoc2client.p12 .
14-
cp ../../../cdoc2-cli/keys/cdoc2client_pub.key .
15-
cp ../../../cdoc2-cli/keys/cdoc2client_priv.key .
13+
cp ../../config/server/clientconf/cdoc2client.p12 .
14+
cp ../../config/server/clientconf/cdoc2client_pub.key .
15+
cp ../../config/server/clientconf/cdoc2client_priv.key .
1616
cd ..
1717

1818
source variables_server.sh
1.3 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-----BEGIN EC PRIVATE KEY-----
2+
MIGkAgEBBDDaHrkmfvP3MVnpwjmYd2HZVIJNs8XZX8uqaDsx2LGYNudRGvImLZ41
3+
V7QMCd44fhGgBwYFK4EEACKhZANiAAQnVBZQwa2JbFi7Ib3pwZfDH3bALi4Gm9Ju
4+
hso2tb2d3M5TXPtbyoOBmFRQenMQXjgWE7/vOiQgrG+RZz2MRWqX8vq/feWSeJ9H
5+
2/87uPEoNKwrJb67Z8pr/GkJZzN+lQw=
6+
-----END EC PRIVATE KEY-----
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEJ1QWUMGtiWxYuyG96cGXwx92wC4uBpvS
3+
bobKNrW9ndzOU1z7W8qDgZhUUHpzEF44FhO/7zokIKxvkWc9jEVql/L6v33lknif
4+
R9v/O7jxKDSsKyW+u2fKa/xpCWczfpUM
5+
-----END PUBLIC KEY-----
1.65 KB
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# key server listening on localhost, mutual TLS with private key/certificate (P12) read from file
2+
# See cdoc2-capsule-server/README.md how to start the server
3+
4+
# server.id is written to cdoc header. Must have configuration on recipient side
5+
cdoc2.client.server.id=localhost
6+
# capsules can be created over TLS (no client auth required)
7+
cdoc2.client.server.base-url.post=https://localhost:8443
8+
# Quering capsules requires mTLS
9+
cdoc2.client.server.base-url.get=https://localhost:8444
10+
11+
cdoc2.client.server.debug=true
12+
cdoc2.client.server.connect-timeout=1000
13+
cdoc2.client.server.read-timeout=1000
14+
15+
# trusted certificates by client
16+
cdoc2.client.ssl.trust-store.type=JKS
17+
cdoc2.client.ssl.trust-store=config/localhost/clienttruststore.jks
18+
cdoc2.client.ssl.trust-store-password=passwd
19+
20+
21+
# client private key and certificate for mutual TLS (if required by server)
22+
# This key should be trusted by server and added to server trusted key store
23+
cdoc2.client.ssl.client-store.type=PKCS12
24+
cdoc2.client.ssl.client-store=keys/cdoc2client.p12
25+
cdoc2.client.ssl.client-store-password=passwd

0 commit comments

Comments
 (0)