问题
I have trouble with the HTTPS setup in Mule. I have tried both at work and at home with fresh Anypoint Installs. I have checked every StackOverflow posts every tutorial every blogposts but nothing is doing it. I have also tried EE and CE runtimes. I am using the lastest edition of Mule and also tried doing the HTTPS inbound endpoint but with the same result. This is a major part in my project and have just lost a day trying to figure this out and it's driving me crazy...
I am trying to use the self signed certificate at first but ultimately I would like to use an SSL certificate we purchased.
I put the JRE in the anypoint directory and also tried from Program Files JRE.
This is my first time doing SSL stuff so maybe I'm missing something but here goes :
I first go into my Jre bin directory using CMD in Admin mode.
I run this command as described in the HTTPS Transport Reference documentation:
keytool -genkey -alias mule -keyalg RSA -keystore keystore.jks
I enter all the informations correctly and keep both passwords the same to simplify everything. The password is changeit.
I have also tried instead of FirstName LastName to enter the IP of my server I'm running my Anypoint on.
After having the keystore.jks, I copy it in my src/main/resources folder.
Here is my simplified flow in Mule. Normally I would then call a SOAP webservice or a REST webservice but I am trying to keep this the simplest possible :
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tls="http://www.mulesoft.org/schema/mule/tls" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/tls http://www.mulesoft.org/schema/mule/tls/current/mule-tls.xsd">
<http:listener-config name="HTTP_Listener_Configuration" protocol="HTTPS" host="localhost" port="8080" doc:name="HTTP Listener Configuration">
<tls:context>
<tls:key-store path="keystore.jks" password="changeit" keyPassword="changeit"/>
</tls:context>
</http:listener-config>
<flow name="omgHttpsPlzWorkFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<set-payload value="#['Hello']" doc:name="Set Payload"/>
</flow>
</mule>
I then use DHC or Postman (Google Chrome Extensions) or the browser directly to call my listener https://localhost:8080/
I always get 500 or no response. In Chrome I get
Your connection is not private
Attackers might be trying to steal your information from localhost (for example, passwords, messages, or credit cards). NET::ERR_CERT_AUTHORITY_INVALID
I tried adding loggers but nothing is showing up in the console.
I thought the problem could be with the ports or proxies at work but now I try from home with the same results.
I've tried putting port to 443 putting my ip as host. Adding truststores etc..Nothing is doing it. I think I am simply missing something very small and simple.
I hope someone can help me as this is the final step to my project and if it doesn't work I cannot deploy it as it contains sensible information that I want to be secured.
Thank you for your time
回答1:
You are doing everything correctly. Just click on the link https://localhost:8080/ from your browser first so that you add the unsigned certificate to your local machine and everything will work fine. You can use Postman or DHC to access your service afterwards.
in Chrome click on Advanced -> Proceed to localhost (unsafe)) in Firefox click on I understand the risks -> Add Exception...
来源:https://stackoverflow.com/questions/29980763/mule-https-listener-wont-respond