From 4c1d197472ce0c0fda3bfa1fcda801aea2666aab Mon Sep 17 00:00:00 2001 From: lars Date: Tue, 20 Sep 2005 23:52:20 +0000 Subject: [PATCH] fixed bug, that would prevent re-initialization after reboot (stunnel.pem) re-indentation switches dfsbuild-host from "localhost" to "127.0.0.1" (in case of missing fstab) --- cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh | 6 ++--- cbox-tree.d/var/www/cgi-bin/cryptobox.pl | 23 ++++++++++---------- etc-defaults.d/dfs-cbox.conf | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh b/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh index 43dff17..79259c5 100755 --- a/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh +++ b/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh @@ -105,12 +105,12 @@ function create_config() cp -a "$CONFIG_DEFAULTS_DIR/." "$CONFIG_DIR" log_msg "Copying temporary cerificate file to config filesystem ..." + # beware: the temp file should always be there - even after reboot - see "mount_config" cp -p "$CERT_TEMP" "$CERT_FILE" log_msg "Setting inital values ..." # beware: config_set_value remounts the config partition read-only config_set_value "device" "$1" - config_set_value "ip" "$(get_current_ip)" # reinitialise configuration @@ -221,6 +221,8 @@ function mount_config() if [ -n "$device" ] && mount "${device}1" "$CONFIG_DIR" then log_msg "configuraton found on $device" config_set_value "device" "$device" + # copy certificate to /tmp in case of re-initialization + cp "$CERT_FILE" "$CERT_TEMP" return 0 else log_msg "failed to locate harddisk" return 1 @@ -319,8 +321,6 @@ ACTION=help case "$ACTION" in config-up ) - # the "cruft" option could help to prevent the error "interleaved files not (yet) supported" - mount -o remount,cruft / if mount_config then echo "Cryptobox configuration successfully loaded" else error_msg 3 "Could not find a configuration partition!" diff --git a/cbox-tree.d/var/www/cgi-bin/cryptobox.pl b/cbox-tree.d/var/www/cgi-bin/cryptobox.pl index 489f9db..568e68e 100755 --- a/cbox-tree.d/var/www/cgi-bin/cryptobox.pl +++ b/cbox-tree.d/var/www/cgi-bin/cryptobox.pl @@ -48,6 +48,8 @@ sub load_hdf (my $script_url = $ENV{'SCRIPT_NAME'}) =~ m/^[^&]*/; $hdf->setValue("ScriptName", ($ENV{'SCRIPT_NAME'} eq '/')? '/cryptobox' : $script_url ); + &load_selected_language($hdf); + &get_available_languages($hdf); return $hdf; @@ -75,9 +77,9 @@ sub load_selected_language # load the data $config_language = "$weblang"; # add the setting to every link - $pagedata->setValue('Data.PostData.weblang', "$weblang"); + $data->setValue('Data.PostData.weblang', "$weblang"); } else { - $pagedata->setValue('Data.Warning', 'InvalidLanguage'); + $data->setValue('Data.Warning', 'InvalidLanguage'); } } # import the configured resp. the temporarily selected language @@ -86,13 +88,13 @@ sub load_selected_language ########## select documentation language ########## if (&validate_doc_language($config_language)) { # selected web interface language - $pagedata->setValue('Settings.DocLang', "$config_language"); + $data->setValue('Settings.DocLang', "$config_language"); } elsif (&validate_doc_language($DEFAULT_LANGUAGE)) { # configured CryptoBox language - $pagedata->setValue('Settings.DocLang', "$DEFAULT_LANGUAGE"); + $data->setValue('Settings.DocLang', "$DEFAULT_LANGUAGE"); } else { # default hardcoded language (english) - $pagedata->setValue('Settings.DocLang', "en"); + $data->setValue('Settings.DocLang', "en"); } } @@ -175,8 +177,6 @@ sub get_admin_pw sub render { - &load_selected_language($pagedata); - $pagedata->setValue("PageName","$pagename"); my $pagefile = "$HTML_TEMPLATE_DIR/main.cs"; print "Content-Type: text/html\n\n"; @@ -319,11 +319,11 @@ if ( ! &check_ssl()) { # unmounten &umount_vol(); if (&check_mounted()) { - $pagedata->setValue('Data.Warning', 'UmountFailed'); - $pagedata->setValue('Data.Action', 'umount_form'); + $pagedata->setValue('Data.Warning', 'UmountFailed'); + $pagedata->setValue('Data.Action', 'umount_form'); } else { - $pagedata->setValue('Data.Success', 'UmountDone'); - $pagedata->setValue('Data.Action', 'mount_form'); + $pagedata->setValue('Data.Success', 'UmountDone'); + $pagedata->setValue('Data.Action', 'mount_form'); } } ################ mount_do ######################## @@ -450,6 +450,7 @@ if ( ! &check_ssl()) { $pagedata->setValue('Data.Action', 'config_form'); } else { system("$CB_SCRIPT", "set_config", "language", $query->param('language')); + &load_selected_language($pagedata); system("$CB_SCRIPT", "set_config", "timeout", $query->param('timeout')); # check, if the ip was reconfigured if ($query->param('ip') ne `$CB_SCRIPT get_config ip`) diff --git a/etc-defaults.d/dfs-cbox.conf b/etc-defaults.d/dfs-cbox.conf index efecdc3..6da3b73 100644 --- a/etc-defaults.d/dfs-cbox.conf +++ b/etc-defaults.d/dfs-cbox.conf @@ -118,7 +118,7 @@ allpackages = util-linux #patch # Default mirror for "repo" sections -mirror = http://localhost/apt-cacher/ftp.de.debian.org/debian +mirror = http://127.0.0.1/apt-cacher/ftp.de.debian.org/debian #mirror = http://ftp.debian.org/debian #mirror = http://mirrors/debian