Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
First version, basic creation/deletion, opening/closing. Passwords only.
  • Loading branch information
imgrant committed Oct 28, 2015
1 parent 581a9e7 commit 9ea6411
Show file tree
Hide file tree
Showing 23 changed files with 1,928 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.pc/
debian/openmediavault-mpd/
debian/openmediavault-mpd*.debhelper*
debian/openmediavault-mpd*.substvars
debian/files
debian/tmp/
.*.swp
.*~
*~
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
openmediavault-luksencryption
=============================

LUKS (Linux Unified Key Setup) encryption plugin for OpenMediaVault.

LUKS is the standard for Linux hard disk encryption. This plugin provides for basic manipulation of LUKS-encrypted devices in OpenMediaVault; encrypted devices can be created, destroyed, opened (unlocked/mounted) and closed (locked/unmounted).
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
openmediavault-luksencryption (1.0.0) UNRELEASED; urgency=low

* Initial release.

-- OpenMediaVault Plugin Developers <[email protected]> Wed, 28 Oct 2015 16:31:25 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
18 changes: 18 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Source: openmediavault-luksencryption
Section: admin
Priority: optional
Maintainer: OpenMediaVault Plugin Developers <[email protected]>
Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.6
XB-Plugin-Section: filesystems

Package: openmediavault-luksencryption
Architecture: all
Depends: openmediavault (>= 1.12), cryptsetup (>= 1.4), ${misc:Depends}
Description: OpenMediaVault LUKS encryption plugin
LUKS is the standard for Linux hard disk encryption. By providing a
standard on-disk-format, it not only facilitates compatibility
among distributions, but also provides secure management of multiple
user passwords. In contrast to existing solutions, LUKS stores all
necessary setup information in the partition header, enabling the
user to transport or migrate his data seamlessly.
12 changes: 12 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Files: *
Copyright: Copyright (C) 2015 OpenMediaVault Plugin Developers <[email protected]>
License: GPL-3+

Files: var/www/openmediavault/images/*
Copyright: Copyright (C) Keyamoon
License: GPL-3+ or CC-BY-4.0

License: GPL-3+
/usr/share/common-licenses/GPL-3
3 changes: 3 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
usr/share/openmediavault/* usr/share/openmediavault
var/www/openmediavault/* var/www/openmediavault
usr/share/php/openmediavault/* usr/share/php/openmediavault
1 change: 1 addition & 0 deletions debian/lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dir-or-file-in-var-www
27 changes: 27 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

set -e

. /etc/default/openmediavault
. /usr/share/openmediavault/scripts/helper-functions

case "$1" in
configure)
# Activate package triggers. These triggers are only set during the
# package installation.
dpkg-trigger update-fixperms
dpkg-trigger update-locale
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
echo "postinst called with unknown argument" >&2
exit 1
;;
esac

#DEBHELPER#

exit 0
26 changes: 26 additions & 0 deletions debian/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

set -e

. /etc/default/openmediavault
. /usr/share/openmediavault/scripts/helper-functions

case "$1" in
purge)
;;

remove)
;;

upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;

*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac

#DEBHELPER#

exit 0
4 changes: 4 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/make -f

%:
dh $@
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
1 change: 1 addition & 0 deletions debian/triggers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
activate restart-engined
87 changes: 87 additions & 0 deletions usr/share/openmediavault/engined/module/luks.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
/**
* This file is part of OpenMediaVault.
*
* @license http://www.gnu.org/licenses/gpl.html GPL Version 3
* @author Volker Theile <[email protected]>
* @copyright Copyright (c) 2009-2015 Volker Theile
*
* OpenMediaVault is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* OpenMediaVault is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
*/
require_once("openmediavault/module.inc");
require_once("openmediavault/error.inc");

class OMVModuleLuks extends OMVModuleServiceAbstract
implements OMVINotifyListener, OMVIModuleNotification {
/**
* Get the module name.
*/
public function getName() {
return "luks";
}

/**
* Defines the modules that if present should start before the service
* provided by this module.
* @return An array of modules.
*/
public function shouldStart() { return array("email"); }

/**
* Generate the configuration.
* @throw E_EXEC_FAILED
*/
public function applyConfig() {
$cmd = sprintf("export LANG=C; omv-mkconf %s 2>&1", $this->getName());
if(0 !== $this->exec($cmd, $output)) {
throw new OMVException(OMVErrorMsg::E_EXEC_FAILED,
$cmd, implode("\n", $output));
}
}

/**
* Get the notification configuration.
*/
public function getNotificationConfig() {
return array(
array(
"id" => "luks",
"type" => getText("Storage"),
"title" => gettext("Encryption")
)
);
}

/**
* Bind listeners.
*/
function bindListeners(OMVNotifyDispatcher $dispatcher) {
$dispatcher->addListener(
OMV_NOTIFY_CREATE | OMV_NOTIFY_MODIFY | OMV_NOTIFY_DELETE,
"org.openmediavault.system.storage.luks.container",
array($this, "setDirty"));
$dispatcher->addListener(
OMV_NOTIFY_MODIFY,
"org.openmediavault.system.email",
array($this, "setDirty"));
$dispatcher->addListener(
OMV_NOTIFY_MODIFY,
"org.openmediavault.system.notification.notifications",
array($this, "setDirty"));
}
}

// Register module.
$moduleMgr = &OMVModuleMgr::getInstance();
$moduleMgr->registerModule(new OMVModuleLuks());
Loading

0 comments on commit 9ea6411

Please sign in to comment.