FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 03-16-2009, 11:42 PM
David Cantrell
 
Default Do not create a LUKSDevice if we do not have a way to map the device.

On 03/16/2009 12:53 PM, David Lehman wrote:

If the user elects not to provide a passphrase or key, do not create
a LUKSDevice. We will just keep the backing device with its luks
format. This saves us the trouble of checking whether we have the
ability to set up each LUKSDevice since we only have LUKSDevice
instances for those we can set up.


So if the user checks the encryption checkbox, but leaves the passphrase
field blank, we proceed with a non-encrypted install?


I'm not sure I understand the need for this. If the user fails to enter
a passphrase, we should still create an encrypted volume but just has an
empty passphrase (perhaps we can tell the user that's stupid during
installation).



---
iw/partition_dialog_gui.py | 17 +++++++++++++----
iw/partition_gui.py | 24 ++++++++++++++++++------
iw/raid_dialog_gui.py | 34 +++++++++++++++++++++++++---------
storage/devicetree.py | 4 +++-
4 files changed, 59 insertions(+), 20 deletions(-)

diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index 8021616..5abbd51 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -180,11 +180,15 @@ class PartitionEditor:
elif self.lukscb and not self.lukscb.get_active() and
self.origrequest.format.type == "luks":
# destroy the luks format and the mapped device
- luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
- if luksdev:
+ try:
+ luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
+ except IndexError:
+ pass
+ else:
actions.append(ActionDestroyFormat(luksdev))
actions.append(ActionDestroyDevice(luksdev))
luksdev = None
+
actions.append(ActionDestroyFormat(request))

if self.isNew:
@@ -282,8 +286,13 @@ class PartitionEditor:
# if this is a luks device we need to grab info from two devices
# to make it seem like one device. wee!
if self.origrequest.format.type == "luks":
- luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
- usereq = luksdev
+ try:
+ luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
+ except IndexError:
+ usereq = self.origrequest
+ luksdev = None
+ else:
+ usereq = luksdev
else:
luksdev = None
usereq = self.origrequest
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index c7097b0..668530c 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -697,8 +697,12 @@ class PartitionWindow(InstallWindow):
if lv.format.type == "luks":
# we'll want to grab format info from the mapped
# device, not the encrypted one
- dm_dev = self.storage.devicetree.getChildren(lv)[0]
- format = dm_dev.format
+ try:
+ dm_dev = self.storage.devicetree.getChildren(lv)[0]
+ except IndexError:
+ format = lv.format
+ else:
+ format = dm_dev.format
else:
format = lv.format
iter = self.tree.append(vgparent)
@@ -732,8 +736,12 @@ class PartitionWindow(InstallWindow):
if array.format.type == "luks":
# look up the mapped/decrypted device since that's
# where we'll find the format we want to display
- dm_dev = self.storage.getChildren(array)[0]
- format = dm_dev.format
+ try:
+ dm_dev = self.storage.getChildren(array)[0]
+ except IndexError:
+ format = array.format
+ else:
+ format = dm_dev.format
else:
format = array.format

@@ -840,8 +848,12 @@ class PartitionWindow(InstallWindow):
if device and device.format.type == "luks":
# look up the mapped/decrypted device in the tree
# the format we care about will be on it
- dm_dev = self.storage.devicetree.getChildren(device)[0]
- format = dm_dev.format
+ try:
+ dm_dev = self.storage.devicetree.getChildren(device)[0]
+ except IndexError:
+ format = device.format
+ else:
+ format = dm_dev.format
elif device:
format = device.format
else:
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 3ae2f6e..cab2bb0 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -187,13 +187,16 @@ class RaidEditor:
not self.fsoptionsDict["lukscb"].get_active() and
self.origrequest.format.type == "luks":
# destroy luks format and mapped device
- luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
- if luksdev:
+ try:
+ luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
+ except IndexError:
+ pass
+ else:
actions.append(ActionDestroyFormat(luksdev.format) )
actions.append(ActionDestroyDevice(luksdev))
luksdev = None
- actions.append(ActionDestroyFormat(self.origreques t))

+ actions.append(ActionDestroyFormat(self.origreques t))
else:
# existing device
fmt_class = self.fsoptionsDict["fstypeCombo"].get_active_value()
@@ -214,11 +217,15 @@ class RaidEditor:
not self.fsoptionsDict["lukscb"].get_active() and
self.origrequest.format.type == "luks":
# destroy luks format and mapped device
- luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
- if luksdev:
+ try:
+ luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
+ except IndexError:
+ pass
+ else:
actions.append(ActionDestroyFormat(luksdev.format) )
actions.append(ActionDestroyDevice(luksdev))
luksdev = None
+
actions.append(ActionDestroyFormat(self.origreques t))
elif self.origrequest.format.mountable:
self.origrequest.format.mountpoint = mountpoint
@@ -226,7 +233,10 @@ class RaidEditor:
if self.fsoptionsDict.has_key("migratecb") and
self.fsoptionsDict["migratecb"].get_active():
if origrequest.format.type == "luks":
- usedev = self.storage.devicetree.getChildren(origrequest)[0]
+ try:
+ usedev = self.storage.devicetree.getChildren(origrequest)[0]
+ except IndexError:
+ usedev = origrequest
else:
usedev = origrequest
migrate = True
@@ -332,9 +342,15 @@ class RaidEditor:
self.lukscb.set_data("formatstate", 1)

