summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-03-29 14:47:45 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-03-29 14:47:45 +0200
commit3e7bae91097d9a67262ab0d0b8450d9371201629 (patch)
tree96fb07b4091de115bf224ebfd009261b3729256f /ci
parent6192f9ab54a805c1fabe6a2c5b8eca622b565082 (diff)
Tests: Change OAuth expiry tests by using a custom expiry time
Diffstat (limited to 'ci')
-rw-r--r--ci/docker/docker-compose.yml1
-rw-r--r--ci/docker/eduvpn-server.docker4
-rw-r--r--ci/docker/replaceexpiry.sh7
-rw-r--r--ci/docker/starteduvpn.sh3
4 files changed, 14 insertions, 1 deletions
diff --git a/ci/docker/docker-compose.yml b/ci/docker/docker-compose.yml
index 9832871..60bd21d 100644
--- a/ci/docker/docker-compose.yml
+++ b/ci/docker/docker-compose.yml
@@ -5,6 +5,7 @@ version: '3'
x-common-env: &common-env
PORTAL_USER: ${PORTAL_USER}
PORTAL_PASS: ${PORTAL_PASS}
+ OAUTH_EXPIRED_TTL: ${OAUTH_EXPIRED_TTL}
# Define a network so that the containers can talk with eachother using their service name
networks:
diff --git a/ci/docker/eduvpn-server.docker b/ci/docker/eduvpn-server.docker
index 52d49d1..ed33691 100644
--- a/ci/docker/eduvpn-server.docker
+++ b/ci/docker/eduvpn-server.docker
@@ -64,11 +64,13 @@ RUN openssl req \
-out "/etc/pki/tls/certs/${WEB_FQDN}.crt" \
-days 90
-# Add the start script
+# Add the start script and expiry script
WORKDIR /eduvpn/server
ADD ci/docker/starteduvpn.sh /eduvpn/server
+ADD ci/docker/replaceexpiry.sh /eduvpn/server
RUN chmod +x ./starteduvpn.sh
+RUN chmod +x ./replaceexpiry.sh
# While we could mimic the systemd units ourselves, let's use a systemctl replacement script
# This makes it easier to update
diff --git a/ci/docker/replaceexpiry.sh b/ci/docker/replaceexpiry.sh
new file mode 100644
index 0000000..b029863
--- /dev/null
+++ b/ci/docker/replaceexpiry.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+# If no custom expiry set, do nothing
+[ -z "${OAUTH_EXPIRED_TTL}" ] && exit
+
+# Replace oauth expiry
+sed -i "s/return \[/return \[\n'Api' => [\n'tokenExpiry' => 'PT${OAUTH_EXPIRED_TTL}S',\n],/g" "$1"
diff --git a/ci/docker/starteduvpn.sh b/ci/docker/starteduvpn.sh
index 580150b..36c881d 100644
--- a/ci/docker/starteduvpn.sh
+++ b/ci/docker/starteduvpn.sh
@@ -12,6 +12,9 @@ if [[ -z "${PORTAL_PASS}" ]]; then
exit 1
fi
+# Replace expiry
+./replaceexpiry.sh /etc/vpn-user-portal/config.php
+
# Start the preliminary systemd units
systemctl start php-fpm
systemctl start httpd