source: trunk/packages/invirt-vnc-client/debian/invirt-update-vnc-cert @ 1893

Last change on this file since 1893 was 1588, checked in by broder, 16 years ago

Don't alter the original VNC JAR - make a copy instead

  • Property svn:executable set to *
File size: 994 bytes
RevLine 
[1413]1#!/usr/bin/python
[1336]2
[1413]3from invirt.config import structs as config
4from subprocess import Popen, call, PIPE
5import tempfile
6import os
7import sys
8import shutil
[1336]9
[1413]10def main():
[1418]11    call(['kinit', '-k', 'daemon/%s' % config.web.hostname])
[1413]12   
[1588]13    shutil.copy('/usr/share/invirt-vnc-client/VncViewer.src.jar',
14                '/usr/share/invirt-vnc-client/VncViewer.jar')
15   
[1413]16    temp_dir = tempfile.mkdtemp()
17    keystore = os.path.join(temp_dir, 'trust.store')
18    for host in config.hosts:
[1418]19        cert = Popen(['remctl', config.remote.hostname, 'web', 'vnccert', host.hostname],
20                     stdout=PIPE)
[1413]21        cert.wait()
[1418]22        call(['keytool', '-import', '-noprompt', '-alias', host.hostname,
23              '-keystore', keystore, '-storepass', 'foobar'],
24             stdin=cert.stdout)
[1413]25   
[1418]26    call(['jar', 'uf', '/usr/share/invirt-vnc-client/VncViewer.jar',
27          '-C', temp_dir, 'trust.store'])
[1413]28   
29    shutil.rmtree(temp_dir)
[1336]30
[1413]31if __name__ == '__main__':
32    sys.exit(main())
Note: See TracBrowser for help on using the repository browser.