if origrequest.format.type == "luks":
- luksdev = self.storage.devicetree.getChildren(origrequest)[0]
- usedev = luksdev
- format = usedev.format
+ try:
+ luksdev = self.storage.devicetree.getChildren(origrequest)[0]
+ except IndexError:
+ luksdev = None
+ usedev = origrequest
+ format = origrequest.format
+ else:
+ usedev = luksdev
+ format = usedev.format
else:
luksdev = None
usedev = origrequest
diff --git a/storage/devicetree.py b/storage/devicetree.py
index f1e056d..80ff07e 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1112,12 +1112,14 @@ class DeviceTree(object):
luks_device = LUKSDevice(device.format.mapName,
parents=[device],
exists=True)
- self._addDevice(luks_device)
try:
luks_device.setup()
except (LUKSError, CryptoError, DeviceError) as e:
log.info("setup of %s failed: %s" % (format.mapName,
e))
+ device.removeChild()
+ else:
+ self._addDevice(luks_device)
else:
log.warning("luks device %s already in the tree"
% format.mapName)



--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-16-2009, 11:45 PM
David Lehman
 
Default Do not create a LUKSDevice if we do not have a way to map the device.

On Mon, 2009-03-16 at 14:42 -1000, David Cantrell wrote:
> On 03/16/2009 12:53 PM, David Lehman wrote:
> > If the user elects not to provide a passphrase or key, do not create
> > a LUKSDevice. We will just keep the backing device with its luks
> > format. This saves us the trouble of checking whether we have the
> > ability to set up each LUKSDevice since we only have LUKSDevice
> > instances for those we can set up.
>
> So if the user checks the encryption checkbox, but leaves the passphrase
> field blank, we proceed with a non-encrypted install?

No. This is just for when users hit the "Reset" button in the
partitioning screen. Say they made some devices marked as encrypted,
then clicked "next", entered a passphrase, then clicked 'back' at the
'about to activate filesystems' dialog, then clicked 'Reset' in the
partitioning screen. I think we want to reset the global passphrase in
this case.

Dave

