lucoenergia / conluz

Conluz is an API-driven application designed for the efficient management of an energy community,enabling the administration of community members and their corresponding supply points and the retrieval of consumption, production data.
Apache License 2.0
0 stars 0 forks source link

[conluz-70] Configured SSL. Created keystore. Added www.omie.es certificate in the keystore #71

Closed viktorKhan closed 6 months ago

viktorKhan commented 6 months ago

Solution

Generated keystore

Generated file conluz.p12 using the command:

keytool -genkeypair -alias conluz -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore conluz.p12 -validity 3650

Configured app to run with self signed SSL certificate

Modified file application.properties with the following:

server.port=8443
server.ssl.enabled=true
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:keystore/conluz.p12
server.ssl.key-store-password=changeit
server.ssl.key-alias=conluz

Added www.omie.es certificate in the keystore

Generated the www.omie.es certificate file omie.pem with the command:

echo | openssl s_client -servername www.omie.es -connect www.omie.es:443 2>/dev/null | openssl x509 > omie.pem

Next, import this certificate into your keystore using the keytool:

keytool -import -alias omie -keystore conluz.p12 -file omie.pem

Increase timeout when calling to www.omie.es to 30 seconds

By default, the timeout is 10 seconds, and the call to https://www.omie.es/es/file-download fails.