images moved to /var/www/cryptobox-img
doc pages served by the CGI again (as until rev 164) URLs of images in stylesheet are absolute now moved 'partition_info' layout to stylesheet file CGI: file handling now done with perl instead of shell utilities CGI: removed warning for 'crypto not mounted' after 'poweroff' or 'reboot' CGI: warning, if unmount-crypto failed CGI: warning, if configuration of any value failed silently texts for 'ConfigTimeOutFailed', 'ConfigLanguageFailed' and 'ConfigIPFailed' added to language file cbox-manage.sh: syntax info updated cbox-manage.sh: action 'crypto-(u)mount' renamed to 'crypto-up/down'
|
@ -44,9 +44,6 @@ function initial_checks()
|
|||
{
|
||||
local device="$1"
|
||||
[ ! -b "$device" ] && log_msg "blockdevice $device does not exist" && return 1
|
||||
## check if we have an existing configpartition
|
||||
## TODO: why this config_mount_test?
|
||||
# config_mount_test "$device"
|
||||
[ ! -x "$WIPE" ] && log_msg "$WIPE not found" && return 1
|
||||
[ ! -x "$SFDISK" ] && log_msg "$SFDISK not found" && return 1
|
||||
for a in $ALGO $HASH
|
||||
|
@ -368,6 +365,12 @@ case "$ACTION" in
|
|||
/etc/init.d/samba stop
|
||||
/etc/init.d/thttpd stop
|
||||
;;
|
||||
crypto-up )
|
||||
mount_crypto
|
||||
;;
|
||||
crypto-down )
|
||||
umount_crypto
|
||||
;;
|
||||
box-init )
|
||||
# do complete initialization
|
||||
"$0" box-init-fg
|
||||
|
@ -400,16 +403,17 @@ case "$ACTION" in
|
|||
is_init_running )
|
||||
is_init_running
|
||||
;;
|
||||
is_harddisk_available )
|
||||
[ -z "$(find_harddisk)" ] && exit 1
|
||||
exit 0
|
||||
;;
|
||||
update_ip_address )
|
||||
# reconfigure the network interface to a new IP address
|
||||
# wait for 5 seconds to finish present http requests
|
||||
echo -n "sleep 5; ifconfig $NET_IFACE `config_get_value ip`" | at now
|
||||
;;
|
||||
crypto-mount )
|
||||
mount_crypto
|
||||
;;
|
||||
crypto-umount )
|
||||
umount_crypto
|
||||
get_current_ip )
|
||||
get_current_ip
|
||||
;;
|
||||
set_config )
|
||||
[ $# -ne 3 ] && error_msg 7 "'set_config' requires two parameters"
|
||||
|
@ -432,16 +436,30 @@ case "$ACTION" in
|
|||
log_msg "Rebooting the CryptoBox ..."
|
||||
echo "reboot" | at now
|
||||
;;
|
||||
get_current_ip )
|
||||
get_current_ip
|
||||
;;
|
||||
is_harddisk_available )
|
||||
[ -z "$(find_harddisk)" ] && exit 1
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
# TODO: update this!
|
||||
echo "Syntax: `basename $0` { mount_config | umount_config | init }"
|
||||
echo "Syntax: `basename $0` ACTION [PARAMS]"
|
||||
echo " config-up - scan for configuration partition and mount it"
|
||||
echo " config-down - unmount configuration partition"
|
||||
echo " network-up - enable network interface"
|
||||
echo " network-down - disable network interface"
|
||||
echo " services-up - run some cryptobox specific daemons"
|
||||
echo " services-down - stop some cryptobox specific daemons"
|
||||
echo " crypto-up - mount crypto partition and start samba"
|
||||
echo " crypto-down - unmount crypto partition and stop samba"
|
||||
echo " box-init - initialize cryptobox (ALL data is LOST)"
|
||||
echo " box-init-fg - the first part of initialization"
|
||||
echo " box-init-bg - the last part of initialization (background)"
|
||||
echo " is_crypto_mounted - check, if crypto partition is mounted"
|
||||
echo " is_config_mounted - check, if configuration partition is mounted"
|
||||
echo " is_init_running - check, if initialization is ongoing"
|
||||
echo " is_harddisk_available - check, if there is a usable harddisk"
|
||||
echo " get_current_ip - get the current IP of the network interface"
|
||||
echo " update_ip_address - update the network interface after reconfiguration"
|
||||
echo " set_config NAME VALUE - change a configuration setting"
|
||||
echo " get_config NAME - retrieve a configuration setting"
|
||||
echo " diskinfo - show the partition table of the harddisk"
|
||||
echo " poweroff - shutdown the cryptobox"
|
||||
echo " reboot - reboot the cryptobox"
|
||||
echo
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -105,6 +105,21 @@ Lang {
|
|||
Text = Der ausgewählte Wert der Zeitabschaltung ist nicht gültig!
|
||||
}
|
||||
|
||||
ConfigTimeOutFailed {
|
||||
Title = Fehler beim Ändern der Zeitabschaltung
|
||||
Text = Der Wert der Zeitabschaltung konnte nicht geändert werden!
|
||||
}
|
||||
|
||||
ConfigLanguageFailed {
|
||||
Title = Fehler beim Ändern der Spracheinstellung
|
||||
Text = Die Sprach-Einstellung konnte nicht geändert werden!
|
||||
}
|
||||
|
||||
ConfigIPFailed {
|
||||
Title = Fehler beim Ändern der Netzwerkadresse
|
||||
Text = Die Netzwerkadresse konnte nicht geändert werden!
|
||||
}
|
||||
|
||||
IPAddressChanged {
|
||||
Title = Änderung der Netzwerk-Adresse
|
||||
Text = Die Netzwerk-Adresse der CryptoBox wurde verändert. In wenigen Sekunden werden sie zu der neuen Adresse umgeleitet.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="doc">
|
||||
|
||||
<?cs include:DocDir + '/' + Data.Doc.Page ?>
|
||||
<?cs include:DocDir + '/' + Data.Doc.Page + '.html' ?>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -19,8 +19,5 @@
|
|||
|
||||
<div class="partition_info">
|
||||
<h2><?cs var:Lang.Text.PartitionInfo ?></h2>
|
||||
<!-- TODO: CSS! -->
|
||||
<p style="margin-left:10%; margin-right:10%; font-family:monospace">
|
||||
<?cs var:Data.PartitionInfo ?>
|
||||
</p>
|
||||
<p><?cs var:Data.PartitionInfo ?></p>
|
||||
</div>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
<a href="<?cs call:getSelfURL('action=init_ask','action') ?>" title="Ersteinrichtung">Initialisierung</a>
|
||||
<a href="<?cs call:getSelfURL('action=show_log','action') ?>" title="Ereignis-Protokoll">Protokoll</a>
|
||||
<!-- TODO: language specific (weblang) doc-link -->
|
||||
<a href="/doc/CryptoBox.html" title="Nutzer-Handbuch">Hilfe</a>
|
||||
<a href="<?cs call:getSelfURL('action=doc&page=CryptoBox','action') ?>" title="Nutzer-Handbuch">Hilfe</a>
|
||||
<a href="<?cs call:getSelfURL('action=shutdown_ask','action') ?>" title="Herunterfahren">Herunterfahren</a>
|
||||
|
||||
|
|
|
@ -90,8 +90,9 @@ sub get_available_languages()
|
|||
sub log_msg()
|
||||
{
|
||||
my $text = shift;
|
||||
# TODO: improve or remove!
|
||||
system("echo $text >>$LOG_FILE");
|
||||
open(LOGFILE,">> $LOG_FILE");
|
||||
print LOGFILE "$text";
|
||||
close(LOGFILE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,29 +154,22 @@ sub mount_vol
|
|||
my $pw = shift;
|
||||
|
||||
if (&check_mounted) {
|
||||
$pagedata->setValue('Data.Warning', 'Das Dateisystem war bereits aktiv!');
|
||||
return 0;
|
||||
$pagedata->setValue('Data.Warning', 'IsMounted');
|
||||
} else {
|
||||
open(PW_INPUT, "| $CB_SCRIPT crypto-up");
|
||||
print PW_INPUT $pw;
|
||||
close(PW_INPUT);
|
||||
}
|
||||
|
||||
# TODO: the output is always empty?
|
||||
my $output = open(PW_INPUT, "| $CB_SCRIPT crypto-mount");
|
||||
print PW_INPUT $pw;
|
||||
close(PW_INPUT);
|
||||
|
||||
$pagedata->setValue('Data.ProgOutput',"$output") if ($output);
|
||||
}
|
||||
|
||||
|
||||
sub umount_vol
|
||||
{
|
||||
unless (&check_mounted) {
|
||||
$pagedata->setValue('Data.Warning', 'Das Dateisystem war bereits inaktiv!');
|
||||
return 0;
|
||||
if (&check_mounted) {
|
||||
system("$CB_SCRIPT", "crypto-down");
|
||||
} else {
|
||||
$pagedata->setValue('Data.Warning', 'NotMounted');
|
||||
}
|
||||
|
||||
# TODO: check if "system" returns output
|
||||
my $output = `$CB_SCRIPT crypto-umount`;
|
||||
$pagedata->setValue('Data.ProgOutput',"$output") if ($output);
|
||||
}
|
||||
|
||||
|
||||
|
@ -195,14 +189,14 @@ sub box_init
|
|||
|
||||
sub system_poweroff()
|
||||
{
|
||||
&umount_vol();
|
||||
&umount_vol() if (&check_mounted());
|
||||
system("$CB_SCRIPT", "poweroff");
|
||||
}
|
||||
|
||||
|
||||
sub system_reboot()
|
||||
{
|
||||
&umount_vol();
|
||||
&umount_vol() if (&check_mounted());
|
||||
system("$CB_SCRIPT", "reboot");
|
||||
}
|
||||
|
||||
|
@ -246,8 +240,6 @@ my $query = new CGI;
|
|||
$pagedata = load_hdf();
|
||||
|
||||
|
||||
#TODO: check result of actions and set Data.Error for failures
|
||||
|
||||
######### temporary language setting? ############
|
||||
# the default language can be overriden by the language links in the
|
||||
# upper right of the page
|
||||
|
@ -292,9 +284,10 @@ if ( ! &check_ssl()) {
|
|||
if (&check_mounted()) {
|
||||
$pagedata->setValue('Data.Warning', 'UmountFailed');
|
||||
$pagedata->setValue('Data.Action', 'umount_form');
|
||||
}
|
||||
$pagedata->setValue('Data.Success', 'UmountDone');
|
||||
$pagedata->setValue('Data.Action', 'mount_form');
|
||||
} else {
|
||||
$pagedata->setValue('Data.Success', 'UmountDone');
|
||||
$pagedata->setValue('Data.Action', 'mount_form');
|
||||
}
|
||||
}
|
||||
################ mount_do ########################
|
||||
} elsif ($action eq 'mount_do') {
|
||||
|
@ -423,15 +416,31 @@ if ( ! &check_ssl()) {
|
|||
$pagedata->setValue('Data.Warning', 'IPAddressChanged');
|
||||
}
|
||||
|
||||
# TODO: check for success by comparing with new config and report success
|
||||
$pagedata->setValue('Data.Success', 'ConfigSaved');
|
||||
# TODO: maybe the intro page does not fit here ...
|
||||
# check for success
|
||||
if (`$CB_SCRIPT get_config timeout` ne $query->param('timeout')) {
|
||||
$pagedata->setValue('Data.Warning', 'ConfigTimeOutFailed');
|
||||
} elsif (`$CB_SCRIPT get_config ip` ne $query->param('ip')) {
|
||||
$pagedata->setValue('Data.Warning', 'ConfigIPFailed');
|
||||
} elsif (`$CB_SCRIPT get_config language` ne $query->param('language')) {
|
||||
$pagedata->setValue('Data.Warning', 'ConfigLanguageFailed');
|
||||
} else {
|
||||
$pagedata->setValue('Data.Success', 'ConfigSaved');
|
||||
}
|
||||
$pagedata->setValue('Data.Action', 'intro');
|
||||
}
|
||||
}
|
||||
#################### show_log #######################
|
||||
} elsif ($action eq 'show_log') {
|
||||
$pagedata->setValue('Data.Action', 'show_log');
|
||||
##################### doc ############################
|
||||
} elsif ($action eq 'doc') {
|
||||
if ($query->param('page')) {
|
||||
$pagedata->setValue('Data.Doc.Page', $query->param('page'));
|
||||
$pagedata->setValue('Data.Action', 'doc');
|
||||
} else {
|
||||
$pagedata->setValue('Data.Doc.Page', 'CryptoBox');
|
||||
$pagedata->setValue('Data.Action', 'doc');
|
||||
}
|
||||
##################### poweroff ######################
|
||||
} elsif ($action eq 'shutdown_ask') {
|
||||
$pagedata->setValue('Data.Action', 'shutdown_form');
|
||||
|
@ -461,7 +470,7 @@ $pagedata->setValue('Data.Status.Mounted', &check_mounted() ? 1 : 0);
|
|||
my $output = &get_current_ip();
|
||||
$pagedata->setValue('Data.Status.IP', "$output");
|
||||
|
||||
$output = `$CB_SCRIPT diskinfo 2>&1 | sed 's/^/<br>/'`;
|
||||
($output = `$CB_SCRIPT diskinfo 2>&1`) =~ s#\Z#<br/>#;
|
||||
$pagedata->setValue('Data.PartitionInfo',"$output");
|
||||
|
||||
# preset config settings for clearsilver
|
||||
|
@ -469,8 +478,13 @@ $pagedata->setValue('Data.Config.IP', `$CB_SCRIPT get_config ip`);
|
|||
$pagedata->setValue('Data.Config.TimeOut', `$CB_SCRIPT get_config timeout`);
|
||||
$pagedata->setValue('Data.Config.Language', `$CB_SCRIPT get_config language`);
|
||||
|
||||
# read log - TODO: use perl filtering
|
||||
$output = (-e "$LOG_FILE") ? `cat '$LOG_FILE' | sed 's/^/<br>/'` : '';
|
||||
# read log and add html linebreaks
|
||||
$output = '';
|
||||
if (-e "$LOG_FILE") {
|
||||
open(LOGFILE, "< $LOG_FILE");
|
||||
while (<LOGFILE>) { $output .= "$_<br/>" }
|
||||
close(LOGFILE);
|
||||
}
|
||||
$pagedata->setValue('Data.Log',"$output");
|
||||
|
||||
$pagedata->setValue('Data.Status.DevelopmentMode', 1) if ($IS_DEV);
|
||||
|
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 51 B After Width: | Height: | Size: 51 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 356 B |
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
@ -1,5 +1,5 @@
|
|||
body {
|
||||
background-image: url(img/backg.gif);
|
||||
background-image: url(/cryptobox-img/backg.gif);
|
||||
background-position: top center;
|
||||
background-attachment: fixed;
|
||||
background-repeat: no-repeat;
|
||||
|
@ -40,7 +40,7 @@ body {
|
|||
height: 120px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-image: url(img/evil_small.png);
|
||||
background-image: url(/cryptobox-img/evil_small.png);
|
||||
background-position: top right;
|
||||
background-attachment: scroll;
|
||||
background-repeat: no-repeat;
|
||||
|
@ -123,7 +123,7 @@ body {
|
|||
padding: 0 1em;
|
||||
line-height: 1.7em;
|
||||
list-style: none;
|
||||
background: url(img/list.gif) center left no-repeat;
|
||||
background: url(/cryptobox-img/list.gif) center left no-repeat;
|
||||
}
|
||||
|
||||
#footer {
|
||||
|
@ -155,7 +155,7 @@ body {
|
|||
}
|
||||
|
||||
|
||||
/* --------------------=-=-=- Spezialkram -=-=-=------------------- */
|
||||
/* -------=-=-=- warnings, errors and success messages-=-=-=-------- */
|
||||
|
||||
#words div.warning,div.error,div.success {
|
||||
margin-top: 20px;
|
||||
|
@ -193,7 +193,7 @@ body {
|
|||
}
|
||||
|
||||
#words .warning,.error,.success a {
|
||||
// WHY line-height???
|
||||
// TODO: WHY line-height???
|
||||
// line-height: 5em;
|
||||
color: #5e5e5e;
|
||||
text-decoration: none;
|
||||
|
@ -208,7 +208,7 @@ body {
|
|||
}
|
||||
|
||||
/* ----------------------=-=-=- Forms -=-=-=--------------------- */
|
||||
/* nachfolgend die Sachen fuer schoene Formulare und Buttons */
|
||||
/* pretty forms and buttons */
|
||||
input {
|
||||
border: 1px solid #BFBFBF;
|
||||
color: #949494;
|
||||
|
@ -284,3 +284,16 @@ button:hover {
|
|||
#lang a:hover {
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
|
||||
/* ------------=-=-=- documentation -=-=-=------------- */
|
||||
|
||||
// #doc { }
|
||||
|
||||
/* ------------=-=-=- special things -=-=-=------------- */
|
||||
|
||||
#partition_info p {
|
||||
margin-left:10%;
|
||||
margin-right:10%;
|
||||
font-family:monospace
|
||||
}
|
||||
|
|
|
@ -32,9 +32,6 @@ CDWRITER="2,0,0"
|
|||
# directory of the test-cases
|
||||
VALIDATE_TEST_CASES_DIR=$ROOT_DIR/validation/test-cases
|
||||
|
||||
# TODO: take care, that this file exists! (it is created during "upload", "diff" or "merge")
|
||||
# who knows, what this should mean?
|
||||
|
||||
# override these settings if the CryptoBox is not directly available
|
||||
# in this case they should point to a redirecting router
|
||||
VALIDATE_HOST_IP=192.168.0.23
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#!/bin/sh
|
||||
set -u
|
||||
|
||||
# TODO:
|
||||
# import of images
|
||||
|
||||
# root directory of the cryptobox development environment
|
||||
ROOT_DIR="$(dirname $(dirname $0))"
|
||||
|
||||
|
@ -18,7 +15,10 @@ WIKI_URL="/wikis/howto/"
|
|||
HEADER_FILE="$ROOT_DIR/tools/doc_header.inc"
|
||||
FOOTER_FILE="$ROOT_DIR/tools/doc_footer.inc"
|
||||
|
||||
CBOX_CGI="/cryptobox?action=doc\&page="
|
||||
|
||||
DEST_DIR="$ROOT_DIR/cbox-tree.d/usr/share/doc/cryptobox/html"
|
||||
IMAGE_DIR="$ROOT_DIR/cbox-tree.d/var/www/cryptobox-img"
|
||||
TMP_DIR=/tmp/$(basename $0)-$$.d
|
||||
|
||||
[ ! -e "$DEST_DIR" ] && echo "$DEST_DIR does not exist" && exit 1
|
||||
|
@ -40,11 +40,11 @@ for PAGE in $PAGES; do
|
|||
# remove all lines before and after "body"
|
||||
sed -i '1,/_END_OF_HEADER_/d; /_START_OF_FOOTER_/,$d' "$TMP_FILE"
|
||||
|
||||
echo " adding header and footer ..."
|
||||
[ -e "${TMP_FILE}.0" ] && rm "${TMP_FILE}.0"
|
||||
mv "$TMP_FILE" "${TMP_FILE}.0"
|
||||
cat "$HEADER_FILE" "${TMP_FILE}.0" "$FOOTER_FILE" >"$TMP_FILE"
|
||||
rm "${TMP_FILE}.0"
|
||||
#echo " adding header and footer ..."
|
||||
#[ -e "${TMP_FILE}.0" ] && rm "${TMP_FILE}.0"
|
||||
#mv "$TMP_FILE" "${TMP_FILE}.0"
|
||||
#cat "$HEADER_FILE" "${TMP_FILE}.0" "$FOOTER_FILE" >"$TMP_FILE"
|
||||
#rm "${TMP_FILE}.0"
|
||||
|
||||
echo " downloading requisites ..."
|
||||
wget --quiet --ignore-tags=a --no-clobber --page-requisites --convert-links --no-parent --no-directories --base="$WIKI_HOST$WIKI_URL" --directory-prefix="$TMP_DIR" --html-extension --force-html --input-file="$TMP_FILE" || { echo "Downloading requisites for ($PAGE_SRC) failed!"; exit 1; }
|
||||
|
@ -52,17 +52,16 @@ for PAGE in $PAGES; do
|
|||
echo " adjusting links for requisites ..."
|
||||
find "$TMP_DIR" -type f | grep -v '\.html$' | while read a
|
||||
do fname=$(basename "$a")
|
||||
sed -i "s#=\"[^\"]*/$fname\"#=\"$fname\"#g" "$TMP_FILE"
|
||||
sed -i "s#=\"[^\"]*/$fname\"#=\"/cryptobox-img/$fname\"#g" "$TMP_FILE"
|
||||
done
|
||||
|
||||
# TODO: replace wiki-links by references to the cbox-cgi
|
||||
# check if wiki-links are absolute!
|
||||
echo " adjusting wiki links ..."
|
||||
# add the ".html" suffix and remove absolute path
|
||||
sed -i "s#=\"$WIKI_URL\([^\.]*\)\"#=\"\1.html\"#g" "$TMP_FILE"
|
||||
# redirect wiki links to cryptobox cgi
|
||||
sed -i "s#=\"$WIKI_URL\([^\.]*\)\"#=\"$CBOX_CGI\1\"#g" "$TMP_FILE"
|
||||
|
||||
echo " finished!"
|
||||
done
|
||||
|
||||
cp "$TMP_DIR"/* "$DEST_DIR"
|
||||
rm -r "$TMP_DIR"
|
||||
mv "$TMP_DIR"/*.html "$DEST_DIR"
|
||||
mv "$TMP_DIR"/* "$IMAGE_DIR"
|
||||
rmdir "$TMP_DIR"
|
||||
|
|