>
> I'm not sure I understand the need for this. If the user fails to enter
> a passphrase, we should still create an encrypted volume but just has an
> empty passphrase (perhaps we can tell the user that's stupid during
> installation).
>
> > ---
> > iw/partition_dialog_gui.py | 17 +++++++++++++----
> > iw/partition_gui.py | 24 ++++++++++++++++++------
> > iw/raid_dialog_gui.py | 34 +++++++++++++++++++++++++---------
> > storage/devicetree.py | 4 +++-
> > 4 files changed, 59 insertions(+), 20 deletions(-)
> >
> > diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
> > index 8021616..5abbd51 100644
> > --- a/iw/partition_dialog_gui.py
> > +++ b/iw/partition_dialog_gui.py
> > @@ -180,11 +180,15 @@ class PartitionEditor:
> > elif self.lukscb and not self.lukscb.get_active() and
> > self.origrequest.format.type == "luks":
> > # destroy the luks format and the mapped device
> > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > - if luksdev:
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > + except IndexError:
> > + pass
> > + else:
> > actions.append(ActionDestroyFormat(luksdev))
> > actions.append(ActionDestroyDevice(luksdev))
> > luksdev = None
> > +
> > actions.append(ActionDestroyFormat(request))
> >
> > if self.isNew:
> > @@ -282,8 +286,13 @@ class PartitionEditor:
> > # if this is a luks device we need to grab info from two devices
> > # to make it seem like one device. wee!
> > if self.origrequest.format.type == "luks":
> > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > - usereq = luksdev
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > + except IndexError:
> > + usereq = self.origrequest
> > + luksdev = None
> > + else:
> > + usereq = luksdev
> > else:
> > luksdev = None
> > usereq = self.origrequest
> > diff --git a/iw/partition_gui.py b/iw/partition_gui.py
> > index c7097b0..668530c 100644
> > --- a/iw/partition_gui.py
> > +++ b/iw/partition_gui.py
> > @@ -697,8 +697,12 @@ class PartitionWindow(InstallWindow):
> > if lv.format.type == "luks":
> > # we'll want to grab format info from the mapped
> > # device, not the encrypted one
> > - dm_dev = self.storage.devicetree.getChildren(lv)[0]
> > - format = dm_dev.format
> > + try:
> > + dm_dev = self.storage.devicetree.getChildren(lv)[0]
> > + except IndexError:
> > + format = lv.format
> > + else:
> > + format = dm_dev.format
> > else:
> > format = lv.format
> > iter = self.tree.append(vgparent)
> > @@ -732,8 +736,12 @@ class PartitionWindow(InstallWindow):
> > if array.format.type == "luks":
> > # look up the mapped/decrypted device since that's
> > # where we'll find the format we want to display
> > - dm_dev = self.storage.getChildren(array)[0]
> > - format = dm_dev.format
> > + try:
> > + dm_dev = self.storage.getChildren(array)[0]
> > + except IndexError:
> > + format = array.format
> > + else:
> > + format = dm_dev.format
> > else:
> > format = array.format
> >
> > @@ -840,8 +848,12 @@ class PartitionWindow(InstallWindow):
> > if device and device.format.type == "luks":
> > # look up the mapped/decrypted device in the tree
> > # the format we care about will be on it
> > - dm_dev = self.storage.devicetree.getChildren(device)[0]
> > - format = dm_dev.format
> > + try:
> > + dm_dev = self.storage.devicetree.getChildren(device)[0]
> > + except IndexError:
> > + format = device.format
> > + else:
> > + format = dm_dev.format
> > elif device:
> > format = device.format
> > else:
> > diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
> > index 3ae2f6e..cab2bb0 100644
> > --- a/iw/raid_dialog_gui.py
> > +++ b/iw/raid_dialog_gui.py
> > @@ -187,13 +187,16 @@ class RaidEditor:
> > not self.fsoptionsDict["lukscb"].get_active() and
> > self.origrequest.format.type == "luks":
> > # destroy luks format and mapped device
> > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > - if luksdev:
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > + except IndexError:
> > + pass
> > + else:
> > actions.append(ActionDestroyFormat(luksdev.format) )
> > actions.append(ActionDestroyDevice(luksdev))
> > luksdev = None
> > - actions.append(ActionDestroyFormat(self.origreques t))
> >
> > + actions.append(ActionDestroyFormat(self.origreques t))
> > else:
> > # existing device
> > fmt_class = self.fsoptionsDict["fstypeCombo"].get_active_value()
> > @@ -214,11 +217,15 @@ class RaidEditor:
> > not self.fsoptionsDict["lukscb"].get_active() and
> > self.origrequest.format.type == "luks":
> > # destroy luks format and mapped device
> > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > - if luksdev:
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > + except IndexError:
> > + pass
> > + else:
> > actions.append(ActionDestroyFormat(luksdev.format) )
> > actions.append(ActionDestroyDevice(luksdev))
> > luksdev = None
> > +
> > actions.append(ActionDestroyFormat(self.origreques t))
> > elif self.origrequest.format.mountable:
> > self.origrequest.format.mountpoint = mountpoint
> > @@ -226,7 +233,10 @@ class RaidEditor:
> > if self.fsoptionsDict.has_key("migratecb") and
> > self.fsoptionsDict["migratecb"].get_active():
> > if origrequest.format.type == "luks":
> > - usedev = self.storage.devicetree.getChildren(origrequest)[0]
> > + try:
> > + usedev = self.storage.devicetree.getChildren(origrequest)[0]
> > + except IndexError:
> > + usedev = origrequest
> > else:
> > usedev = origrequest
> > migrate = True
> > @@ -332,9 +342,15 @@ class RaidEditor:
> > self.lukscb.set_data("formatstate", 1)
> >
> > if origrequest.format.type == "luks":
> > - luksdev = self.storage.devicetree.getChildren(origrequest)[0]
> > - usedev = luksdev
> > - format = usedev.format
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(origrequest)[0]
> > + except IndexError:
> > + luksdev = None
> > + usedev = origrequest
> > + format = origrequest.format
> > + else:
> > + usedev = luksdev
> > + format = usedev.format
> > else:
> > luksdev = None
> > usedev = origrequest
> > diff --git a/storage/devicetree.py b/storage/devicetree.py
> > index f1e056d..80ff07e 100644
> > --- a/storage/devicetree.py
> > +++ b/storage/devicetree.py
> > @@ -1112,12 +1112,14 @@ class DeviceTree(object):
> > luks_device = LUKSDevice(device.format.mapName,
> > parents=[device],
> > exists=True)
> > - self._addDevice(luks_device)
> > try:
> > luks_device.setup()
> > except (LUKSError, CryptoError, DeviceError) as e:
> > log.info("setup of %s failed: %s" % (format.mapName,
> > e))
> > + device.removeChild()
> > + else:
> > + self._addDevice(luks_device)
> > else:
> > log.warning("luks device %s already in the tree"
> > % format.mapName)
>
>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-16-2009, 11:49 PM
David Lehman
 
