How can I record JMeter scripts behind company's proxy auto config (PAC) file? - jmeter

The Internet Options settings are managed by my company's system administrator.
The Proxy is set to use automatic configuration script (http://proxypac.abcd.com/proxyrouting). I cannot disable this.
I cannot change the proxy to localhost. The above PAC script will override no matter what I try to change.
The IT security does not allow me to install Chrome Blazemeter plugin, or install Badboy, or use Fiddler, or be able to manually change the proxy.
The company's proxy host is proxy.abcd.com and port is 8080, but I don't know how this info will help if the browser is reading the PAC file.
Is there any option for me to record JMeter scripts in the above scenario?
Is there any way for me to create GUI scripts with plenty of data and dynamic values coming back from the server without recording (if recording is not an option in my case)?

You can use a browser which doesn't use operating system proxy settings, a good example is Mozilla Firefox. You need to configure Firefox to use JMeter as the proxy
Once done you can configure JMeter to use your company proxy server by putting the following lines to system.properties file:
http.proxyHost=proxy.abcd.com
https.proxyHost=proxy.abcd.com
http.proxyPort=8080
https.proxyPort=8080
These PAC files don't do any magic, they're normal JavaScript files which are being interpreted by browsers to determine which proxy should be used for which URL. For certain URLs you might not even need to use the proxy. So I would recommend checking whether you really need the proxy for accessing the application you're trying to record, it might be the case you don't need this step #2

Related

Jmeter Recording of scripts behind Proxy

I need to perform JMETER TEST and Record a WEB Login Page, my company is behind the proxy. If I change the proxy and port of the Firefox to 8080, My Application doesn't launch.
If I don't change the proxy in Firefox, Then the recorder doesn't record the script.
I tried with IE, Where due to corporate policy, I cant change the policy and it is disabled.
How I get out of this situation?
You need to keep Firefox proxy settings to point to JMeter's HTTP(S) Test Script Recorder, i.e. server name should be localhost, port should be 8888
In its turn JMeter needs to be configured to use your corporate proxy, it can be done in 2 ways:
Via command-line parameters, like:
jmeter -H your_corporate_proxy_host -P your_corporate_proxy_port -n -t ...
this way the change will be applied only once
If you want the changes to be permanent you can add the following lines to system.properties file (located in the "bin" folder of your JMeter installation)
http.proxyHost=your_corporate_proxy_host
http.proxyPort=your_corporate_proxy_port
https.proxyHost=your_corporate_proxy_host
https.proxyPort=your_corporate_proxy_port
References:
Using JMeter behind a proxy
Configuring JMeter
Apache JMeter Properties Customization Guide

How to configure Atom to use proxy file (pac) settings?

On Windows, is it possible to configure Atom to use the system default proxy instead of manually specifying the proxy settings in the .apmrc file?
I recently started using the atom-editor for Windows (Windows 7 Pro) and so far I like it. I've been searching for some time to try and get the editor to be able to connect to the outside world and haven't met with any success.
Our network (I'm not a network expert) is configured to use a proxy server (internal) to access the internet. On my system, this is accomplished in the proxy settings with an 'Automatic Configuration Script', for example: http://internal-server-name/sub-dir/file-name.pac.
Many resources have suggested manually setting the proxy information in the .apmrc file:
Not able to connect to atom.io for themes and packages
here:https://discuss.atom.io/t/is-there-any-proxy-settings/710/19
https://github.com/atom/atom/issues/1807
These do not answer my question as I need the system defaults to work
I tried to configure Atom to do this same thing but when I change the .apmrc file to have:
http-proxy = http://internal-server-name/sub-dir/file-name.pac
https-proxy = https://internal-server-name/sub-dir/file-name.pac
strict-ssl = false
I get the following error (presumably because the above address is not the proxy itself):
tunneling socket could not be established, cause=Parse Error
When I leave the .apmrc file unmolested, I receive the following error when trying to view packages:
getaddrinfo ENOTFOUND
Even if I had a proxy server IP address and port number to specify, not only would i not want to hard-code my credentials in a config file but I'm pretty sure the authentication is somehow set up to use Kerberos tokens anyway, so I wouldn't be able to specify them at all.
Interestingly the Atom updates says that my installed packages (out of the box) are up to date, which would seem to indicate that this portion is working while the packages and themes do not.
Here are some screenshots for reference:
No .apmrc changes
Proxy server specified in .apmrc
Edit 08/31/2015
In response to some of the feedback, I tried to view the .pac file and extract the proxy server address information. I was able to get the information about the proxy out of the file and put it in the .apmrc file but it had no affect on the outcome (I still receive the same errors). I have also since tried using CNTLM to no avail.
Also note that my proxy does require authentication as stated above. I've been doing further research on this issue and it may be a combination of proxy settings for the APM and proxy settings for GitHub. See the following relevant article:
https://discuss.atom.io/t/error-running-apm-install-behind-proxy/14812
Ideally, I'd like a solution that doesn't require a complete machine configuration or a fragile multi-config file setup.
A .pac file is just a javascript file that browsers can run to programmatically determine which proxy to use. This is useful if your network needs to use different proxies to access different resources. If you open up that file, you'll probably be able to make sense of it (it's just javascript, after all) and figure out which proxy your network is using for general access to the web. Set that as your proxy in your .apmrc file and it should work.
Things get more complicated if your proxy requires some kind of authentication. If that's your problem, let me know. I have some experience dealing with it.
Authenticating
OK, so you need to authenticate. Then your situation is probably pretty similar to mine. You are correct in using CNTLM, we just need to configure it properly. Your cntlm.ini file will look something like this:
Username <your windows username>
Domain <your domain name>
Password <leave this blank>
PassLM <get this by running `cntlm -H` on the command line>
PassNT <get this by running `cntlm -H` on the command line>
PassNTLMv2 <get this by running `cntlm -H` on the command line>
Proxy <Your proxy address like ip_address:port>
Proxy <If you have multiple proxies, you may list them each on a new line>
NoProxy localhost, 127.0.0.*, <any others that should bypass the proxy>
Listen <a local port to listen on (I use 53128)>
There's something a bit funny that you should know about this file (cntlm.ini). When you install cntlm, it's included in the program's folder but it actually will only work if it's located at C:\Program Files (x86)\cntlm\cntlm.ini. I guess it's probably more accurate to say that it should be in the cntlm folder inside the PROGRAMFILES directory so you should double check that this is the case.
Anyway, having done all that, you can now start cntlm (instructions in the readme). Next, you need to configure apm to actually use your local proxy. Your .apmrc should look like this:
http-proxy = http://localhost:<port # from cntlm.ini>
https-proxy = https://localhost:<port # from cntlm.ini>
strict-ssl = false
You'd think this would be enough but there's more that might help. I had a lot of problems with npm until I found that https doesn't work well through cntlm so I needed to change my registry from https://registry.npmjs.org/ to http://registry.npmjs.org/. Since apm also uses the same registry, I decided to change that too:
apm config set registry http://registry.npmjs.org/
And then... it seemed to also help to go into Atom's config.cson and set core.proxy to http://localhost:<port # from cntlm.ini>
And after all that, I'd expect things to work for you. If it's cool and fine and Atom is working well, there's one more thing that you might want to do that will make most (all?) other apps (npm, git, etc) work well. On the command line, run:
netsh winhttp set proxy localhost:<port # from cntlm.ini> "localhost, 127.0.0.*"
This will save you the trouble of configuring most (all?) other apps one-by-one. For some reason, apm does need to be configured specifically. I guess it doesn't use the winhttp settings for some reason? I don't know the answer to that.
New Info 2016/03/18
I recently noticed that there's one additional thing you might need to do for some apps. You should set the following environment variables to your local proxy as well:
HTTP_PROXY
HTTPS_PROXY
FTP_PROXY
http_proxy
https_proxy
ftp_proxy
It may seem like overkill to set both upper and lower case but I recently installed MSys2 and found that it looks for the lower case versions so just set them all and save yourself some trouble.
You should download the file http://internal-server-name/sub-dir/file-name.pac and open it with a text editor, then find the actual proxy address and port inside it (near a PROXY keyword).
I used this for my trouble with npm and .npmrc
c:\users\%user%\.atom\.apmrc (add if not exist) and put this
proxy=http://YOUR-DOMAIN**%5C**USER-NAME:PASSWORD#YOUR-PROXY-SERVER:PORT/

Setup JMeter proxy to record activities on a local web application

I'm new to JMeter and I want to load test a local web application recording test case with JMeter proxy.
I've first followed instruction here http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf and all worked fine.
Than:
I launched my web application, say http://localhost:8080/my-application
Setup JMeter web proxy on port 8081
Added an HTTP Request Default to a Thread Group
Addea a Recording Controller
Invoked curl -X GET http://localhost:8081/my-application/index.html
I obtain:
Request are recorded but with wrong parameters, eg. https instead of http
I don't get the requested page with curl, but the exception: org.apache.http.client.ClientProtocolException: URI does not specify a valid host name: https:///my-application/index.html/my-application/index.html
The parameters I've specified in Http Request Default seems to be ingnored? I placed configuration element under HTTP Proxy Server, and tried many settings.
What's going wrong? I missed some basic configuration? I'm using JMeter Proxy in the wrong manner?
Firefox default setting will bypass "localhost, 127.0.0.1" from proxy so your JMeter still not able to record it. You have to empty the "No Proxy for" field, by removing the "localhost, 127.0.0.1". Hope this will help.
Firefox by default does not allow localhost or 127.0.0.1 to be proxied.
You have to modify a setting in about:config
change network.proxy.allow_hijacking_localhost to true
Go To Browser LAN Settings
Make sure "Bypass proxy server for local addresses" is unchecked so that request will hit JMeter proxy server.
Simple steps to be followed for recording in jmeter:
open ur jmeter (contains testplan and workbench in default)
add a threadgroup
add “http request defaults” whic is under config( change the server name i.ethe site u need to record)
add “http proxy server (workbench-rightclick-non testing elements-http proxy server)change the default port 8080 to
someother(eg 9090)
start the proxy server
change the browser settings to manual setup with 9090 port and localhost
http://brittoc.wordpress.com/2011/03/28/jmeter-recording-steps/
I would suggest using Apache's own tutorial on this, it is located here...
JMeter Proxy Tutorial
I see that you say you have followed it, but it may have changed since you used it as some of your steps do not match the current tutorial. Perhaps your version had a bug or you missed a step, because I just double checked it 5 minutes ago and it worked for me and I don't see some of the steps you are talking about above.
I realize you have specific questions about specific errors that you are concerned with, but based on your current unfamiliarity with the process in general, I would abandon the curl part, and just do the basic proxy recording as Apache describes it to get a better general understanding, then take it from there.
The only caveat I would add to their tutorial, they have you create filters to only record certain types of actions, I actually leave those out so it will record all actions, then I just clean it up later.
This way you don't miss anything that could potentially be causing lag because that type of resource was filtered out.
* Now, one thing in your original question, you can try if you have no intention of doing the tutorial, try the browser, not curl, and setup your browser to use a proxy, and make sure the port matches the one you specify in jmeter on the proxy node.
Its very simple to configure. Please have a look to the attached screenshot.

Steps to setup proxy server

I want to setup proxy server on our office. I have two proxy server's available i.e. (SQUID for Linux and WinProxy for Windows). I have following requirement.
All the rule's which I define in proxy server like block some specific sites etc. should likely to work.
The "Evolution Mail Client" for linux and "Outlook Express" for windows also should work.
So, can you tell me the guidelines how to achieve both the task especially no.-2 .
Thanks in advance.
Squid is a very good option for a caching proxy. It has a configuration file to block some specific sites, IPs, domains... and to tell him which files has to cache. Making a smart proxy is not easy. But you can find great configurations and tutorials in Google or in his wiki.
There are two ways for setting up a proxy:
Direct proxy: you have to manually configure every computer to use your proxy server.
This is the easiest option. I recommend you using this.
Please note, computers that don't use the proxy can access all pages (even if they're blocked).
Transparent proxy: this is the most secure, ideal option for most cases (including yours). You have to configurate your network and the proxy server to forward any requests to it. This is a hard option and very difficult to achieve in your case.
About your Evolution and Outlook problem, there can't be any problems related to the proxy, don't worry about that.

Selenium: Can I tunnel through an *External* HTTP/SOCKS proxy over Firefox?

I know Selenium Server acts AS a proxy. But I want to know if I can instruct a test to connect through to either a SOCKS or plain http proxy, eg: Tuenneling through an external Proxy. (It's so hard to search for because the word proxy just shows how Selenium works, not if it supports this feature....)
You can use -DsocksProxyHost=socks.******.*** -DsocksProxyPort=1080 while running it .
or
In the MANual , you can find this..
-proxyInjectionMode: puts you into proxy injection mode, a mode
where the selenium server acts as a proxy server for all content
going to the test application. Under this mode, multiple domains
can be visited, and the following additional flags are supported:
or
set the settings mentioned above in the system variables..
Yenjoy!

Resources