Я создаю свой самозаверяющий ключ SSL и сохраняю его таким образом
Файл «sub.conf»
Код: Выделить всё
[req]
default_bits = 4096
prompt = no
default_md = sha256
x509_extensions = v3_req
distinguished_name = dn
[dn]
C = IN
ST = MAH
L = PUNE
O = JAM
emailAddress = Domino.Admin@jam.com
CN = it+
[v3_req]
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
Код: Выделить всё
"# Non-interactive and 10 years expiration"
> openssl -x509 -newkey rsa:4096 -sha256 -nodes -keyout "\key.pem" -days 3560 -out "crt.pem" -config "sub.conf"
"# > create the keystore"
> openssl pkcs12 -inkey key.pem -in crt.pem -export -out myapp.p12;
"# > create the truststore"
> keytool -importkeystore -srckeystore myapp.p12 -srcstoretype pkcs12 -destkeystore myapp.jks -deststoretype JKS
Код: Выделить всё
# ==============================================================
# = Authentication Server JWT
# ==============================================================
server:
port: 9100
ssl:
enabled: true
trust-store: E:\myapp.p12 # The path to the keystore containing the certificate
trust-store-password:
trust-store-type: PKCS12
bundle: "mybundle"
spring:
application:
name: AUTH-SERVICE
ssl:
bundle:
pem:
mybundle:
keystore:
certificate: "/crt.pem"
private-key: "/key.pem"
truststore:
certificate: "/crt.pem"
Код: Выделить всё
server:
port: 5000
ssl:
enabled: true
key-store: E:\myapp.p12 # The path to the keystore containing the certificate
key-store-password:
key-store-type: PKCS12
trust-store: E:\myapp.jks # The path to the keystore containing the certificate
trust-store-password:
trust-store-type: jks
bundle: "mybundle"
spring:
application:
name: GestUser
ssl:
bundle:
pem:
mybundle:
keystore:
certificate: "/crt.pem"
private-key: "/key.pem"
truststore:
certificate: "/crt.pem"
"o.s.security.web.FilterChainProxy: Защита GET /api/utenti/cerca/userid/anonymous
o.a.tomcat.util.net.jsse.JSSESupport: Ошибка при попытке получить сертификат от клиента
Код: Выделить всё
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
ВТОРОЕ РЕШЕНИЕ (это не полностью работает на стороне сервера)
если мне это нравится
клиент yml
Код: Выделить всё
ssl:
bundle:
jks:
mybundle:
key:
alias: "1"
keystore:
location: "/myapp.p12"
password:
type: "PKCS12"
Код: Выделить всё
ssl:
bundle:
jks:
mybundle:
key:
alias: "1"
keystore:
location: "/myapp.p12"
password:
type: "PKCS12"
truststore:
location: "/myapp.jks"
password:
type: "JKS"
Код: Выделить всё
LifecycleException: Protocol handler start failed
Caused by: java.lang.IllegalArgumentException: the trustAnchor parameter must be non-empty
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
ОТЛАДКА В ПОДСИСТЕМЕ WINDOWS WSL РЕШЕНИЕ № 2
(следуя этому руководству https://medium.com/@gustavocalcaterra/d ... d9cb300f43)
если сделаю
Код: Выделить всё
java -Djavax.net.debug=all -Djavax.net.ssl.trustStore=/mnt/e/myapp.p12 -Djavax.net.ssl.trustStorePassword=
-jar ./target/gestuser-0.0.1-SNAPSHOT.jar https://localhost 2>&1 | grep -i truststore
если я это сделаю
Код: Выделить всё
java -Djavax.net.debug=all -Djavax.net.ssl.trustStore=/mnt/e/myapp.jks -Djavax.net.ssl.trustStorePassword=
-jar ./target/gestuser-0.0.1-SNAPSHOT.jar https://localhost 2>&1 | grep -i truststore
И это очень странно, это должно дать мне jks для одного из двух.. в обоих случаях я получаю
Код: Выделить всё
TrustStoreManager.java:346|Reloaded 1 trust certs
Код: Выделить всё
"trustStore provider is:"
Код: Выделить всё
java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Код: Выделить всё
sudo keytool -import -alias myserver -keystore $JAVA_HOME/lib/jvm/java-21-openjdk-amd64/lib/security/cacerts -file /mnt/e/crt.pem
java -Djavax.net.ssl.trustStore=$JAVA_HOME/lib/jvm/java-21-openjdk-amd64/lib/security/cacert -Djavax.net.ssl.trustStorePassword=changeit -jar ./target/gestuser-0.0.1-SNAPSHOT.jar https://localhost
Подробнее здесь: https://stackoverflow.com/questions/798 ... -not-authe
Мобильная версия