You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by George <ba...@yahoo.de> on 2014/10/15 16:35:51 UTC

Using Multiple KeyStore Configurations

Hello all,

i need your help regarding the KeyStoreConfig element.

Well i have setup a key store and everything works good. I have no configuration problems regardings my certs my keys or my keystore etc etc.
So i have 3 certs.
[0] cert 1
[1] cert 2
[2] cert 3

i can see all 3 cert's using the keytool -list -keystore /path/to/kestore command.
Perfect.

Now i can set up a test plan with one thread and a simple https request.
Of cource i set up the KeyStoreConfiguration element and put "0" for start and "2" for end index.
I do not use any variables.

Then i let the thread run 3 times or 10 times or 50 times and i see that every thing works perfectly.
I see the login with cert [0] then with [1] then with [2] then again with [0] then with [1] and [2] and again with [0] and so on and so forth.
Perfect.

But now i want to do the following

I create a second thread
I create a second KeyStoreConfiguration
I use the same https request

I configure the KeyStore index to start at 0 and end at 0 (so take only the first cert)
I confugire the KeyStore index in the first thread to start at 2 and end at 2 (so take only the third cert)

Now i let the test plan run and in the JMeterLogger Panel i see that BOTH key stores will be created.
The first one starting at 0 and ending at 0 and the other starting at 2 and ending at 2.
BUT i also see that jmeter.util.SSLManager is creating only one instance.
This means that for BOTH threads in BOTH https request only once cert will be used.

I have tried to do some beanshell stuff like "SSLManager.getInstance().reset()" and i also did some other stuff with KeystoreConfig.testEnded() and KeystoreConfig.testStarted() etc etc.
But nothing works.

Anyone got some ideas?

I want to have

TestPlan
---> Thead 1
            ---> KeyStoreConfig index 0 - 0
            ----> Https request using cert on index 0


----> Thread 2
           ----> KeyStoreConfig index 2 - 2
           ----> Https request using cert on index 2


But so far the SSLManager will initialize the Keystoreconfig only once for the whole test plan.

Btw.
I can't use CSV file with cert aliases because my https request which do the login to my https server do extract the CN directly from the cert to login.
Thus there is no login parameter i need and can sent. So i do not need the variable to pick the cert out.

Br
George

Re: Using Multiple KeyStore Configurations

Posted by Flavio Cysne <fl...@gmail.com>.
George,

    as sebb said you can do this using 3 different JMeter slaves, each one
configured to use a distinct JKS file. I think this is the easiest way to
achieve what you want.

    Another approach that could work fine is to use only one Thread Group
configured to loop 3 times, a KeyStore Configuration using all 3 certs,
each group of requests would go inside a Loop Controller, configured to
iterate 10 times, and use a Interleave Controller
<http://jmeter.apache.org/usermanual/component_reference.html#Interleave_Controller>
as
shown below.

    Test Plan
        - KeyStoreConfiguration (start:0, end:2)
        Thread Group (loop count: 3)
            - Interleave Controller
                - Simple/Transaction/Recording Controller (1)
                    - Loop Controller (loop count: 10)
                        - requests (1st group)
                - Simple/Transaction/Recording Controller (2)
                    - Loop Controller (loop count: 10)
                        - requests (2nd group)
                - Simple/Transaction/Recording Controller (3)
                    - Loop Controller (loop count: 10)
                        - requests (3rd group)

Re: Using Multiple KeyStore Configurations

Posted by George <ba...@yahoo.de>.
Hello,

thanks for your reply.

Well i know that KeyStoreConfiguration is a JMeter configuration element but of course JMeter has a lot of them and the behaviour of them all
depends on "where" you place them in your test plan. e.g. user-defined-parameters or cookie-manager are configuration elements.
If you create a user defined parameter and place this configuration element as child of your thread then the parameters are only valid inside this thread.
If you place this configuration element as child oft your test plan then in ALL threads the parameter become valid.

So this should be the same with the KeyStoreConfiguration.
As showed above my test plan looks like this.

Testplan
---> Thread Group 1 

            ---> KeyStoreConfiguration Startindex 0 Endindex 0 (means only the first cert from keystore will be loaded)
            ---> Cookie-Manager with "clear cookie on every run" hook set

            ---> https request to my server without parameters just a pure GET to the url

---> Thread Group 2
           ---> KeyStoreConfiguration Startindex 2 Endindex 2 (means only the 3rd cert from the keystore will be loaded)
           ---> Cookie-Manager with "clear cookie on every run" hook set
           ----> same https request as under group 1


If i let the test run then the test itself works perfect BUT in the second https request NOT the 3rd cert but the first cert will be taken
I also see that the server responds with different cookies for request 1 and 2. Thus the server treat both request perfectly. For the server two auth. has been made. But both with same cert. But i want to login user 1 with cert 1 and user 2 with cert 2.

Again.
If i disable Thread Group 2 and then change the index of KeyStoreConfiguration from 0 - 0 (load only the first cert) to  0 - 2 (load all 3 certs)
AND then let Thread Group 1 loop 30 times then i see perfectly 30 https requests with 30 different cookies and i see that request 1 is using cert [0] 

request 2 is using cert [1] request 3 is using cert [2] and then it starts again and request 4 is using cert [0]. 

Perfect.

Now i want to split it and i want to get "control" about my login.
I want Thread Group 1 to login as user 1 with cert 1 and do some stuff on my server
Then i want to launch a 2nd Thread group and login as user 2 with cert 3 and do some stuff on my server
And so on...