Default Do not create a LUKSDevice if we do not have a way to map the device.

Sorry about the previous response. I confused myself as to which patch
you were inquiring after.

On Mon, 2009-03-16 at 14:42 -1000, David Cantrell wrote:
> On 03/16/2009 12:53 PM, David Lehman wrote:
> > If the user elects not to provide a passphrase or key, do not create
> > a LUKSDevice. We will just keep the backing device with its luks
> > format. This saves us the trouble of checking whether we have the
> > ability to set up each LUKSDevice since we only have LUKSDevice
> > instances for those we can set up.
>
> So if the user checks the encryption checkbox, but leaves the passphrase
> field blank, we proceed with a non-encrypted install?

No, this is the case where there are preexisting encrypted devices but
the user does not provide us with a passphrase to see what's in them. We
still have the encrypted device, but we don't create a device to
represent the mapped/decrypted device.

We don't allow passphrases for new devices to be less then 8 characters,
so them specifying a blank passphrase for a new device is a non-issue.

Dave

>
> I'm not sure I understand the need for this. If the user fails to enter
> a passphrase, we should still create an encrypted volume but just has an
> empty passphrase (perhaps we can tell the user that's stupid during
> installation).
>
> > ---
> > iw/partition_dialog_gui.py | 17 +++++++++++++----
> > iw/partition_gui.py | 24 ++++++++++++++++++------
> > iw/raid_dialog_gui.py | 34 +++++++++++++++++++++++++---------
> > storage/devicetree.py | 4 +++-
> > 4 files changed, 59 insertions(+), 20 deletions(-)
> >
> > diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
> > index 8021616..5abbd51 100644
> > --- a/iw/partition_dialog_gui.py
> > +++ b/iw/partition_dialog_gui.py
> > @@ -180,11 +180,15 @@ class PartitionEditor:
> > elif self.lukscb and not self.lukscb.get_active() and
> > self.origrequest.format.type == "luks":
> > # destroy the luks format and the mapped device
> > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > - if luksdev:
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > + except IndexError:
> > + pass
> > + else:
> > actions.append(ActionDestroyFormat(luksdev))
> > actions.append(ActionDestroyDevice(luksdev))
> > luksdev = None
> > +
> > actions.append(ActionDestroyFormat(request))
> >
> > if self.isNew:
> > @@ -282,8 +286,13 @@ class PartitionEditor:
> > # if this is a luks device we need to grab info from two devices
> > # to make it seem like one device. wee!
> > if self.origrequest.format.type == "luks":
> > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > - usereq = luksdev
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > + except IndexError:
> > + usereq = self.origrequest
> > + luksdev = None
> > + else:
> > + usereq = luksdev
> > else:
> > luksdev = None
> > usereq = self.origrequest
> > diff --git a/iw/partition_gui.py b/iw/partition_gui.py
> > index c7097b0..668530c 100644
> > --- a/iw/partition_gui.py
> > +++ b/iw/partition_gui.py
> > @@ -697,8 +697,12 @@ class PartitionWindow(InstallWindow):
> > if lv.format.type == "luks":
> > # we'll want to grab format info from the mapped
> > # device, not the encrypted one
> > - dm_dev = self.storage.devicetree.getChildren(lv)[0]
> > - format = dm_dev.format
> > + try:
> > + dm_dev = self.storage.devicetree.getChildren(lv)[0]
> > + except IndexError:
> > + format = lv.format
> > + else:
> > + format = dm_dev.format
> > else:
> > format = lv.format
> > iter = self.tree.append(vgparent)
> > @@ -732,8 +736,12 @@ class PartitionWindow(InstallWindow):
> > if array.format.type == "luks":
> > # look up the mapped/decrypted device since that's
> > # where we'll find the format we want to display
> > - dm_dev = self.storage.getChildren(array)[0]
> > - format = dm_dev.format
> > + try:
> > + dm_dev = self.storage.getChildren(array)[0]
> > + except IndexError:
> > + format = array.format
> > + else:
> > + format = dm_dev.format
> > else:
> > format = array.format
> >
> > @@ -840,8 +848,12 @@ class PartitionWindow(InstallWindow):
> > if device and device.format.type == "luks":
> > # look up the mapped/decrypted device in the tree
> > # the format we care about will be on it
> > - dm_dev = self.storage.devicetree.getChildren(device)[0]
> > - format = dm_dev.format
> > + try:
> > + dm_dev = self.storage.devicetree.getChildren(device)[0]
> > + except IndexError:
> > + format = device.format
> > + else:
> > + format = dm_dev.format
> > elif device:
> > format = device.format
> > else:
> > diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
> > index 3ae2f6e..cab2bb0 100644
> > --- a/iw/raid_dialog_gui.py
> > +++ b/iw/raid_dialog_gui.py
> > @@ -187,13 +187,16 @@ class RaidEditor:
> > not self.fsoptionsDict["lukscb"].get_active() and
> > self.origrequest.format.type == "luks":
> > # destroy luks format and mapped device
> > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > - if luksdev:
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > + except IndexError:
> > + pass
> > + else:
> > actions.append(ActionDestroyFormat(luksdev.format) )
> > actions.append(ActionDestroyDevice(luksdev))
> > luksdev = None
> > - actions.append(ActionDestroyFormat(self.origreques t))
> >
> > + actions.append(ActionDestroyFormat(self.origreques t))
> > else:
> > # existing device
> > fmt_class = self.fsoptionsDict["fstypeCombo"].get_active_value()
> > @@ -214,11 +217,15 @@ class RaidEditor:
> > not self.fsoptionsDict["lukscb"].get_active() and
> > self.origrequest.format.type == "luks":
> > # destroy luks format and mapped device
> > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > - if luksdev:
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > + except IndexError:
> > + pass
> > + else:
> > actions.append(ActionDestroyFormat(luksdev.format) )
> > actions.append(ActionDestroyDevice(luksdev))
> > luksdev = None
> > +
> > actions.append(ActionDestroyFormat(self.origreques t))
> > elif self.origrequest.format.mountable:
> > self.origrequest.format.mountpoint = mountpoint
> > @@ -226,7 +233,10 @@ class RaidEditor:
> > if self.fsoptionsDict.has_key("migratecb") and
> > self.fsoptionsDict["migratecb"].get_active():
> > if origrequest.format.type == "luks":
> > - usedev = self.storage.devicetree.getChildren(origrequest)[0]
> > + try:
> > + usedev = self.storage.devicetree.getChildren(origrequest)[0]
> > + except IndexError:
> > + usedev = origrequest
> > else:
> > usedev = origrequest
> > migrate = True
> > @@ -332,9 +342,15 @@ class RaidEditor:
> > self.lukscb.set_data("formatstate", 1)
> >
> > if origrequest.format.type == "luks":
> > - luksdev = self.storage.devicetree.getChildren(origrequest)[0]
> > - usedev = luksdev
> > - format = usedev.format
> > + try:
> > + luksdev = self.storage.devicetree.getChildren(origrequest)[0]
> > + except IndexError:
> > + luksdev = None
> > + usedev = origrequest
> > + format = origrequest.format
> > + else:
> > + usedev = luksdev
> > + format = usedev.format
> > else:
> > luksdev = None
> > usedev = origrequest
> > diff --git a/storage/devicetree.py b/storage/devicetree.py
> > index f1e056d..80ff07e 100644
> > --- a/storage/devicetree.py
> > +++ b/storage/devicetree.py
> > @@ -1112,12 +1112,14 @@ class DeviceTree(object):
> > luks_device = LUKSDevice(device.format.mapName,
> > parents=[device],
> > exists=True)
> > - self._addDevice(luks_device)
> > try:
> > luks_device.setup()
> > except (LUKSError, CryptoError, DeviceError) as e:
> > log.info("setup of %s failed: %s" % (format.mapName,
> > e))
> > + device.removeChild()
> > + else:
> > + self._addDevice(luks_device)
> > else:
> > log.warning("luks device %s already in the tree"
> > % format.mapName)
>
>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-16-2009, 11:50 PM
David Lehman
 
