diff --git a/apps/levende-arbeidsforhold-ansettelse/99-dolly-convert-to-pk8.sh b/apps/levende-arbeidsforhold-ansettelse/99-dolly-convert-to-pk8.sh index 3a3dc2e0c04..ad29d921fd7 100644 --- a/apps/levende-arbeidsforhold-ansettelse/99-dolly-convert-to-pk8.sh +++ b/apps/levende-arbeidsforhold-ansettelse/99-dolly-convert-to-pk8.sh @@ -1,3 +1,6 @@ #!/usr/bin/env sh +# +# Converts NAIS provided key.pem to PKCS#8 format, which can be used by R2dbc. +# openssl pkey -in /var/run/secrets/nais.io/sqlcertificate/key.pem -out /tmp/key.pk8 \ No newline at end of file diff --git a/apps/levende-arbeidsforhold-ansettelse/Dockerfile b/apps/levende-arbeidsforhold-ansettelse/Dockerfile index 947f2bde6bc..da2ab16eeb7 100644 --- a/apps/levende-arbeidsforhold-ansettelse/Dockerfile +++ b/apps/levende-arbeidsforhold-ansettelse/Dockerfile @@ -1,7 +1,7 @@ FROM ghcr.io/navikt/baseimages/temurin:21 LABEL maintainer="Team Dolly" -ENV JAVA_OPTS="-Dspring.profiles.active=prod -Djavax.net.debug=ssl" +ENV JAVA_OPTS="-Dspring.profiles.active=prod" COPY 99-dolly-convert-to-pk8.sh /init-scripts/ COPY /build/libs/app.jar /app/ diff --git a/apps/levende-arbeidsforhold-ansettelse/src/test/java/no/nav/testnav/levendearbeidsforholdansettelse/LevendeArbeidsforholdAnsettelseApplicationTests.java b/apps/levende-arbeidsforhold-ansettelse/src/test/java/no/nav/testnav/levendearbeidsforholdansettelse/LevendeArbeidsforholdAnsettelseApplicationTests.java index b337f53ad06..f0251a8e160 100644 --- a/apps/levende-arbeidsforhold-ansettelse/src/test/java/no/nav/testnav/levendearbeidsforholdansettelse/LevendeArbeidsforholdAnsettelseApplicationTests.java +++ b/apps/levende-arbeidsforhold-ansettelse/src/test/java/no/nav/testnav/levendearbeidsforholdansettelse/LevendeArbeidsforholdAnsettelseApplicationTests.java @@ -1,5 +1,7 @@ package no.nav.testnav.levendearbeidsforholdansettelse; +import io.netty.handler.ssl.SslContextBuilder; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -8,7 +10,11 @@ import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; import org.springframework.test.context.ActiveProfiles; +import java.io.File; +import java.io.FileInputStream; + import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import static org.junit.jupiter.api.Assertions.fail; @SpringBootTest @ActiveProfiles("test") @@ -22,10 +28,28 @@ class LevendeArbeidsforholdAnsettelseApplicationTests { private R2dbcEntityTemplate template; @Test - @SuppressWarnings("java:S2699") void load_app_context() { assertThat(template) .isNotNull(); } + @Disabled("Useful for checking the format of a SSL key file manually.") + @Test + @SuppressWarnings("java:S2699") + void attemptToLoadSslKeyFile() + throws Exception { + var sslKey = "key.pk8"; + System.err.println("SSL Key File: " + sslKey); + var file = new File(sslKey); + System.out.println("File " + file.getAbsolutePath() + (file.exists() ? " exists" : " not found")); + if (!file.exists()) { + fail(); + } else { + SslContextBuilder + .forClient() + .keyManager(null, new FileInputStream(file), null) + .build(); + } + } + }