OpenSSL的的GnuWin32康涅狄格州的s​​_client.First在EOF WebSphere MQ服务器不关闭,挂起 [英] GnuWin32 openssl s_client conn to WebSphere MQ server not closing at EOF, hangs

查看:172
本文介绍了OpenSSL的的GnuWin32康涅狄格州的s​​_client.First在EOF WebSphere MQ服务器不关闭,挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用OpenSSL的版本的GnuWin32从几个WebSphere MQ队列管理器获取证书。所有尝试导致OpenSSL的保持连接打开,直到我手动按Enter键。

I am trying to use the GnuWin32 version of OpenSSL to fetch certificates from several WebSphere MQ queue managers. All attempts result in OpenSSL keeping the connection open until I manually hit ENTER.

我试过各种管道文成命令按这太问题和<一个href=\"http://stackoverflow.com/questions/15985726/closing-connections-via-s-client-in-a-shell-script\">this SO质疑,但没有运气。

I tried piping various text into the command as per this SO question and this SO question, but with no luck.

在理想情况下,OpenSSL的将关闭,一旦输入文件或管道文本命中EOF的连接。

Ideally, OpenSSL would close the connection once the input file or piped text hit EOF.

例如:

echo QUIT | openssl s_client -connect qmgrhost:1414 -showcerts 

openssl s_client -connect qmgrhost:1414 -showcerts < responsefile.txt

使用退出命令的例子出现在其他等问题的工作,因为他们打一个HTTP服务器。由于这是WMQ在我的情况,连接握手不同,发送退出(或其他任何东西我试过)没有得到它关闭连接。我大概可以给它一个巨大的文件,直到QMGR哽咽,杀死了连接,但我想尽可能礼貌到服务器。供给从键盘的ENTER键的当前方法导致FDC每个连接上转储,因为它是掀起了各种报警和我制作的Tivoli家伙疯了。

The examples using the QUIT command appear to work in the other SO question because they are hitting an HTTP server. Since this is WMQ in my case, the connection handshake is different and sending QUIT (or anything else I've tried) doesn't get it to close the connection. I could probably feed it a giant file until the QMgr choked and killed the connection but I'm trying to be as polite as possible to the server. The current method of supplying an ENTER from the keyboard is causing FDC dumps on each connection as it is, setting off all kinds of alarms and making the Tivoli guys mad at me.

所以,最好的情况将是一个字符串或十六进制值QMGR间$ P $点作为一个优美的拒绝和关闭连接。第二个最好的例子是的任何的方法,允许这是照本宣科,我们将接受FDC文件,自动此功能的成本。

So best case would be a string or hex value the QMgr interprets as a graceful rejection and closes the connection. Second best case is any method that allows this to be scripted and we'll accept the FDC files as a cost of automating this function.

更新:2013 5月31日结果
因为我已经搬到哪里AIX这个完美的作品。该的s_client.First在脚本中运行时进行连接和管道换行符进去后立即挂断。不过,我还是想有一个Windows的解决方案。有谁知道,如果Cygwin的版本的作品,或有同样的问题?它是视窗信令/ POSIX问题? code错误?

UPDATE: 31 May 2013
I've since moved to AIX where this works perfectly. The s_client hangs up immediately after making the connection when run in a script and piping a newline into it. However, I'd still like to have a solution for Windows. Does anyone know if the Cygwin version works or has the same problem? Is it Windows signalling/POSIX issue? Code bug?

推荐答案

看来,这个问题涉及到批处理文件和openssl.exe程序之间的同步问题。我需要为了做一些测试,并报告结果您的合作。下面是一次测试的一个批次的JScript脚本混合。 JScript的部分有两个部分;第一个 WScript.Stdout.WriteLine(退出); 完全等同于回声QUIT 批处理命令。第二部分(两行)类似,但它与退出并回车键而不是通过STDOUT发送字符串加载键盘缓冲区。

It seems that this problem is related to a synchronization issue between the Batch file and the openssl.exe program. I need your collaboration in order to do some tests and report the result. Below is a Batch-JScript hybrid script for the first test. The JScript section have two parts; the first one WScript.Stdout.WriteLine("QUIT"); is entirely equivalent to echo QUIT Batch command. The second part (with two lines) is similar, but it load the keyboard buffer with "QUIT" and an Enter key instead of send the string via STDOUT.

我要你做一个测试用的JScript code的两部分并将结果报告(双斜线 // 标记行的其余部分作为注释)。如果我们幸运的话, openssl.exe 项目将与的SendKeys 方法结束;如果没有,请通过 STDOUT 来发送一个退出的字符串,然后键入只是一个与的SendKeys Enter键。如果 openssl.exe 程序返回所需的信息,那么问题就解决了​​几乎之前终止,因为在这种情况下,我们可以同步回车键,直到所需信息已经发送从已收到openssl.exe

I need you to make a test with both sections of the JScript code and report the result (the double-slash // mark the rest of the line as comment). If we are lucky, the openssl.exe program will end with the Sendkeys method; if not, try to send a "QUIT" string via STDOUT and type just an Enter key with Sendkeys. If the openssl.exe program terminate before returning the desired information then the problem is almost solved, because in this case we can synchronize the sending of the Enter key until the desired information had been received from openssl.exe.

将以下保存为一个的.bat 文件。试试吧,然后注释掉的WScript 行,取消对的WshShell 线,然后再次尝试。

Save the following as a .bat file. Try it, then comment out the Wscript line, uncomment the WshShell lines, and then try it again.

@if (@CodeSection == @Batch) @then

:: The first line above is...
:: in Batch: a valid IF command that does nothing.
:: in JScript: a conditional compilation IF statemente that is false,
::             so this section is omitted until next "arroba-end".

@echo off
CScript //nologo //E:JScript "%~F0" | openssl s_client -connect qmgrhost:1414 -showcerts 
goto :EOF


@end


// JScript section

WScript.Stdout.WriteLine("QUIT");

// var WshShell = WScript.CreateObject("WScript.Shell");
// WshShell.SendKeys("QUIT{ENTER}");

您也可以尝试用 String.fromChar code(26)来生成一个按Ctrl-Z(EOF)字符,无论是在的WriteLine 的SendKeys 办法;例如:

You may also try with String.fromCharCode(26) to generate a Ctrl-Z (EOF) character, both in WriteLine or Sendkeys methods; for example:

WshShell.SendKeys("QUIT{ENTER}" + String.fromCharCode(26));

这篇关于OpenSSL的的GnuWin32康涅狄格州的s​​_client.First在EOF WebSphere MQ服务器不关闭,挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