Default Do not create a LUKSDevice if we do not have a way to map the device.

Please ignore the message this is in direct response to. I made a
mistake.

Dave

On Mon, 2009-03-16 at 19:45 -0500, David Lehman wrote:
> On Mon, 2009-03-16 at 14:42 -1000, David Cantrell wrote:
> > On 03/16/2009 12:53 PM, David Lehman wrote:
> > > If the user elects not to provide a passphrase or key, do not create
> > > a LUKSDevice. We will just keep the backing device with its luks
> > > format. This saves us the trouble of checking whether we have the
> > > ability to set up each LUKSDevice since we only have LUKSDevice
> > > instances for those we can set up.
> >
> > So if the user checks the encryption checkbox, but leaves the passphrase
> > field blank, we proceed with a non-encrypted install?
>
> No. This is just for when users hit the "Reset" button in the
> partitioning screen. Say they made some devices marked as encrypted,
> then clicked "next", entered a passphrase, then clicked 'back' at the
> 'about to activate filesystems' dialog, then clicked 'Reset' in the
> partitioning screen. I think we want to reset the global passphrase in
> this case.
>
> Dave
>
> >
> > I'm not sure I understand the need for this. If the user fails to enter
> > a passphrase, we should still create an encrypted volume but just has an
> > empty passphrase (perhaps we can tell the user that's stupid during
> > installation).
> >
> > > ---
> > > iw/partition_dialog_gui.py | 17 +++++++++++++----
> > > iw/partition_gui.py | 24 ++++++++++++++++++------
> > > iw/raid_dialog_gui.py | 34 +++++++++++++++++++++++++---------
> > > storage/devicetree.py | 4 +++-
> > > 4 files changed, 59 insertions(+), 20 deletions(-)
> > >
> > > diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
> > > index 8021616..5abbd51 100644
> > > --- a/iw/partition_dialog_gui.py
> > > +++ b/iw/partition_dialog_gui.py
> > > @@ -180,11 +180,15 @@ class PartitionEditor:
> > > elif self.lukscb and not self.lukscb.get_active() and
> > > self.origrequest.format.type == "luks":
> > > # destroy the luks format and the mapped device
> > > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > > - if luksdev:
> > > + try:
> > > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > > + except IndexError:
> > > + pass
> > > + else:
> > > actions.append(ActionDestroyFormat(luksdev))
> > > actions.append(ActionDestroyDevice(luksdev))
> > > luksdev = None
> > > +
> > > actions.append(ActionDestroyFormat(request))
> > >
> > > if self.isNew:
> > > @@ -282,8 +286,13 @@ class PartitionEditor:
> > > # if this is a luks device we need to grab info from two devices
> > > # to make it seem like one device. wee!
> > > if self.origrequest.format.type == "luks":
> > > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > > - usereq = luksdev
> > > + try:
> > > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > > + except IndexError:
> > > + usereq = self.origrequest
> > > + luksdev = None
> > > + else:
> > > + usereq = luksdev
> > > else:
> > > luksdev = None
> > > usereq = self.origrequest
> > > diff --git a/iw/partition_gui.py b/iw/partition_gui.py
> > > index c7097b0..668530c 100644
> > > --- a/iw/partition_gui.py
> > > +++ b/iw/partition_gui.py
> > > @@ -697,8 +697,12 @@ class PartitionWindow(InstallWindow):
> > > if lv.format.type == "luks":
> > > # we'll want to grab format info from the mapped
> > > # device, not the encrypted one
> > > - dm_dev = self.storage.devicetree.getChildren(lv)[0]
> > > - format = dm_dev.format
> > > + try:
> > > + dm_dev = self.storage.devicetree.getChildren(lv)[0]
> > > + except IndexError:
> > > + format = lv.format
> > > + else:
> > > + format = dm_dev.format
> > > else:
> > > format = lv.format
> > > iter = self.tree.append(vgparent)
> > > @@ -732,8 +736,12 @@ class PartitionWindow(InstallWindow):
> > > if array.format.type == "luks":
> > > # look up the mapped/decrypted device since that's
> > > # where we'll find the format we want to display
> > > - dm_dev = self.storage.getChildren(array)[0]
> > > - format = dm_dev.format
> > > + try:
> > > + dm_dev = self.storage.getChildren(array)[0]
> > > + except IndexError:
> > > + format = array.format
> > > + else:
> > > + format = dm_dev.format
> > > else:
> > > format = array.format
> > >
> > > @@ -840,8 +848,12 @@ class PartitionWindow(InstallWindow):
> > > if device and device.format.type == "luks":
> > > # look up the mapped/decrypted device in the tree
> > > # the format we care about will be on it
> > > - dm_dev = self.storage.devicetree.getChildren(device)[0]
> > > - format = dm_dev.format
> > > + try:
> > > + dm_dev = self.storage.devicetree.getChildren(device)[0]
> > > + except IndexError:
> > > + format = device.format
> > > + else:
> > > + format = dm_dev.format
> > > elif device:
> > > format = device.format
> > > else:
> > > diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
> > > index 3ae2f6e..cab2bb0 100644
> > > --- a/iw/raid_dialog_gui.py
> > > +++ b/iw/raid_dialog_gui.py
> > > @@ -187,13 +187,16 @@ class RaidEditor:
> > > not self.fsoptionsDict["lukscb"].get_active() and
> > > self.origrequest.format.type == "luks":
> > > # destroy luks format and mapped device
> > > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > > - if luksdev:
> > > + try:
> > > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > > + except IndexError:
> > > + pass
> > > + else:
> > > actions.append(ActionDestroyFormat(luksdev.format) )
> > > actions.append(ActionDestroyDevice(luksdev))
> > > luksdev = None
> > > - actions.append(ActionDestroyFormat(self.origreques t))
> > >
> > > + actions.append(ActionDestroyFormat(self.origreques t))
> > > else:
> > > # existing device
> > > fmt_class = self.fsoptionsDict["fstypeCombo"].get_active_value()
> > > @@ -214,11 +217,15 @@ class RaidEditor:
> > > not self.fsoptionsDict["lukscb"].get_active() and
> > > self.origrequest.format.type == "luks":
> > > # destroy luks format and mapped device
> > > - luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > > - if luksdev:
> > > + try:
> > > + luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
> > > + except IndexError:
> > > + pass
> > > + else:
> > > actions.append(ActionDestroyFormat(luksdev.format) )
> > > actions.append(ActionDestroyDevice(luksdev))
> > > luksdev = None
> > > +
> > > actions.append(ActionDestroyFormat(self.origreques t))
> > > elif self.origrequest.format.mountable:
> > > self.origrequest.format.mountpoint = mountpoint
> > > @@ -226,7 +233,10 @@ class RaidEditor:
> > > if self.fsoptionsDict.has_key("migratecb") and
> > > self.fsoptionsDict["migratecb"].get_active():
> > > if origrequest.format.type == "luks":
> > > - usedev = self.storage.devicetree.getChildren(origrequest)[0]
> > > + try:
> > > + usedev = self.storage.devicetree.getChildren(origrequest)[0]
> > > + except IndexError:
> > > + usedev = origrequest
> > > else:
> > > usedev = origrequest
> > > migrate = True
> > > @@ -332,9 +342,15 @@ class RaidEditor:
> > > self.lukscb.set_data("formatstate", 1)
> > >
> > > if origrequest.format.type == "luks":
> > > - luksdev = self.storage.devicetree.getChildren(origrequest)[0]
> > > - usedev = luksdev
> > > - format = usedev.format
> > > + try:
> > > + luksdev = self.storage.devicetree.getChildren(origrequest)[0]
> > > + except IndexError:
> > > + luksdev = None
> > > + usedev = origrequest
> > > + format = origrequest.format
> > > + else:
> > > + usedev = luksdev
> > > + format = usedev.format
> > > else:
> > > luksdev = None
> > > usedev = origrequest
> > > diff --git a/storage/devicetree.py b/storage/devicetree.py
> > > index f1e056d..80ff07e 100644
> > > --- a/storage/devicetree.py
> > > +++ b/storage/devicetree.py
> > > @@ -1112,12 +1112,14 @@ class DeviceTree(object):
> > > luks_device = LUKSDevice(device.format.mapName,
> > > parents=[device],
> > > exists=True)
> > > - self._addDevice(luks_device)
> > > try:
> > > luks_device.setup()
> > > except (LUKSError, CryptoError, DeviceError) as e:
> > > log.info("setup of %s failed: %s" % (format.mapName,
> > > e))
> > > + device.removeChild()
> > > + else:
> > > + self._addDevice(luks_device)
> > > else:
> > > log.warning("luks device %s already in the tree"
> > > % format.mapName)
> >
> >
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-16-2009, 11:52 PM
David Cantrell
 
