Add generate server cert and add ssl for application
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Sambo Chea 2022-04-20 17:24:51 +07:00
parent f6c0a31fc1
commit 83bc97bb02
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490
5 changed files with 28 additions and 2 deletions

View File

@ -1,2 +0,0 @@
server:
port: ${APP_PORT:8080}

View File

@ -1,3 +1,13 @@
server:
port: ${SERVER_PORT:8080}
ssl:
key-store: ${SERVER_SSL_KEY_STORE:classpath:keystore/server.jks}
key-store-password: ${SERVER_SSL_KEY_STORE_PASSWORD:cubetiq}
key-password: ${SERVER_SSL_KEY_PASSWORD:cubetiq}
enabled: ${SERVER_SSL_ENABLED:true}
compression:
enabled: ${SERVER_COMPRESSION_ENABLED:${server.ssl.enabled}}
spring: spring:
profiles: profiles:
active: ${APP_PROFILE:demo} active: ${APP_PROFILE:demo}

Binary file not shown.

Binary file not shown.

18
generate-server-cert.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh -e
CERT_NAME="${1:-server}"
CERT_SIZE="${2:-2048}"
CERT_DAYS="${3:-3650}"
DEST_DIR="${4:-./}"
echo "Create directory ${DEST_DIR}"
mkdir -p "${DEST_DIR}"
echo "Generating server keystore ${CERT_NAME}.p12 with size: ${CERT_SIZE} days: ${CERT_DAYS}"
keytool -genkeypair -alias ${CERT_NAME} -keyalg RSA -keysize ${CERT_SIZE} -storetype PKCS12 -keystore ${DEST_DIR}${CERT_NAME}.p12 -validity ${CERT_DAYS}
echo "Generating server keystore ${CERT_NAME}.jks with size: ${CERT_SIZE} days: ${CERT_DAYS}"
keytool -genkeypair -alias ${CERT_NAME} -keyalg RSA -keysize ${CERT_SIZE} -keystore ${DEST_DIR}${CERT_NAME}.jks -validity ${CERT_DAYS}
echo "Import keystore ${CERT_NAME}.jks into ${CERT_NAME}.p12"
keytool -importkeystore -srckeystore ${DEST_DIR}${CERT_NAME}.jks -destkeystore ${DEST_DIR}${CERT_NAME}.p12 -deststoretype pkcs12