steeltomato / jmeter-amf

AMF Plugin for JMeter
http://code.kennethjhill.com/jmeter-amf
Apache License 2.0
37 stars 37 forks source link

SSL Error when recording with AMF Proxy Server #14

Open sirwinks opened 13 years ago

sirwinks commented 13 years ago

Issue: When I start recording with the AMF Proxy Server, I receive "connection reset by peer" error when trying to login to my application.

Steps to reproduce:

  1. Install JMeter 2.5.1r1177103. Copy JMeter-AMF and BlazeDS jars to /lib/ext
  2. Created a new test plan in JMeter and configure it as descibed in the user guide
  3. Update the proxy settings in the browser to match the AMF Proxy server
  4. In the AMF Proxy Server, hit start
  5. Browse to my application under test

Expected result: I should be able to login to my app and requests should be captured by the AMF Proxy server

Actual result: I receive a connection error and am unable to login to my app.

Additional Info: This connection error only occurs when recording with the AMF proxy server. If I use the HTTP Proxy server, I can login to my app just fine and capture all of the requests with no issues (without deserialization of the AMF binary). This issue occurs in both IE and Firefox(using foxyproxy). After starting the AMF Proxy server and updating the browser proxy settings, I notice that I receive SSL certificate warnings when I navigate to my application. I only see these certificate warnings when I am recording with the AMF Proxy server. I imported the cert into IE's Trusted Root but the issue still occured.

JMeter Log file Snippet when using Firefox: jmeter.util.SSLManager: Keystore file not found, loading empty keystore 2011/10/19 15:01:34 INFO - jmeter.protocol.http.sampler.HTTPJavaImpl: Error Response Code: 404 2011/10/19 15:01:34 INFO - jmeter.protocol.amf.proxy.FormCharSetFinder: Using htmlparser version: 2.0 (Release Build Sep 17, 2006)

JMeter Log file Snippet when using IE: 2011/10/19 14:37:02 ERROR - jmeter.protocol.amf.proxy.AmfProxy: Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert: Connection reset by peer: socket write error 2011/10/19 14:37:04 ERROR - jmeter.JMeter: Uncaught exception: java.lang.NoSuchFieldError: createASObjectForMissingType at org.apache.jmeter.protocol.amf.util.AmfXmlConverter.convertAmfMessageToXml(AmfXmlConverter.java:151) at org.apache.jmeter.protocol.amf.proxy.AmfRequestHdr.populateSampler(AmfRequestHdr.java:463) at org.apache.jmeter.protocol.amf.proxy.AmfRequestHdr.getSampler(AmfRequestHdr.java:281) at org.apache.jmeter.protocol.amf.proxy.AmfProxy.run(AmfProxy.java:229)

steeltomato commented 13 years ago

I am suspicious about the NoSuchFieldError in the log. What version of BlazeDS are you using? Are you able to test if the AMF proxy works with your application when not in SSL mode?

sirwinks commented 13 years ago

BlazeDS version = 4 I cannot access the AMF components of the app without being in SSL mode.

steeltomato commented 13 years ago

Both error blocks suggest you might not have a good cert for the proxy. Please check to make sure that you have a proxyserver.jks file in jmeter/bin. If not, you need to grab it from a binary distribution of JMeter. When present, I would expect to see two log lines when the first sample runs:

2011/10/24 20:58:15 INFO - jmeter.protocol.amf.proxy.AmfProxy: Opened Keystore file: .../jmeter-amf/bin/proxyserver.jks 2011/10/24 20:58:15 INFO - jmeter.protocol.amf.proxy.AmfProxy: KeyStore for SSL loaded OK and put host in map (the host you are sampling)

sirwinks commented 13 years ago

The proxyserver.jks file is present in my /bin directory. Below is the snippet of the log file that shows the keystore file getting loaded, and also the error that occurs once I try to browse to my site when recording with the AMF Proxy Server enabled. Perhaps this an issue on my end with the certs. Are you able to record AMF components on a secure site with the AMF Proxy server?

