migrated to cryptsetup-luks

list of packages reduced
more dfsbuild-probe devices: sda sdb sdc sdd
GPL added to all scripts
check_smb_idle.sh is temporarily disabled for now
initial_checks removed
This commit is contained in:
lars 2005-10-26 20:56:47 +00:00
parent 8d1c3aa9c4
commit eaa06602ee
28 changed files with 713 additions and 211 deletions

View file

@ -1,7 +1,13 @@
#!/usr/bin/perl
#
# Copyright (c) 02005 sense.lab <senselab@systemausfall.org>
#
# License: This script is distributed under the terms of version 2
# of the GNU GPL. See the LICENSE file included with the package.
#
# $Id$
#
# web interface of the CryptoBox
# the web interface of the CryptoBox
#
@ -17,7 +23,7 @@ my $CONFIG_FILE = '/etc/cryptobox/cryptobox.conf';
my ($pagedata, $pagename);
my ($LANGUAGE_DIR, $DEFAULT_LANGUAGE, $HTML_TEMPLATE_DIR, $DOC_DIR);
my ($CB_SCRIPT, $LOG_FILE, $IS_DEV);
my ($CB_SCRIPT, $LOG_FILE, $IS_DEVEL);
&fatal_error ("could not find configuration file ($CONFIG_FILE)") unless (-e $CONFIG_FILE);
my $config = ConfigFile::read_config_file($CONFIG_FILE);
@ -28,7 +34,10 @@ $LANGUAGE_DIR = $config->{LANGUAGE_DIR};
$DEFAULT_LANGUAGE = $config->{LANGUAGE};
$HTML_TEMPLATE_DIR = $config->{HTML_TEMPLATE_DIR};
$DOC_DIR = $config->{DOC_DIR};
$IS_DEV = ( -e $config->{DEV_FEATURES_SCRIPT});
$IS_DEVEL = ( -e $config->{DEV_FEATURES_SCRIPT});
# TODO: just a quick-and-dirty hack during migration to multiple containers
my $CRYPTO_DEV = "`$CB_SCRIPT get_config device`2";
my $query = new CGI;
@ -192,13 +201,13 @@ sub check_ssl
sub check_mounted
{
return (system("$CB_SCRIPT","is_crypto_mounted") == 0);
return (system("$CB_SCRIPT","is_crypto_mounted",$CRYPTO_DEV) == 0);
}
sub check_config
{
return (system("$CB_SCRIPT","is_config_mounted") == 0);
return (system("$CB_SCRIPT","is_config_mounted",$CRYPTO_DEV) == 0);
}
@ -253,7 +262,7 @@ sub mount_vol
if (&check_mounted) {
$pagedata->setValue('Data.Warning', 'IsMounted');
} else {
open(PW_INPUT, "| $CB_SCRIPT crypto-up");
open(PW_INPUT, "| $CB_SCRIPT crypto-up $CRYPTO_DEV");
print PW_INPUT $pw;
close(PW_INPUT);
}
@ -263,7 +272,7 @@ sub mount_vol
sub umount_vol
{
if (&check_mounted) {
system("$CB_SCRIPT", "crypto-down");
system("$CB_SCRIPT", "crypto-down",$CRYPTO_DEV);
} else {
$pagedata->setValue('Data.Warning', 'NotMounted');
}
@ -274,16 +283,16 @@ sub box_init
{
my ($crypto_pw, $admin_pw) = @_;
system("$CB_SCRIPT", "init");
# partitioning, config and initial cryptsetup
open(PW_INPUT, "|$CB_SCRIPT box-init-fg");
# TODO: define the name of the crypto container
# TODO: split init and create_crypto
open(PW_INPUT, "|$CB_SCRIPT crypto-create",$CRYPTO_DEV,"default");
print PW_INPUT $crypto_pw;
close(PW_INPUT);
# set administration password
system("$CB_SCRIPT", "set_config", "admin_pw", "$admin_pw");
# wipe and mkfs takes some time - it will be done in the background
system("$CB_SCRIPT", "box-init-bg");
}
sub box_purge
@ -678,7 +687,7 @@ if (-e "$LOG_FILE") {
}
$pagedata->setValue('Data.Log',"$output");
$pagedata->setValue('Data.Status.DevelopmentMode', 1) if ($IS_DEV);
$pagedata->setValue('Data.Status.DevelopmentMode', 1) if ($IS_DEVEL);
# save QUERY_STRING (e.g. for weblang-links)
my $querystring = $ENV{'QUERY_STRING'};