diff --git a/usr/lib/python3.6/vmmgr/vmmgr.py b/usr/lib/python3.6/vmmgr/vmmgr.py index 7176d02..c75a008 100644 --- a/usr/lib/python3.6/vmmgr/vmmgr.py +++ b/usr/lib/python3.6/vmmgr/vmmgr.py @@ -86,7 +86,9 @@ class VMMgr: def update_password(self, oldpassword, newpassword): # Update LUKS password and adminpwd for WSGI application pwinput = '{}\n{}'.format(oldpassword, newpassword).encode() - subprocess.run(['cryptsetup', 'luksChangeKey', '/dev/sda2'], input=pwinput, check=True) + partition_uuid = open('/etc/crypttab').read().split()[1][5:] + partition_name = subprocess.run(['/sbin/blkid', '-U', partition_uuid], check=True, stdout=subprocess.PIPE).stdout.decode().strip() + subprocess.run(['cryptsetup', 'luksChangeKey', partition_name], input=pwinput, check=True) # Update bcrypt-hashed password in config self.conf['host']['adminpwd'] = crypto.adminpwd_hash(newpassword) # Save config to file