For me it seems like the KeyStoreConfiguration is loaded ONCE for the whole test plan at the beginning and then you can't change or "flush" it.
It also doesn't matter where you put the KeyStoreConfiguration element in your test plan.

I will try to do some BeanShell stuff to "clear()" the KeyStoreConfiguration after my Therad ends. And on the next thread i need to load and use the other configuration.

Br
George



sebb <se...@gmail.com> schrieb am 3:27 Donnerstag, 16.Oktober 2014:
 


On 15 October 2014 15:35, George <ba...@yahoo.de> wrote:
> Hello all,
>
> i need your help regarding the KeyStoreConfig element.
>
> Well i have setup a key store and everything works good. I have no configuration problems regardings my certs my keys or my keystore etc etc.
> So i have 3 certs.
> [0] cert 1
> [1] cert 2
> [2] cert 3
>
> i can see all 3 cert's using the keytool -list -keystore /path/to/kestore command.
> Perfect.
>
> Now i can set up a test plan with one thread and a simple https request.
> Of cource i set up the KeyStoreConfiguration element and put "0" for start and "2" for end index.
> I do not use any variables.
>
> Then i let the thread run 3 times or 10 times or 50 times and i see that every thing works perfectly.
> I see the login with cert [0] then with [1] then with [2] then again with [0] then with [1] and [2] and again with [0] and so on and so forth.
> Perfect.
>
> But now i want to do the following
>
> I create a second thread
> I create a second KeyStoreConfiguration
> I use the same https request
>
> I configure the KeyStore index to start at 0 and end at 0 (so take only the first cert)
> I confugire the KeyStore index in the first thread to start at 2 and end at 2 (so take only the third cert)
>
> Now i let the test plan run and in the JMeterLogger Panel i see that BOTH key stores will be created.
> The first one starting at 0 and ending at 0 and the other starting at 2 and ending at 2.
> BUT i also see that jmeter.util.SSLManager is creating only one instance.
> This means that for BOTH threads in BOTH https request only once cert will be used.
>
> I have tried to do some beanshell stuff like "SSLManager.getInstance().reset()" and i also did some other stuff with KeystoreConfig.testEnded() and KeystoreConfig.testStarted() etc etc.
> But nothing works.
>
> Anyone got some ideas?

KeyStoreConfiguration is a Configuration element; these generally are
resolved at the start of a test.

> I want to have
>
> TestPlan
> ---> Thead 1
>             ---> KeyStoreConfig index 0 - 0
>             ----> Https request using cert on index 0
>
>
> ----> Thread 2
>            ----> KeyStoreConfig index 2 - 2
>            ----> Https request using cert on index 2
>
>
> But so far the SSLManager will initialize the Keystoreconfig only once for the whole test plan.
>
> Btw.
> I can't use CSV file with cert aliases because my https request which do the login to my https server do extract the CN directly from the cert to login.
> Thus there is no login parameter i need and can sent. So i do not need the variable to pick the cert out.

Some suggestions to try.

Use two different thread groups
Use two different JMeter instances


> Br
> George

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org

Re: Using Multiple KeyStore Configurations

Posted by sebb <se...@gmail.com>.
On 15 October 2014 15:35, George <ba...@yahoo.de> wrote:
> Hello all,
>
> i need your help regarding the KeyStoreConfig element.
>
> Well i have setup a key store and everything works good. I have no configuration problems regardings my certs my keys or my keystore etc etc.
> So i have 3 certs.
> [0] cert 1
> [1] cert 2
> [2] cert 3
>
> i can see all 3 cert's using the keytool -list -keystore /path/to/kestore command.
> Perfect.
>
> Now i can set up a test plan with one thread and a simple https request.
> Of cource i set up the KeyStoreConfiguration element and put "0" for start and "2" for end index.
> I do not use any variables.
>
> Then i let the thread run 3 times or 10 times or 50 times and i see that every thing works perfectly.
> I see the login with cert [0] then with [1] then with [2] then again with [0] then with [1] and [2] and again with [0] and so on and so forth.
> Perfect.
>
> But now i want to do the following
>
> I create a second thread
> I create a second KeyStoreConfiguration
> I use the same https request
>
> I configure the KeyStore index to start at 0 and end at 0 (so take only the first cert)
> I confugire the KeyStore index in the first thread to start at 2 and end at 2 (so take only the third cert)
>
> Now i let the test plan run and in the JMeterLogger Panel i see that BOTH key stores will be created.
> The first one starting at 0 and ending at 0 and the other starting at 2 and ending at 2.
> BUT i also see that jmeter.util.SSLManager is creating only one instance.
> This means that for BOTH threads in BOTH https request only once cert will be used.
>
> I have tried to do some beanshell stuff like "SSLManager.getInstance().reset()" and i also did some other stuff with KeystoreConfig.testEnded() and KeystoreConfig.testStarted() etc etc.
> But nothing works.
>
> Anyone got some ideas?

KeyStoreConfiguration is a Configuration element; these generally are
resolved at the start of a test.

> I want to have
>
> TestPlan
> ---> Thead 1
>             ---> KeyStoreConfig index 0 - 0
>             ----> Https request using cert on index 0
>
>
> ----> Thread 2
>            ----> KeyStoreConfig index 2 - 2
>            ----> Https request using cert on index 2
>
>
> But so far the SSLManager will initialize the Keystoreconfig only once for the whole test plan.
>
> Btw.
> I can't use CSV file with cert aliases because my https request which do the login to my https server do extract the CN directly from the cert to login.
> Thus there is no login parameter i need and can sent. So i do not need the variable to pick the cert out.

Some suggestions to try.

Use two different thread groups
Use two different JMeter instances

> Br
> George

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org