2011/10/25 09:14:00 INFO - jmeter.protocol.amf.proxy.AmfDaemon: Creating Daemon Socket on port: 8080 2011/10/25 09:14:00 INFO - jmeter.protocol.amf.proxy.AmfDaemon: Proxy up and running! 2011/10/25 09:14:29 INFO - jmeter.protocol.amf.proxy.AmfProxy: Proxy will remove the headers: If-Modified-Since,If-None-Match,Host 2011/10/25 09:14:29 INFO - jmeter.protocol.http.sampler.HTTPHCAbstractImpl: Local host = myPCname 2011/10/25 09:14:29 INFO - jmeter.protocol.http.sampler.HTTPHC3Impl: HTTP request retry count = 1 2011/10/25 09:14:29 INFO - jmeter.protocol.amf.proxy.AmfProxy: Opened Keystore file: C:\Users\myProfile\Downloads\JMeter\jakarta-jmeter-2.5.1\bin\proxyserver.jks 2011/10/25 09:14:29 INFO - jmeter.protocol.amf.proxy.AmfProxy: KeyStore for SSL loaded OK and put host in map (my.application.lalala) 2011/10/25 09:14:30 INFO - jmeter.protocol.http.sampler.HTTPJavaImpl: Maximum connection retries = 10 2011/10/25 09:14:30 WARN - jmeter.protocol.http.sampler.HTTPJavaImpl: ResponseCode==-1 & null ResponseMessage. Header(0)= unknown/unknown 2011/10/25 09:14:30 WARN - jmeter.protocol.http.sampler.HTTPJavaImpl: ResponseCode==-1 & null ResponseMessage. Header(0)= unknown/unknown 2011/10/25 09:14:30 INFO - jmeter.protocol.amf.proxy.FormCharSetFinder: Using htmlparser version: 2.0 (Release Build Sep 17, 2006) 2011/10/25 09:14:30 ERROR - jmeter.protocol.amf.proxy.AmfProxy: 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.amf.proxy.AmfProxy.writeToClient(AmfProxy.java:461) at org.apache.jmeter.protocol.amf.proxy.AmfProxy.run(AmfProxy.java:282)

steeltomato commented 13 years ago

I have successfully used the AMF Proxy to sample SSL traffic with the dummy certificate. It seems like your server may have some security restrictions in place that are preventing it from listening to the proxy's SSL traffic. You may want to try turning on debug logging to get a better idea of what is going on before the connection is closed. To do that:

In bin/jmeter.properties, find "log_level.jmeter=INFO" and after that line add:

log_level.jmeter.protocol.amf=DEBUG

Delete jmeter.log and try the proxy again.

sirwinks commented 13 years ago

Below is the DEBUG output. Nothing jumps out at me, but my SSL troubleshooting skills are not the best. I would think that same issue with the cert and proxy would arise when I use the HTTP proxy.

2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfProxy: Method CONNECT => SSL 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfProxy: Start to negotiate SSL connection, host: my.test.lalala.lab 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfProxy: Good, already in map, host=my.test.lalala.lab 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfProxy: SSL transaction ok with cipher: SSL_RSA_WITH_RC4_128_SHA 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: rawPostData in default JRE encoding:
2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Request:
2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfProxy: Sampling HTTP 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy: setting server: my.test.lalala.lab 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy: setting method: CONNECT 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy: setting port: 6666 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy setting default protocol to: http 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: No encoding found, using JRE default encoding for request body 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy: setting path:
2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: sampler path =
2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: getSampler: sampler path =
2011/10/25 10:06:17 INFO - jmeter.protocol.http.sampler.HTTPJavaImpl: Maximum connection retries = 10 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy: setting server: my.test.lalala.lab 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy: setting method: CONNECT 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy: setting port: 6666 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy setting default protocol to: http 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: No encoding found, using JRE default encoding for request body 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: Proxy: setting path:
2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: sampler path =
2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfRequestHdr: getSampler: sampler path =
2011/10/25 10:06:17 WARN - jmeter.protocol.http.sampler.HTTPJavaImpl: ResponseCode==-1 & null ResponseMessage. Header(0)= unknown/unknown 2011/10/25 10:06:17 WARN - jmeter.protocol.http.sampler.HTTPJavaImpl: ResponseCode==-1 & null ResponseMessage. Header(0)= unknown/unknown 2011/10/25 10:06:17 INFO - jmeter.protocol.amf.proxy.FormCharSetFinder: Using htmlparser version: 2.0 (Release Build Sep 17, 2006) 2011/10/25 10:06:17 ERROR - jmeter.protocol.amf.proxy.AmfProxy: 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.amf.proxy.AmfProxy.writeToClient(AmfProxy.java:461) at org.apache.jmeter.protocol.amf.proxy.AmfProxy.run(AmfProxy.java:282)

