add (possible) config partition to 'partition' plugin

This commit is contained in:
lars 2006-09-20 10:40:37 +00:00
parent 1c8db28989
commit 3cc64e84f3
9 changed files with 257 additions and 48 deletions

View file

@ -100,7 +100,6 @@ class CryptoBox:
self.log.info(string)
# RFC: why should CryptoBoxProps inherit CryptoBox? [l]
# RFC: shouldn't we move all useful functions of CryptoBoxProps to CryptoBox? [l]
class CryptoBoxProps(CryptoBox):
@ -119,12 +118,27 @@ class CryptoBoxProps(CryptoBox):
def reReadContainerList(self):
self.containers = []
for device in CryptoBoxTools.getAvailablePartitions():
if self.isDeviceAllowed(device):
if self.isDeviceAllowed(device) and not self.isConfigPartition(device):
self.containers.append(CryptoBoxContainer.CryptoBoxContainer(device, self))
## sort by container name
self.containers.sort(cmp = lambda x,y: x.getName() < y.getName() and -1 or 1)
def isConfigPartition(self, device):
import subprocess
proc = subprocess.Popen(
shell = False,
stdout = subprocess.PIPE,
args = [
self.prefs["Programs"]["blkid"],
"-c", os.path.devnull,
"-o", "value",
"-s", "LABEL",
device])
(output, error) = proc.communicate()
return output.strip() == self.prefs["Main"]["ConfigVolumeLabel"]
def isDeviceAllowed(self, devicename):
"check if a device is white-listed for being used as cryptobox containers"
import types

View file

@ -164,6 +164,7 @@ class CryptoBoxSettings:
AllowedDevices = list(min=1)
DefaultVolumePrefix = string(min=1)
DefaultCipher = string(default="aes-cbc-essiv:sha256")
ConfigVolumeLabel = string(min=1,default="cbox_config")
[Locations]
MountParentDir = directoryExists(default="/var/cache/cryptobox/mnt")
@ -186,7 +187,6 @@ DocLanguage = string(min=1, default="en")
[Programs]
cryptsetup = fileExecutable(default="/sbin/cryptsetup")
mkfs-data = fileExecutable(default="/sbin/mkfs.ext3")
mkfs-config = fileExecutable(default="/sbin/mkfs.ext2")
blkid = fileExecutable(default="/sbin/blkid")
mount = fileExecutable(default="/bin/mount")
umount = fileExecutable(default="/bin/umount")

View file

@ -4,12 +4,16 @@
# beware: .e.g "/dev/hd" grants access to _all_ harddisks
AllowedDevices = /dev/loop
# the default name prefix of not unnamed containers
DefaultVolumePrefix = "Data "
# which cipher should cryptsetup-luks use?
DefaultCipher = aes-cbc-essiv:sha256
# label of the configuration partition (you should never change this)
ConfigVolumeLabel = cbox_config
[Locations]
# where should we mount volumes?
@ -70,7 +74,6 @@ DocLanguage = de
[Programs]
cryptsetup = /sbin/cryptsetup
mkfs-data = /sbin/mkfs.ext3
mkfs-config = /sbin/mkfs.ext2
blkid = /sbin/blkid
mount = /bin/mount
umount = /bin/umount