python交互式脚本
用于es生成ssl认证证书:安装pexpect,ptyprocess模块编写脚本使用pexpect[root@master bin]# vim python.sh#!/usr/bin/env pythonimport pexpectdef main():c1 = pexpect.spawn('./elasticsearch-certutil ca')c1....
用于es生成ssl认证证书:
安装pexpect,ptyprocess模块
编写脚本使用pexpect
[root@master bin]# vim python.sh
#!/usr/bin/env python
import pexpect
def main():
c1 = pexpect.spawn('./elasticsearch-certutil ca')
c1.expect('output file')
c1.sendline()
c1.expect('password')
c1.sendline()
c1.expect(pexpect.EOF)
#print(c1.before)
c2 = pexpect.spawn('./elasticsearch-certutil cert --ca elastic-stack-ca.p12')
c2.expect('password for CA')
c2.sendline()
c2.expect('output file')
c2.sendline()
c2.expect('password for elastic')
c2.sendline()
c2.expect(pexpect.EOF)
#print(c2.before)
if __name__ == '__main__':
main()
更多推荐
所有评论(0)