2011/10/25 10:06:17 ERROR - jmeter.protocol.amf.proxy.AmfProxy: Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert: Connection closed by remote host 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfProxy: Will deliver sample
2011/10/25 10:06:17 ERROR - jmeter.protocol.amf.proxy.AmfProxy: 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.amf.proxy.AmfProxy.writeToClient(AmfProxy.java:461) at org.apache.jmeter.protocol.amf.proxy.AmfProxy.run(AmfProxy.java:282)

2011/10/25 10:06:17 ERROR - jmeter.protocol.amf.proxy.AmfProxy: Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert: Connection closed by remote host 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.proxy.AmfProxy: Will deliver sample
2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.gui.AmfProxyControlGui: Configuring gui with org.apache.jmeter.protocol.amf.proxy.AmfProxyControl@3bca97bf 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.gui.AmfProxyControlGui: Reinitializing target combo 2011/10/25 10:06:17 DEBUG - jmeter.protocol.amf.gui.AmfProxyControlGui: Selecting item Use Recording Controller for model org.apache.jmeter.protocol.amf.proxy.AmfProxyControl@3bca97bf in org.apache.jmeter.protocol.amf.gui.AmfProxyControlGui[AMF Proxy

aedahh commented 12 years ago

hello, trying to use your AMF jmeter plugin, but getting the same exception. Can you please be more specific and provide steps to "sample SSL traffic with the dummy certificate"?

-without going thru AMF proxy, our application works via http and https from web browser. -I have tried enable debug log but could not find anything useful.

sirwinks commented 11 years ago

I downloaded the latest JMeter-AMF jar file and am able to record AMF requests now with the AMF Proxy Server.

kurtxchen commented 10 years ago

Hi sirwiks and steeltomato,

Could you list the detail step how would you solve this problem? And could you please, please let me know where did you download the latest JMeter-AMF.jar file?

I have been working on this for 2 weeks now, I got the JMeter-AMF source code from gitHub, but none of working. :(, the major problem is wmf proxy server can't be started and record the amf message.

Please give me the clue which you have solved this issue.

Thanks a bunch. -Kurt.

kurtxchen commented 10 years ago

When I start AMF proxy server, it said can't find the resource bundle for key amf_request_defaults and key amf_request?

2014/01/21 14:34:13 INFO - jmeter.services.FileServer: Default base='/Users/chenk/Documents/Performance/apache-jmeter-2.10/bin' 2014/01/21 14:34:13 INFO - jmeter.gui.action.Load: Loading file: /Users/chenk/Documents/QA/TestPlan_nextGen/Testing1.jmx 2014/01/21 14:34:13 INFO - jmeter.services.FileServer: Set new base='/Users/chenk/Documents/QA/TestPlannextGen' 2014/01/21 14:34:13 INFO - jmeter.save.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2 2014/01/21 14:34:13 INFO - jmeter.save.SaveService: Using SaveService properties file encoding UTF-8 2014/01/21 14:34:13 INFO - jmeter.save.SaveService: Using SaveService properties version 2.5 2014/01/21 14:34:13 INFO - jmeter.save.SaveService: Using SaveService properties file version 1519088 2014/01/21 14:34:13 INFO - jmeter.save.SaveService: All converter versions present and correct 2014/01/21 14:34:13 INFO - jmeter.protocol.http.control.CookieManager: Settings: Delete null: true Check: false Allow variable: true Save: true Prefix: COOKIE 2014/01/21 14:34:13 INFO - jmeter.services.FileServer: Set new base='/Users/chenk/Documents/QA/TestPlan_nextGen' 2014/01/21 14:34:13 WARN - jmeter.protocol.amf.resources.AmfResourceManager: ERROR! Resource string not found: [amf_request_defaults] java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key amf_request_defaults at java.util.ResourceBundle.getObject(ResourceBundle.java:374) at java.util.ResourceBundle.getString(ResourceBundle.java:334) at org.apache.jmeter.protocol.amf.resources.AmfResourceManager.getResString(AmfResourceManager.java:25) at org.apache.jmeter.protocol.amf.config.gui.AmfConfigGui.getStaticLabel(AmfConfigGui.java:126) at org.apache.jmeter.gui.util.MenuInfo.getLabel(MenuInfo.java:48) at org.apache.jmeter.gui.util.MenuFactory.makeMenuItem(MenuFactory.java:404) at org.apache.jmeter.gui.util.MenuFactory.makeMenu(MenuFactory.java:344) at org.apache.jmeter.gui.util.MenuFactory.makeMenu(MenuFactory.java:329) at org.apache.jmeter.gui.util.MenuFactory.makeMenus(MenuFactory.java:243) at org.apache.jmeter.threads.gui.AbstractThreadGroupGui.createPopupMenu(AbstractThreadGroupGui.java:69) at org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:156) at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:47) at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81) at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40) at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:676) at java.awt.EventQueue$2.run(EventQueue.java:674) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86) at java.awt.EventQueue.dispatchEvent(EventQueue.java:685) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

