Skip to content

Commit

Permalink
- Slår av SSL debugging.
Browse files Browse the repository at this point in the history
- Opprydding.

#deploy-levende-arbeidsforhold-ansettelse
  • Loading branch information
rfc3092 committed Oct 26, 2024
1 parent 541cf63 commit b57f414
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion apps/levende-arbeidsforhold-ansettelse/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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")
Expand All @@ -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();
}
}

}

0 comments on commit b57f414

Please sign in to comment.