Hi you should be able to do something like (not tested) - also be careful with your paths - I believe they will be relative to JMeter's bin directory so you might want to try with absolute paths first(for your .key and .crt files) String path = sampler.getURL(); String s = "openssl smime -in " + path + " -sing -signer cert.crt -inkey cert.key -outform der -binary -md sha384 -out blah.p7"; s.execute();
regards deepak On Mon, Dec 2, 2019 at 8:11 AM Markus Obermann <[email protected]> wrote: > Hi, > > i need to do some wired stuff where i have to call linux commands from > jmeter - to be clear its openssl i need to run.Bevore the openssl command > is executed i have to "echo" something to my system console and want that > this is piped to openssl.So the command i want to execute is this (and it's > working perfect on bash) > echo -en "https://my-url.com:8888" | openssl smime -sing -signer cert.crt > -inkey cert.key -outform der -binary -md sha384 -out blah.p7 > > I have a HTTP Sampler and there is a JSR223 PreProcessor as a child with > this tiny code://First i get the URL from my Sampler > import org.apache.jmeter.protocol.http.sampler.HTTPSampler;String path = > sampler.getURL(); > This works and will print out the URL from the Sampler.Then i do this: > log.info("echo -en $path | openssl smime -sing -signer cert.crt -inkey > cert.key -outform der -binary -md sha384 -out blah.p7".execute().text) > In my Jmeter console i do see the "log.info" output which looks perfect. > BUT it seems that nothing happen. I do not see the -out blah.p7 fileCould > it be that jmeter cant handle the pipe-symbol? > > If i do some changes to my command and do not echo my command but paste > the url as -in directly to my openssl command then its working.Thus i can > do this:log.info("openssl smime -in https//my-url.com:8888 -sing -signer > cert.crt -inkey cert.key -outform der -binary -md sha384 -out > blah.p7".execute().text) > > But as im using different urls i cant make it static - i need to determine > the url from sampler and paste it to my openssl command. > For sure i will find a way which will work - but maybe someone have an > idea about the "pipe-symbol" - or what i'm doing wrong? > Br >