2014/01/21 14:34:13 WARN - jmeter.protocol.amf.resources.AmfResourceManager: ERROR! Resource string not found: [amf_request] java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key amf_request at java.util.ResourceBundle.getObject(ResourceBundle.java:374) at java.util.ResourceBundle.getString(ResourceBundle.java:334) at org.apache.jmeter.protocol.amf.resources.AmfResourceManager.getResString(AmfResourceManager.java:25) at org.apache.jmeter.protocol.amf.control.gui.AmfSamplerGui.getStaticLabel(AmfSamplerGui.java:78) at org.apache.jmeter.gui.util.MenuInfo.getLabel(MenuInfo.java:48) at org.apache.jmeter.gui.util.MenuFactory.makeMenuItem(MenuFactory.java:404) at org.apache.jmeter.gui.util.MenuFactory.makeMenu(MenuFactory.java:344) at org.apache.jmeter.gui.util.MenuFactory.makeMenu(MenuFactory.java:329) at org.apache.jmeter.gui.util.MenuFactory.makeMenus(MenuFactory.java:243) at org.apache.jmeter.threads.gui.AbstractThreadGroupGui.createPopupMenu(AbstractThreadGroupGui.java:69) at org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:156) at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:47) at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81) at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40) at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:676) at java.awt.EventQueue$2.run(EventQueue.java:674) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86) at java.awt.EventQueue.dispatchEvent(EventQueue.java:685) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

sirwinks commented 10 years ago

The problems I was having look different than the one you listed. I am looking through old notes that I wrote down a year ago when trying to overcome the SSL errors I was seeing when recording. I was using JMeter 2.6. Here is what worked for me:

  1. I had to download my companies blazecommon jars and put them in jmeter/lib/ext
  2. Download the JMeter-AMF Jar from git and put it in jmeter/lib/ext (the latest jar is on this git repository)
  3. I was using windows. In DOS navigate to the jmeter/bin directory, run: java -jar -Dfile.encoding=ISO-8859-1 ApacheJMeter.jar ****The key is that I had to be in the jmeter/bin directory when I ran the command above. For whatever reason, JMeter wasnt recording anything if I ran that command from a different directory but still pointing to the jar file.
  4. Record in Firefox and be sure to set your firefox proxy setting to localhost and port 8080.

One other note I wrote down was for each secure site I was trying to record, I had to add to Add an Exception to the Firefox Server Certificates. Do this by: Tools > options >Advanced> Encryption Tab > View Certificate > Servers tab > Add Exception and enter in the pages that have SSL certs on them (ie https://www.blahblahblah.com). Answer yes or OK to the questions asked by firefox when saving these settings.