Unable to make HTTP REQUEST successfully from jmeter when on VPN - jmeter

I have a test plan created for my API testing in jmeter. The HTTP requests run successfully when i disconnect from my corporate VPN, but when i am connected to VPN, the HTTP request fails - failed: Connection refused: connect - What could be causing Jmeter to work with VPN ?
The same thing happened to my tests on Postman, but the problem got resolved after enabling this option in fiddler (Rules --> Automatically Authenticate). If i close my fiddler or stop capturing, the postman requests would also start to fail (This behavior is seen both on/off vpn). - I am not sure how is Fiddler settings connected to postman.
Have anyone experienced the same ? Please guide me with some solutions to try and make these tools work properly on VPN without any fiddler changes or dependencies.
I am on Jmeter 5.2.1

As you are on corporate VPN, you need to add your corporate certificate to trust store.
Obtain the certificate first.
Add Certificate to Trust Store Command.
keytool -import -alias certificatename -keystore c:\java-se-8u40-ri\jre\lib\security\cacerts -file location to your certificate
This resolved the issue for me and was able to run jmeter on corporate vpn.
You can also refer too : How to import a jks certificate in java trust store
Hope, this helps.

Related

java.net.SocketException: Software caused connection abort: recv failed **ensure browser is set to accept the JMeter proxy certificate**

I am using Jmeter 5.4.1 with Java 1_8_301 and Firefox 91.0. I have imported the ApacheJMeterTemporaryRootCA into Firefox browser and this certificate is generated today and valid.
I have set up proxy settings in my Firefox browser. This testing is done on Windows and my web application uses a client certificate which I converted through keytool into PKCS12 format and added the following to the system.properties under Jmeter-Home\bin
My web app is loading fine without proxy but when I try to record getting the below error.
java.net.SocketException: Software caused connection abort: recv failed **ensure browser is set to accept the JMeter proxy certificate**
I am not sure what I am missing here. I have been through all solutions mentioned in this regard and I am exhausted all my options now. I have been successful in recording using BlazeMeter but my company is not allowing me to use the Chrome extension for security reasons.
Note:
Also, I forgot to add that the Jmeter recording working fine before. Started noticing issues after our java
is upgraded from jdk_1.8.291 to jdk_1.8.301. I checked the difference
between the two and both support TLS1.2 which is what our app uses and tried
to downgrade to v291 didn't work either.
Log:
Problem with SSL certificate for URL for 'XXXXX'? Ensure browser is set to accept the JMeter proxy cert: java.net.SocketException: Software caused connection abort: recv failed
It's quite hard to say what's wrong without seeing your jmeter.log file with debug logging enabled for the HTTP(S) Test Script Recorder.
I can think of 2 options:
Double check the way you're importing the certificate into your browser, i.e. try recording a website with HTTPS without client certificate, i.e. https://example.com. If it fails - you will need to properly install the JMeter's certificate prior to proceeding with your application recording
If it will be successful for other HTTPS website but not for the particular your application most probably you need to import your client certificate into Firefox browser as well
As the last resort you can inspect the requests using Firefox "network" tab and generate relevant HTTP Request samplers manually. There is also BlazeMeter JMX Converter service which can transform HAR files into .JMX scripts but I think the same security restrictions will apply.

Jmeter 4.0 script recording issue

When i'm trying to record application in Jmeter 4.0 using firefox browser not able to capture HTTP requests. I could see below message in
Problem with SSL certificate for url for 'cdnjs.cloudflare.com'? Ensure browser is set to accept the JMeter proxy cert: Software caused connection abort: socket write error
2018-04-20 17:26:36,369 WARN o.a.j.p.h.p.Proxy: [50777] Problem with SSL certificate for url for 'cdnjs.cloudflare.com'? Ensure browser is set to accept the JMeter proxy cert: Software caused connection abort: socket write error
Could you please help us to resolve this issue.
Even I have tried importing jmeter user certificate in browser and recorded the user scenario still complains on keystore generation.Try this if it works
http://sourceforge.net/projects/jmeterforwindows/
The error is self-explanatory: you need to add JMeter's self-signed certificate to your browser.
Locate ApacheJMeterTemporaryRootCA.crt file in "bin" folder of your JMeter installation. It is being automatically generated when you start HTTP(S) Test Script Recorder
Import the certificate into your browser, instructions are different for each browser you can use i.e. Importing your SSL certificate into your browser article as a reference.
That's it, you should now be able to record HTTPS traffic.
See Recording HTTPS Traffic with JMeter's Proxy Server for more detailed configuration and troubleshooting instructions.

SSL certificate - Use Client certificate installed on server for local testing - Mutual authentication

