diff --git a/plugins/date/form_date.cs b/plugins/date/form_date.cs index 3dd732a..fe378b1 100644 --- a/plugins/date/form_date.cs +++ b/plugins/date/form_date.cs @@ -2,8 +2,6 @@
- -
diff --git a/plugins/disks/disks.cs b/plugins/disks/disks.cs
index 8857774..099d77e 100644
--- a/plugins/disks/disks.cs
+++ b/plugins/disks/disks.cs
@@ -2,8 +2,6 @@
- -
- - - - - diff --git a/plugins/format_fs/volume_format_luks.cs b/plugins/format_fs/volume_format_luks.cs deleted file mode 100644 index 9a229e1..0000000 --- a/plugins/format_fs/volume_format_luks.cs +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - -:
-:
- --
-
- - - -
- - - - - diff --git a/plugins/help/doc.cs b/plugins/help/doc.cs index 57bfdad..af93071 100644 --- a/plugins/help/doc.cs +++ b/plugins/help/doc.cs @@ -2,8 +2,6 @@diff --git a/plugins/partition/select_device.cs b/plugins/partition/select_device.cs index bfb7b59..adbe58a 100644 --- a/plugins/partition/select_device.cs +++ b/plugins/partition/select_device.cs @@ -4,8 +4,6 @@
- - 0 ?> diff --git a/plugins/partition/set_partitions.cs b/plugins/partition/set_partitions.cs index 32b3421..3d30e6d 100644 --- a/plugins/partition/set_partitions.cs +++ b/plugins/partition/set_partitions.cs @@ -4,8 +4,6 @@ - -+ | + | + | + | + | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- | + | + | ||||||||||||||||||||||||||||||||||||||||
checked="checked" /> | +checked="checked" /> | checked="checked" /> | - #volume_plugins"> + &x=#volume_plugins"> - #volume_plugins" > + &x=#volume_plugins" > | @@ -87,9 +97,9 @@ each:x = Settings.PluginList ?>checked="checked" />checked="checked" /> | - #system_plugins"> + &x=#system_plugins"> - #" > + &x=#" > | diff --git a/plugins/shutdown/form_shutdown.cs b/plugins/shutdown/form_shutdown.cs index 306ffd1..81e07be 100644 --- a/plugins/shutdown/form_shutdown.cs +++ b/plugins/shutdown/form_shutdown.cs @@ -2,8 +2,6 @@ - - diff --git a/plugins/user_manager/user_list.cs b/plugins/user_manager/user_list.cs index 8d6defa..1dbdea3 100644 --- a/plugins/user_manager/user_list.cs +++ b/plugins/user_manager/user_list.cs @@ -11,8 +11,6 @@ - - diff --git a/plugins/volume_chpasswd/lang/en.hdf b/plugins/volume_chpasswd/lang/en.hdf new file mode 100644 index 0000000..f8410d8 --- /dev/null +++ b/plugins/volume_chpasswd/lang/en.hdf @@ -0,0 +1,36 @@ +Name = Change volume password +Link = Password + +Title { + ChangePassword = Change the password of this volume +} + + +Button { + ChangePassword = Change password + FormatContainer = Format volume +} + + +AdviceMessage { + FormatForEncryptionSupport { + Text = This volume is not encrypted. If you want to turn on encryption, then you have to format the volume. Beware: this will destroy all data of this container. + Link.Text = Format this volume + Link.Rel = volume_format_fs +} + + +SuccessMessage { + PasswordChange { + Title = Password changed + Text = The password of this volume was changed successfully. + } +} + + +WarningMessage { + PasswordChange { + Title = Could not change password + Text = The password of this volume could not be changed - sorry! + } +} diff --git a/plugins/volume_chpasswd/unittests.py b/plugins/volume_chpasswd/unittests.py new file mode 100644 index 0000000..b8567ed --- /dev/null +++ b/plugins/volume_chpasswd/unittests.py @@ -0,0 +1,11 @@ +import WebInterfaceTestClass + +class unittests(WebInterfaceTestClass.WebInterfaceTestClass): + + def test_read_form(self): + url = self.URL + "volume_chpasswd?weblang=en&device=%2Fdev%2Floop1" + self.register_auth(url) + self.cmd.go(url) + self.cmd.find('hange') + self.cmd.find('password') + diff --git a/plugins/volume_chpasswd/volume_chpasswd.cs b/plugins/volume_chpasswd/volume_chpasswd.cs new file mode 100644 index 0000000..92395e1 --- /dev/null +++ b/plugins/volume_chpasswd/volume_chpasswd.cs @@ -0,0 +1,33 @@ + + + + + + + +
+ | + | + |
+ | + | + |
+ | + | + + + + | +
+ +
+ + + + diff --git a/plugins/volume_format_fs/volume_format_fs.py b/plugins/volume_format_fs/volume_format_fs.py new file mode 100644 index 0000000..5e02eb9 --- /dev/null +++ b/plugins/volume_format_fs/volume_format_fs.py @@ -0,0 +1,96 @@ +import CryptoBoxPlugin +from CryptoBoxExceptions import * + +class volume_format_fs(CryptoBoxPlugin.CryptoBoxPlugin): + + pluginCapabilities = [ "volume" ] + pluginVisibility = [ "volume" ] + requestAuth = True + rank = 60 + + ## map filesystem types to the appropriate arguments for 'mkfs' + fsTypes = { + "windows": "vfat", + "linux": "ext3" } + + containerTypes = [ "luks", "plain" ] + + + def doAction(self, store=None, fs_type="windows", container_type="luks", crypto_password=None, crypto_password2=None, confirm=None): + if not fs_type in self.fsTypes.keys(): + self.cbox.info + return "format_volume" + self.hdf[self.hdf_prefix + "fs_type"] = fs_type + self.hdf[self.hdf_prefix + "container_type"] = container_type + for t in self.fsTypes.keys(): + self.hdf[self.hdf_prefix + "fs_types." + t] = t + if store == "step1": + if not confirm: + self.cbox.log.warn("missing confirmation for formatting of filesystem: %s" % self.device) + self.hdf["Data.Warning"] = "Plugins.volume_format_fs.FormatNotConfirmed" + return "volume_format" + if container_type == "luks": + return "volume_format_luks" + elif container_type == "plain": + return self.__format_plain(fs_type) + elif store == "step2": + if container_type == "luks": + return self.__format_luks(fs_type, crypto_password, crypto_password2) + else: + self.cbox.log.info("invalid input value for 'container_type': %s" % container_type) + return "volume_format" + elif store: + self.cbox.log.info("invalid input value for 'store': %s" % store) + return "volume_format" + else: + return "volume_format" + + + def getStatus(self): + return "no status" + + + def __format_plain(self, fsType): + try: + container = self.cbox.getContainer(self.device) + container.create(container.Types["plain"]) + except CBVolumeIsActive: + self.hdf["Data.Warning"] = "VolumeMayNotBeMounted" + self.cbox.log.info("initialization is not possible as long as the device (%s) is mounted" % self.device) + return None + except CBContainerError, errMsg: + self.hdf["Data.Warning"] = "Plugins.volume_format_fs.FormatFailed" + self.cbox.log.warn("initialization of device '%s' failed" % self.device) + self.cbox.log.warn("reason: %s" % errMsg) + return "volume_format" + else: + self.cbox.log.info("successfully initialized device '%s'" % self.device) + return None + + + def __format_luks(self, fsType, pw, pw2): + if not pw: + self.hdf["Data.Warning"] = "EmptyPassword" + self.cbox.log.warn("no crypto password was supplied for initialization of device '%s'" % self.device) + return "volume_format" + if pw != pw2: + self.hdf["Data.Warning"] = "DifferentPasswords" + self.cbox.log.warn("the crypto password was not repeated correctly for initialization of device '%s'" % self.device) + return "volume_format" + container = self.cbox.getContainer(self.device) + try: + container.create(container.Types["luks"], pw) + except CBVolumeIsActive: + self.hdf["Data.Warning"] = "VolumeMayNotBeMounted" + self.cbox.log.info("initialization is not possible as long as the device (%s) is mounted" % self.device) + return None + except CBContainerError, errMsg: + self.hdf["Data.Warning"] = "Plugins.volume_format_fs.FormatFailed" + self.cbox.log.warn("initialization of device '%s' failed" % self.device) + self.cbox.log.warn("reason: %s" % errMsg) + return "volume_format" + else: + self.hdf["Data.Success"] = "Plugins.volume_format_fs.FormatSuccess" + self.cbox.log.info("successfully initialized device '%s'" % self.device) + return None + diff --git a/plugins/volume_format_fs/volume_format_luks.cs b/plugins/volume_format_fs/volume_format_luks.cs new file mode 100644 index 0000000..fe13884 --- /dev/null +++ b/plugins/volume_format_fs/volume_format_luks.cs @@ -0,0 +1,27 @@ + + + + + + + + + + + +:
+:
+ ++
+
+ + + +
+ + + + diff --git a/plugins/volume_mount/lang/en.hdf b/plugins/volume_mount/lang/en.hdf index d490880..f029f1c 100644 --- a/plugins/volume_mount/lang/en.hdf +++ b/plugins/volume_mount/lang/en.hdf @@ -42,7 +42,7 @@ WarningMessage { Title = Unknown format Text = The type of this volume ist not known. Maybe you want to initialize itfirst? Link.Text = Format volume - Link.Rel = format_fs + Link.Rel = volume_format_fs } UmountFailed { diff --git a/plugins/volume_mount/volume_mount.cs b/plugins/volume_mount/volume_mount.cs index 3566701..fbd7301 100644 --- a/plugins/volume_mount/volume_mount.cs +++ b/plugins/volume_mount/volume_mount.cs @@ -1,6 +1,4 @@ - - - +diff --git a/plugins/volume_mount/volume_status.cs b/plugins/volume_mount/volume_status.cs index 724af1a..b0eb9cd 100644 --- a/plugins/volume_mount/volume_status.cs +++ b/plugins/volume_mount/volume_status.cs @@ -1,9 +1,6 @@ - - - diff --git a/plugins/volume_mount/volume_umount.cs b/plugins/volume_mount/volume_umount.cs index 457badf..31dbe6d 100644 --- a/plugins/volume_mount/volume_umount.cs +++ b/plugins/volume_mount/volume_umount.cs @@ -1,6 +1,4 @@ -
- - +diff --git a/plugins/volume_props/lang/en.hdf b/plugins/volume_props/lang/en.hdf index 55bbfcc..7dd3a27 100644 --- a/plugins/volume_props/lang/en.hdf +++ b/plugins/volume_props/lang/en.hdf @@ -3,61 +3,11 @@ Link = Properties Title { Properties = Properties - ChangeVolumeName = Change the name of this volume - ChangePassword = Change the password of this volume - Encryption = Encryption } -Button { - ContainerNameSet = Change name - ChangePassword = Change password - FormatContainer = Format volume -} - - -Text.FormatForEncryptionSupport = This volume is not encrypted. If you want to turn on encryption, then you have to format the volume. Beware: this will destroy all data of this container. - - AdviceMessage { - UmountBeforeProps { - Text = You must deactivate a volume, if you want to change its properties. - Link.Text = Deactive volume now - Link.Rel = volume_mount - Link.Attr1.name = action - Link.Attr1.value = umount - Link.Attr2.name = redirect - Link.Attr2.value = volume_props - } -} - - -SuccessMessage { - PasswordChange { - Title = Password changed - Text = The password of this volume was changed successfully. - } -} - - -WarningMessage { - InvalidVolumeName { - Title = Changing of container's name failed - Text = The supplied new name of the container was invalid. Please try again! - } - - SetVolumeNameFailed { - Title = Changing of container's name failed - Text = Could not change the name of the container. Take a look at the log files for details. - } - - VolumeNameIsInUse { - Title = Volume name is in use - Text = Another volume with the same name is active. - } - - PasswordChange { - Title = Could not change password - Text = The password of this volume could not be changed - sorry! + NoPropertyPlugins { + Text = No volume property plugins are available. } } diff --git a/plugins/volume_props/volume_properties.cs b/plugins/volume_props/volume_properties.cs index ebf12b5..ef107f2 100644 --- a/plugins/volume_props/volume_properties.cs +++ b/plugins/volume_props/volume_properties.cs @@ -1,74 +1,11 @@ - -
- - - - - - + + + -- - | ||
- | -- | - - - - |
- - | ||
- | - | - |
- | - | - |
- | - | - - - - | -
- - | ||
- | - - - |
+ + + + + + + +
+ diff --git a/plugins/volume_rename/volume_rename.py b/plugins/volume_rename/volume_rename.py new file mode 100644 index 0000000..4ceed43 --- /dev/null +++ b/plugins/volume_rename/volume_rename.py @@ -0,0 +1,54 @@ +import CryptoBoxPlugin +from CryptoBoxExceptions import * + + +class volume_rename(CryptoBoxPlugin.CryptoBoxPlugin): + + pluginCapabilities = [ "volume" ] + pluginVisibility = [ "properties" ] + requestAuth = False + rank = 60 + + + def doAction(self, store=None, vol_name=None): + self.container = self.cbox.getContainer(self.device) + if not self.container: + return None + self.__prepareHDF() + if store and vol_name: + return self.__setVolumeName(vol_name) + else: + return "volume_rename" + + + def getStatus(self): + self.container = self.cbox.getContainer(self.device) + if not self.container: + return "invalid device" + return "name=%s" % self.container.getName() + + + def __prepareHDF(self): + self.hdf[self.hdf_prefix + "vol_name"] = self.container.getName() + + + def __setVolumeName(self, vol_name): + if not vol_name: + self.hdf["Data.Warning"] = "Plugins.volume_rename.InvalidVolumeName" + return "volume_rename" + if vol_name == self.container.getName(): + ## nothing has to be done + return "volume_rename" + try: + self.container.setName(vol_name) + self.hdf["Data.Success"] = "Plugins.volume_rename.VolumeNameChanged" + except CBInvalidName: + self.hdf["Data.Warning"] = "Plugins.volume_rename.InvalidVolumeName" + except CBNameActivelyUsed: + self.hdf["Data.Warning"] = "Plugins.volume_rename.VolumeNameIsInUse" + except CBContainerError: + self.hdf["Data.Warning"] = "Plugins.volume_rename.SetVolumeNameFailed" + ## reread the volume name + self.__prepareHDF() + return "volume_rename" +