Default Do not create a LUKSDevice if we do not have a way to map the device.

On 03/16/2009 02:49 PM, David Lehman wrote:

Sorry about the previous response. I confused myself as to which patch
you were inquiring after.

On Mon, 2009-03-16 at 14:42 -1000, David Cantrell wrote:

On 03/16/2009 12:53 PM, David Lehman wrote:

If the user elects not to provide a passphrase or key, do not create
a LUKSDevice. We will just keep the backing device with its luks
format. This saves us the trouble of checking whether we have the
ability to set up each LUKSDevice since we only have LUKSDevice
instances for those we can set up.

So if the user checks the encryption checkbox, but leaves the passphrase
field blank, we proceed with a non-encrypted install?


No, this is the case where there are preexisting encrypted devices but
the user does not provide us with a passphrase to see what's in them. We
still have the encrypted device, but we don't create a device to
represent the mapped/decrypted device.

We don't allow passphrases for new devices to be less then 8 characters,
so them specifying a blank passphrase for a new device is a non-issue.


Ah, gotcha. OK, that's a sound use case to me. Ack



Dave


I'm not sure I understand the need for this. If the user fails to enter
a passphrase, we should still create an encrypted volume but just has an
empty passphrase (perhaps we can tell the user that's stupid during
installation).


---
iw/partition_dialog_gui.py | 17 +++++++++++++----
iw/partition_gui.py | 24 ++++++++++++++++++------
iw/raid_dialog_gui.py | 34 +++++++++++++++++++++++++---------
storage/devicetree.py | 4 +++-
4 files changed, 59 insertions(+), 20 deletions(-)

diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index 8021616..5abbd51 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -180,11 +180,15 @@ class PartitionEditor:
elif self.lukscb and not self.lukscb.get_active() and
self.origrequest.format.type == "luks":
# destroy the luks format and the mapped device
- luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
- if luksdev:
+ try:
+ luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
+ except IndexError:
+ pass
+ else:
actions.append(ActionDestroyFormat(luksdev))
actions.append(ActionDestroyDevice(luksdev))
luksdev = None
+
actions.append(ActionDestroyFormat(request))

if self.isNew:
@@ -282,8 +286,13 @@ class PartitionEditor:
# if this is a luks device we need to grab info from two devices
# to make it seem like one device. wee!
if self.origrequest.format.type == "luks":
- luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
- usereq = luksdev
+ try:
+ luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
+ except IndexError:
+ usereq = self.origrequest
+ luksdev = None
+ else:
+ usereq = luksdev
else:
luksdev = None
usereq = self.origrequest
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index c7097b0..668530c 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -697,8 +697,12 @@ class PartitionWindow(InstallWindow):
if lv.format.type == "luks":
# we'll want to grab format info from the mapped
# device, not the encrypted one
- dm_dev = self.storage.devicetree.getChildren(lv)[0]
- format = dm_dev.format
+ try:
+ dm_dev = self.storage.devicetree.getChildren(lv)[0]
+ except IndexError:
+ format = lv.format
+ else:
+ format = dm_dev.format
else:
format = lv.format
iter = self.tree.append(vgparent)
@@ -732,8 +736,12 @@ class PartitionWindow(InstallWindow):
if array.format.type == "luks":
# look up the mapped/decrypted device since that's
# where we'll find the format we want to display
- dm_dev = self.storage.getChildren(array)[0]
- format = dm_dev.format
+ try:
+ dm_dev = self.storage.getChildren(array)[0]
+ except IndexError:
+ format = array.format
+ else:
+ format = dm_dev.format
else:
format = array.format