I have been working with web services connecting to URLs provided by different clients and so far it has all been done using one-way authentication. Now I'm asked to enable 2-way (mutual) authentication for one of the clients. I did a lot of research and reading but still confused about a lot of things.
I could test successfully on my local machine following instructions from various different articles. But the problem is now to deploy it in production.
Here's what I did for testing: I created a test Web service Host and assigned it a self-signed certificate and created a client to test this. After this I created a client certificate using makecert and verified that this is installed via MMC. I then modified my Host app to only allow clients with certificate and tested from client to see the connection refused due to not providing the client certificate. Then I modified the bindings in the client application to include the certificate name and I was able to connect to the Host successfully. So this completes local hosting.
Now the real problem. The tech team is going to create a certificate in "cert store" on the server. And I need to test again to make sure everything works as expected. We have a few different developers who all want to test on their machines on their local code. Can we all use the same certificate somehow? I don't think we would be allowed to import the certificate but what suggestions could I give them so all of us can use the same certificate?
I'm also confused about issues like difference between windows certificate and IIS certificate. What advantages would the IIS certificate provide?
Thanks for help!
Edit: Could one of the differences between installing on IIS be so that the hosted sites be accessed via SSL connection? This would mean we don't really need to install on IIS if it's just a client certificate. Is this correct?

Problem with JMeter and HTTP Proxy Server with SSL

We are using JMeter 2.4 and are trying to use the HTTP Proxy Server to capture a test plan.
"Attempt HTTPS spoofing" is not ticked.
The error we get in the JMeter log is:
2010/08/02 14:46:02 ERROR - jmeter.protocol.http.proxy.Proxy: Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert:
Connection closed by remote host
2010/08/02 14:46:02 INFO - jmeter.protocol.http.sampler.HTTPSampler: Error Response Code: 404
2010/08/02 14:46:02 INFO - jmeter.protocol.http.sampler.HTTPSampler: Error Response Code: 404
2010/08/02 14:46:02 ERROR - jmeter.protocol.http.proxy.Proxy: java.net.SocketException: Connection closed by remote host
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkWrite(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at org.apache.jmeter.protocol.http.proxy.Proxy.writeToClient(Proxy.java:443)
at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:264)
Any ideas?
You must remove in your browser the auto-signed certificat in relation with your website, and restart a record session with JMeter 2.4. In this new session, accept the JMeter's dummy cert.
(in Firefox : Options > Advanced > Encryption > View Certificates ==> Certificat Manager > Servers > choose website cert and Delete...)
Milamber
From http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Proxy_Server
When recording HTTPS, the JMeter proxy
server uses a dummy certificate to
enable it to accept the SSL connection
from the browser. This certificate is
not one of the certificates that
browsers normally trust, and will not
be for the correct host, so the
browser should display a dialogue
asking if you want to accept the
certificate or not. For example: 1)
The server's name "www.example.com"
does not match the certificate's name
"JMeter Proxy". Somebody may be trying
to eavesdrop on you. 2) The
certificate for "JMeter Proxy" is
signed by the unknown Certificate
Authority "JMeter Proxy". It is not
possible to verify that this is a
valid certificate. You will need to
accept the certificate in order to
allow the JMeter Proxy to intercept
the SSL traffic in order to record it.
You should only accept the certificate
temporarily.
Also see here http://osdir.com/ml/jmeter-dev.jakarta.apache.org/2009-08/msg00005.html
You may have to create the certificate for Jmeter. Below is a fantastic article detailing how to do it:
http://www.java-samples.com/showtutorial.php?tutorialid=210
Install Jmeter Chrome extension which records HTTPS protocol without any issue.

Google Chrome doesn't trust mitmproxy's certfificates

I'm running mitmdump (from mitmproxy) on my Macbook Pro, and I'm connecting to the proxy through my Windows desktop PC.
However, Chrome (running on the PC) refuses to connect to so many sites because of the invalid certificates which mitmproxy provides.
Chrome throws the error: ERR::NET_CERT_AUTHORITY_INVALID
Here's what mitmdump shows:
But why? What's wrong with mitmproxy's certificates, why can't it just send back google's as if nothing happened?
I'd like to know how I can fix this and make (force) my desktop PC to connect to any website through my Macbook's mitmproxy.
Answering this question for people who may find this important now. To get the proxy working, you have to add the certificate as trusted in your browser.
For windows follow this: https://www.nullalo.com/en/chrome-how-to-install-self-signed-ssl-certificates/2/
For linux follow this: https://dev.to/suntong/using-squid-to-proxy-ssl-sites-nj3
For Mac-os follow this: https://www.andrewconnell.com/blog/updated-creating-and-trusting-self-signed-certs-on-macos-and-chrome/#add-certificate-to-trusted-root-authority
There are some additional details in the above links; tldr; import the certificate in your chrome://settings url and add the certificate as trusted. That shall do.
This will make your browser trust your self-signed certificate(mitm auto generated certificates too.)
The default certificates of mitmproxy is at ~/.mitmproxy/ directory.
Per the Getting Started page of the docs you add the CA by going to http://mitm.it while mitmproxy is running and selecting the operating system that you are using. This should solve your problem and will allow https sites to work with mitmproxy.
This is the expected behavior.
mitmproxy performes a Man-In-The-Middle attack to https connections by providing on-the-fly generated fake certificates to the client while it keeps communicating to the server over fully encrypted connection using the real certificates.
This way the communication between client and proxy can be decrypted. But the client has to actively approve using those fake certificates.
If that wasn't the case then SSL would be broken - which it isn't.
The whole story is very well explained here:
http://docs.mitmproxy.org/en/stable/howmitmproxy.html

Resources