From f6729b496803f0437c22731ffd15547f9427bee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 20 Sep 2013 04:02:14 +0200 Subject: [PATCH] wni: use generated password --- core/storage/wni.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/storage/wni.py b/core/storage/wni.py index 8372f5ca..4a093895 100644 --- a/core/storage/wni.py +++ b/core/storage/wni.py @@ -28,6 +28,7 @@ import os.path import win32api import win32net import pywintypes +import md5 from qubes.storage import QubesVmStorage from qubes.qubes import QubesException,system_path @@ -46,18 +47,27 @@ class QubesWniVmStorage(QubesVmStorage): os.putenv("WNI_DRIVER_QUBESDB_PATH", system_path['qubesdb_daemon_path']) os.putenv("WNI_DRIVER_QREXEC_PATH", system_path['qrexec_agent_path']) + def _get_secret(self): + # TODO: some machine-specific secret (accessible only to Administrator) + return "" + def _get_username(self, vmname = None): if vmname is None: vmname = self.vm.name return "qubes-vm-%s" % vmname + def _get_password(self, vmname = None): + if vmname is None: + vmname = self.vm.name + return md5.md5("%s-%s" % (vmname, self._get_secret())).hexdigest() + def get_config_params(self): return {} def create_on_disk_private_img(self, verbose, source_template = None): win32api.ShellExecute(None, "runas", "net", "user %s %s /ADD" - % (self._get_username(), "testpass"), + % (self._get_username(), self._get_password()), None, 0) def create_on_disk_root_img(self, verbose, source_template = None): @@ -75,6 +85,7 @@ class QubesWniVmStorage(QubesVmStorage): "wmic", "useraccount where name='%s' rename '%s'" % (self._get_username(old_name), self._get_username(new_name)), None, 0) + # TODO: update password def verify_files(self):