1 | initial version |
Hello,
If you have followed the tutorial you will have two files:
You will need a private key file you can obtain by running this command::
openssl pkcs12 -in key.pfx -out private_key.pem -nodes
This is an example Python code to authenticate using a certificate:
from winrm.protocol import Protocol
p = Protocol( endpoint='https://<ip>:5986/wsman', transport='ssl', username='Admin', certpem='key.pem', certkeypem='privatekey.pem')
shellid = p.openshell()
commandid = p.runcommand(shell_id, 'ipconfig', ['/all'])
stdout, stderr, statuscode = p.getcommandoutput(shellid, command_id)
p.cleanupcommand(shellid, command_id)
p.closeshell(shellid)
print(std_out)
The certificate authentication support has been included in pywinrm with this commit: https://github.com/diyan/pywinrm/commit/3536b6712a4e478621c688017622bcd359e97806
Make sure you have the pywinrm version which contains this patch.
Hope it helps.
2 | No.2 Revision |
Hello,
If you have followed the tutorial you will have two files:
You will need a private key file you can obtain by running this command::command:
openssl pkcs12 -in key.pfx -out private_key.pem -nodes
This is an example Python code to authenticate using a certificate:certificate: http://paste.openstack.org/show/197184/
from winrm.protocol import Protocol
p = Protocol( endpoint='https://<ip>:5986/wsman', transport='ssl', username='Admin', certpem='key.pem', certkeypem='privatekey.pem')
shellid = p.openshell()
commandid = p.runcommand(shell_id, 'ipconfig', ['/all'])
stdout, stderr, statuscode = p.getcommandoutput(shellid, command_id)
p.cleanupcommand(shellid, command_id)
p.closeshell(shellid)
print(std_out)
The certificate authentication support has been included in pywinrm with this commit: https://github.com/diyan/pywinrm/commit/3536b6712a4e478621c688017622bcd359e97806
Make sure you have the pywinrm version which contains this patch.
Hope it helps.