@@ -840,8 +848,12 @@ class PartitionWindow(InstallWindow):
if device and device.format.type == "luks":
# look up the mapped/decrypted device in the tree
# the format we care about will be on it
- dm_dev = self.storage.devicetree.getChildren(device)[0]
- format = dm_dev.format
+ try:
+ dm_dev = self.storage.devicetree.getChildren(device)[0]
+ except IndexError:
+ format = device.format
+ else:
+ format = dm_dev.format
elif device:
format = device.format
else:
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 3ae2f6e..cab2bb0 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -187,13 +187,16 @@ class RaidEditor:
not self.fsoptionsDict["lukscb"].get_active() and
self.origrequest.format.type == "luks":
# destroy luks format and mapped device
- luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
- if luksdev:
+ try:
+ luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
+ except IndexError:
+ pass
+ else:
actions.append(ActionDestroyFormat(luksdev.format) )
actions.append(ActionDestroyDevice(luksdev))
luksdev = None
- actions.append(ActionDestroyFormat(self.origreques t))

+ actions.append(ActionDestroyFormat(self.origreques t))
else:
# existing device
fmt_class = self.fsoptionsDict["fstypeCombo"].get_active_value()
@@ -214,11 +217,15 @@ class RaidEditor:
not self.fsoptionsDict["lukscb"].get_active() and
self.origrequest.format.type == "luks":
# destroy luks format and mapped device
- luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
- if luksdev:
+ try:
+ luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
+ except IndexError:
+ pass
+ else:
actions.append(ActionDestroyFormat(luksdev.format) )
actions.append(ActionDestroyDevice(luksdev))
luksdev = None
+
actions.append(ActionDestroyFormat(self.origreques t))
elif self.origrequest.format.mountable:
self.origrequest.format.mountpoint = mountpoint
@@ -226,7 +233,10 @@ class RaidEditor:
if self.fsoptionsDict.has_key("migratecb") and
self.fsoptionsDict["migratecb"].get_active():
if origrequest.format.type == "luks":
- usedev = self.storage.devicetree.getChildren(origrequest)[0]
+ try:
+ usedev = self.storage.devicetree.getChildren(origrequest)[0]
+ except IndexError:
+ usedev = origrequest
else:
usedev = origrequest
migrate = True
@@ -332,9 +342,15 @@ class RaidEditor:
self.lukscb.set_data("formatstate", 1)

if origrequest.format.type == "luks":
- luksdev = self.storage.devicetree.getChildren(origrequest)[0]
- usedev = luksdev
- format = usedev.format
+ try:
+ luksdev = self.storage.devicetree.getChildren(origrequest)[0]
+ except IndexError:
+ luksdev = None
+ usedev = origrequest
+ format = origrequest.format
+ else:
+ usedev = luksdev
+ format = usedev.format
else:
luksdev = None
usedev = origrequest
diff --git a/storage/devicetree.py b/storage/devicetree.py
index f1e056d..80ff07e 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1112,12 +1112,14 @@ class DeviceTree(object):
luks_device = LUKSDevice(device.format.mapName,
parents=[device],
exists=True)
- self._addDevice(luks_device)
try:
luks_device.setup()
except (LUKSError, CryptoError, DeviceError) as e:
log.info("setup of %s failed: %s" % (format.mapName,
e))
+ device.removeChild()
+ else:
+ self._addDevice(luks_device)
else:
log.warning("luks device %s already in the tree"
% format.mapName)




_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list



--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 02:36 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org