对于我正在使用的服务器技术,可以通过运行一些命令行参数手动将服务器加入集合。在某一时刻,控制台会提示您是否要接受证书链,并输入(y/n)
并且该命令一直运行。我试图自动化这个过程,但是我在响应输入提示时碰到了一个障碍,并且在四处探听之后听说它可能是一个SSL事件,所以我不知道是否有不同的方式来做到这一点。如何获取控制台输入以在bash脚本中使用SSL?
如果你做手工,这是它的外观:
Joining the collective with target controller ...this may take a while
SSL trust has not been established with the target server
//certificate chain
Do you want to accept the above certificate chain? (y/n)
然而,既:
echo "y y" | bash ./script.sh
//inside script.sh
echo "y y" | $(command)
结束了这种反应:
Joining the collective with target controller ...this may take a while
SSL trust has not been established with the target server
//certificate chain
Input console is not available
Aborting join collective.
Error:
Unable to complete the MBean operation
Error: java.securit.cert.CertificateException: User has rejected the request to trust the
certificate chain
我希望有人或许能够通过手动回应的方式来做到这一点
我看,我假设有这样做,则没有原生的方式?我的限制相当严格,我必须编写一个脚本,可以在“开箱即用”的机器上运行,谢谢你的解释,尽管 – sreya 2014-09-10 18:51:09
不幸的是,没有。没有很好的,相对便携的使用我知道的纯bash使用ptys。 – nneonneo 2014-09-10 18:53:20
或者远程命令可能不期望一个真正的终端,但你的SSH不分配tty。您可以使用选项“-t”强制执行伪tty分配 – mcoolive 2014-09-10 23:15:06