redirect to https if http was used
chroot environment improved make_stunnel_cert fixed (typo) "config" action now preserves links
This commit is contained in:
parent
d5b4c1a6f1
commit
c621a89f3f
|
@ -106,9 +106,9 @@ function configure_cb()
|
||||||
|
|
||||||
echo "Copying files into the box ..."
|
echo "Copying files into the box ..."
|
||||||
[ -e "$TMPDIR" ] && rm -rf "$TMPDIR"
|
[ -e "$TMPDIR" ] && rm -rf "$TMPDIR"
|
||||||
cp -r "$TEMPLATEDIR/." "$TMPDIR"
|
cp -dr "$TEMPLATEDIR/." "$TMPDIR"
|
||||||
rm -rf `find "$TMPDIR" -type d -name ".svn"`
|
rm -rf `find "$TMPDIR" -type d -name ".svn"`
|
||||||
cp -r "$TMPDIR/." "$IMAGEDIR"
|
cp -dr "$TMPDIR/." "$IMAGEDIR"
|
||||||
rm -rf "$TMPDIR"
|
rm -rf "$TMPDIR"
|
||||||
|
|
||||||
echo "Configuring the cryptobox ..."
|
echo "Configuring the cryptobox ..."
|
||||||
|
|
|
@ -10,13 +10,14 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
TMPDIRS="var/run tmp root dev var/log"
|
MNT_SRC=/opt/dfsruntime/runtimerd
|
||||||
TMPROOT="/opt/dfsruntime/runtimemnt"
|
MNT_DST=/opt/dfsruntime/runtimemnt
|
||||||
|
# the directory /tmp/ can not be used, as it is still a broken link, too
|
||||||
|
TMP_DIR="/tmp-`basename $0`-$$"
|
||||||
|
|
||||||
|
|
||||||
for a in $TMPDIRS
|
cp -a "$MNT_SRC/." "$TMP_DIR"
|
||||||
do mkdir -p "$TMPROOT/$a"
|
mount --bind "$TMP_DIR" "$MNT_DST"
|
||||||
done
|
|
||||||
|
|
||||||
[ ! -e /dev/null ] && mknod "/dev/null" c 1 3 && chmod 666 "/dev/null"
|
[ ! -e /dev/null ] && mknod "/dev/null" c 1 3 && chmod 666 "/dev/null"
|
||||||
[ ! -e /dev/urandom ] && mknod "/dev/urandom" c 1 9 && chmod 444 "/dev/urandom"
|
[ ! -e /dev/urandom ] && mknod "/dev/urandom" c 1 9 && chmod 444 "/dev/urandom"
|
||||||
|
@ -26,6 +27,6 @@ for a in $TMPDIRS
|
||||||
|
|
||||||
bash
|
bash
|
||||||
|
|
||||||
|
umount "$MNT_DST"
|
||||||
umount proc
|
umount proc
|
||||||
rm -r "$TMPROOT"
|
rm -r "$TMP_DIR"
|
||||||
mkdir "$TMPROOT"
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ set -eu
|
||||||
CERTFILE="$1"
|
CERTFILE="$1"
|
||||||
TMP_FILE=/tmp/cryptobox-cert.tmp
|
TMP_FILE=/tmp/cryptobox-cert.tmp
|
||||||
|
|
||||||
[ ! -f "$CONF_FILE" ] && echo "`basename $0`: $CONF_FILE not found" && exit 2
|
[ ! -f "$OPENSSL_CONF_FILE" ] && echo "`basename $0`: $OPENSSL_CONF_FILE not found" && exit 2
|
||||||
# this command creates the certificate
|
# this command creates the certificate
|
||||||
# this is required, because the certbuilding asks for 5 returns
|
# this is required, because the certbuilding asks for 5 returns
|
||||||
echo -ne "\n\n\n\n\n" | openssl req -new -x509 -nodes -days 3650 -config "$OPENSSL_CONF_FILE" -out "$CERTFILE" -keyout "$CERTFILE"
|
echo -ne "\n\n\n\n\n" | openssl req -new -x509 -nodes -days 3650 -config "$OPENSSL_CONF_FILE" -out "$CERTFILE" -keyout "$CERTFILE"
|
||||||
|
|
|
@ -26,6 +26,7 @@ Lang {
|
||||||
TimeOut = Zeitabschaltung des Crypto-Dateisystems (in Minuten):
|
TimeOut = Zeitabschaltung des Crypto-Dateisystems (in Minuten):
|
||||||
EmptyLog = Das Logbuch der CryptoBox ist leer.
|
EmptyLog = Das Logbuch der CryptoBox ist leer.
|
||||||
SelectLanguage = Spracheinstellung:
|
SelectLanguage = Spracheinstellung:
|
||||||
|
RedirectNote = Klicke hier, falls dein Browser die automatische Weiterleitung nicht unterstützt.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,52 +42,52 @@ Lang {
|
||||||
Warning {
|
Warning {
|
||||||
InitNotConfirmed {
|
InitNotConfirmed {
|
||||||
Title = Bestätigung schlug fehl
|
Title = Bestätigung schlug fehl
|
||||||
Text = Der Bestätigungssatz muss exakt eingegeben werden!
|
Text = Der Bestätigungssatz muss exakt eingegeben werden!
|
||||||
}
|
}
|
||||||
|
|
||||||
EmptyPassword {
|
EmptyPassword {
|
||||||
Title = Ungültige Eingabe
|
Title = Ungültige Eingabe
|
||||||
Text = Das Passwort darf nicht leer sein!
|
Text = Das Passwort darf nicht leer sein!
|
||||||
}
|
}
|
||||||
|
|
||||||
DifferentPasswords {
|
DifferentPasswords {
|
||||||
Title = Ungleiche Passworte
|
Title = Ungleiche Passworte
|
||||||
Text = Die beiden Passworte müssen identisch sein, um sicherzustellen, dass dies das gewünschte Passwort ist.
|
Text = Die beiden Passworte müssen identisch sein, um sicherzustellen, dass dies das gewünschte Passwort ist.
|
||||||
}
|
}
|
||||||
|
|
||||||
MountFailed {
|
MountFailed {
|
||||||
Title = Aktivierung schlug fehl
|
Title = Aktivierung schlug fehl
|
||||||
Text = Das verschlüsselte Dateisystem konnte nicht aktiviert werden. Wahrscheinlich war das Passwort falsch.
|
Text = Das verschlüsselte Dateisystem konnte nicht aktiviert werden. Wahrscheinlich war das Passwort falsch.
|
||||||
}
|
}
|
||||||
|
|
||||||
UmountFailed {
|
UmountFailed {
|
||||||
Title = Deaktivierung schlug fehl
|
Title = Deaktivierung schlug fehl
|
||||||
Text = Das verschlüsselte Dateisystem konnte nicht abgeschaltet werden. Wahrscheinlich sind noch Dateien geöffnet. Also schließe alle potentiell unsauberen Programme (beispielsweise die weitverbreitete Textverarbeitung). Notfalls ziehe einfach den Stromstecker!
|
Text = Das verschlüsselte Dateisystem konnte nicht abgeschaltet werden. Wahrscheinlich sind noch Dateien geöffnet. Also schließe alle potentiell unsauberen Programme (beispielsweise die weitverbreitete Textverarbeitung). Notfalls ziehe einfach den Stromstecker!
|
||||||
}
|
}
|
||||||
|
|
||||||
NotConfigured {
|
NotConfigured {
|
||||||
Title = Keine Konfiguration gefunden
|
Title = Keine Konfiguration gefunden
|
||||||
Text = Die CryptoBox wurde noch nicht eingerichtet.
|
Text = Die CryptoBox wurde noch nicht eingerichtet.
|
||||||
}
|
}
|
||||||
|
|
||||||
InitNotFinished {
|
InitNotFinished {
|
||||||
Title = Initalisierung noch nicht abgeschlossen
|
Title = Initalisierung noch nicht abgeschlossen
|
||||||
Text = Die Initialisierung wird in wenigen Minuten beendet sein. Erst danach ist diese Aktion möglich.
|
Text = Die Initialisierung wird in wenigen Minuten beendet sein. Erst danach ist diese Aktion möglich.
|
||||||
}
|
}
|
||||||
|
|
||||||
IsMounted {
|
IsMounted {
|
||||||
Title = Bereits aktiv
|
Title = Bereits aktiv
|
||||||
Text = Das verschlüsselte Dateisystem ist bereits aktiv.
|
Text = Das verschlüsselte Dateisystem ist bereits aktiv.
|
||||||
}
|
}
|
||||||
|
|
||||||
NotMounted {
|
NotMounted {
|
||||||
Title = Nicht aktiv
|
Title = Nicht aktiv
|
||||||
Text = Das verschlüsselte Dateisystem ist derzeit nicht aktiv.
|
Text = Das verschlüsselte Dateisystem ist derzeit nicht aktiv.
|
||||||
}
|
}
|
||||||
|
|
||||||
AlreadyConfigured {
|
AlreadyConfigured {
|
||||||
Title = Konfiguration gefunden
|
Title = Konfiguration gefunden
|
||||||
Text = Die CryptoBox wurde bereits eingerichtet. Bei einer erneuten Initialisierung werden alle Daten gelöscht!
|
Text = Die CryptoBox wurde bereits eingerichtet. Bei einer erneuten Initialisierung werden alle Daten gelöscht!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,17 +96,12 @@ Lang {
|
||||||
|
|
||||||
UnknownAction {
|
UnknownAction {
|
||||||
Title = Unbekannte Aktion
|
Title = Unbekannte Aktion
|
||||||
Text = Du hast eine undefinierte Aktion angefordert. Falls du dies nicht bewusst getan hast, solltest du es deinem Administrator mitteilen, damit er das Problem an die Entwickler der CryptoBox weiterleiten kann.
|
Text = Du hast eine undefinierte Aktion angefordert. Falls du dies nicht bewusst getan hast, solltest du es deinem Administrator mitteilen, damit er das Problem an die Entwickler der CryptoBox weiterleiten kann.
|
||||||
}
|
}
|
||||||
|
|
||||||
MountUnavailableInitRunning {
|
NoSSL {
|
||||||
Title = Die Initialisierung der CryptoBox läuft noch ...
|
Title = Unverschlüsselte Verbindung
|
||||||
Text = Solange die Einrichtung der Crypto-Partition nicht abgeschlossen ist, kannst du die CryptoBox nicht aktivieren. Versuche es in ein paar Minuten noch einmal</a>.
|
Text = Die CryptoBox akzeptiert nur verschlüsselte Verbindungen (https). So bleibt dein Passwort vor neugierigen Augen geschützt.
|
||||||
}
|
|
||||||
|
|
||||||
MountUnavailableNotInitialized {
|
|
||||||
Title = Die CryptoBox wurde noch nicht initialisiert
|
|
||||||
Text = Nach dem Abschluss der einmaligen <a href="/cgi-bin/init-cryptobox.pl" title="Initialisierung">Neueinrichtung</a> kannst du die Crypto-Partition nutzen.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<?cs if:Data.Redirect.URL ?>
|
||||||
|
<p class="warning"><a href="<?cs var:Data.Redirect.URL ?>"><?cs var:Lang.Text.RedirectNote ?></a></p>
|
||||||
|
<?cs /if ?>
|
||||||
|
|
||||||
</div><!-- end of 'words' -->
|
</div><!-- end of 'words' -->
|
||||||
|
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<meta http-equiv="cache-control" content="no-cache" />
|
<meta http-equiv="cache-control" content="no-cache" />
|
||||||
<meta http-equiv="expires" content="0" />
|
<meta http-equiv="expires" content="0" />
|
||||||
<link rel="stylesheet" media="screen" href="/cryptobox.css" type="text/css" />
|
<link rel="stylesheet" media="screen" href="/cryptobox.css" type="text/css" />
|
||||||
|
<?cs if:Data.Redirect.URL ?><meta http-equiv="refresh" content="<?cs var:Data.Redirect.Delay ?>;<?cs var:Data.Redirect.URL ?>"><?cs /if ?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
displays the warning for a non-ssl connection
|
|
@ -0,0 +1,2 @@
|
||||||
|
url http://192.168.0.23/cryptobox
|
||||||
|
data action=init_ask
|
|
@ -0,0 +1,7 @@
|
||||||
|
Data.Config.IP=192.168.0.23
|
||||||
|
Data.Config.Language=de
|
||||||
|
Data.Config.TimeOut=30
|
||||||
|
Data.Status.Config=0
|
||||||
|
Data.Status.InitRunning=0
|
||||||
|
Data.Status.IP=192.168.0.23
|
||||||
|
Data.Status.Mounted=0
|
|
@ -59,6 +59,16 @@ sub load_hdf()
|
||||||
return $hdf;
|
return $hdf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub check_ssl
|
||||||
|
{
|
||||||
|
# BEWARE: dirty trick - is there a better way?
|
||||||
|
# stunnel is not in transparent mode -> that means, it replaces REMOTE_ADDR with
|
||||||
|
# its own IP (localhost, of course)
|
||||||
|
return ($ENV{'REMOTE_ADDR'} eq '127.0.0.1');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub check_mounted
|
sub check_mounted
|
||||||
{
|
{
|
||||||
return (system("$CB_SCRIPT","is_crypto_mounted") == 0);
|
return (system("$CB_SCRIPT","is_crypto_mounted") == 0);
|
||||||
|
@ -165,9 +175,15 @@ $pagedata = load_hdf();
|
||||||
|
|
||||||
#TODO: check result of actions and set Data.Error for failures
|
#TODO: check result of actions and set Data.Error for failures
|
||||||
|
|
||||||
if ($query->param) {
|
# first: check for ssl!
|
||||||
|
if ( ! &check_ssl()) {
|
||||||
|
$pagedata->setValue('Data.Error', 'NoSSL');
|
||||||
|
$pagedata->setValue('Data.Redirect.URL', "https://" . $ENV{'HTTP_HOST'} . $ENV{'SCRIPT_NAME'});
|
||||||
|
$pagedata->setValue('Data.Redirect.Delay', "3");
|
||||||
|
} elsif ($query->param) {
|
||||||
my $action = $query->param('action');
|
my $action = $query->param('action');
|
||||||
|
|
||||||
|
################ umount_do #######################
|
||||||
if ($action eq 'umount_do') {
|
if ($action eq 'umount_do') {
|
||||||
if ( ! &check_config()) {
|
if ( ! &check_config()) {
|
||||||
$pagedata->setValue('Data.Warning', 'NotConfigured');
|
$pagedata->setValue('Data.Warning', 'NotConfigured');
|
||||||
|
@ -183,6 +199,7 @@ if ($query->param) {
|
||||||
&umount_vol();
|
&umount_vol();
|
||||||
$pagedata->setValue('Data.Action', 'mount_form');
|
$pagedata->setValue('Data.Action', 'mount_form');
|
||||||
}
|
}
|
||||||
|
################ mount_do ########################
|
||||||
} elsif ($action eq 'mount_do') {
|
} elsif ($action eq 'mount_do') {
|
||||||
# mount requested
|
# mount requested
|
||||||
if ( ! &check_config()) {
|
if ( ! &check_config()) {
|
||||||
|
@ -203,6 +220,7 @@ if ($query->param) {
|
||||||
&mount_vol($query->param('password'));
|
&mount_vol($query->param('password'));
|
||||||
$pagedata->setValue('Data.Action', 'umount_form');
|
$pagedata->setValue('Data.Action', 'umount_form');
|
||||||
}
|
}
|
||||||
|
################## mount_ask #######################
|
||||||
} elsif ($action eq 'mount_ask') {
|
} elsif ($action eq 'mount_ask') {
|
||||||
if ( ! &check_config()) {
|
if ( ! &check_config()) {
|
||||||
$pagedata->setValue('Data.Warning', 'NotConfigured');
|
$pagedata->setValue('Data.Warning', 'NotConfigured');
|
||||||
|
@ -216,6 +234,7 @@ if ($query->param) {
|
||||||
} else {
|
} else {
|
||||||
$pagedata->setValue('Data.Action', 'mount_form');
|
$pagedata->setValue('Data.Action', 'mount_form');
|
||||||
}
|
}
|
||||||
|
################# umount_ask ########################
|
||||||
} elsif ($action eq 'umount_ask') {
|
} elsif ($action eq 'umount_ask') {
|
||||||
if ( ! &check_config()) {
|
if ( ! &check_config()) {
|
||||||
$pagedata->setValue('Data.Warning', 'NotConfigured');
|
$pagedata->setValue('Data.Warning', 'NotConfigured');
|
||||||
|
@ -226,6 +245,7 @@ if ($query->param) {
|
||||||
} else {
|
} else {
|
||||||
$pagedata->setValue('Data.Action', 'umount_form');
|
$pagedata->setValue('Data.Action', 'umount_form');
|
||||||
}
|
}
|
||||||
|
################## init_ask #########################
|
||||||
} elsif ($action eq 'init_ask') {
|
} elsif ($action eq 'init_ask') {
|
||||||
if (&check_init_running()) {
|
if (&check_init_running()) {
|
||||||
$pagedata->setValue('Data.Warning', 'InitNotFinished');
|
$pagedata->setValue('Data.Warning', 'InitNotFinished');
|
||||||
|
@ -236,6 +256,7 @@ if ($query->param) {
|
||||||
} else {
|
} else {
|
||||||
$pagedata->setValue('Data.Action', 'init_form');
|
$pagedata->setValue('Data.Action', 'init_form');
|
||||||
}
|
}
|
||||||
|
#################### init_do ########################
|
||||||
} elsif ($action eq 'init_do') {
|
} elsif ($action eq 'init_do') {
|
||||||
if ($query->param('password') ne $query->param('password2')) {
|
if ($query->param('password') ne $query->param('password2')) {
|
||||||
# different passwords
|
# different passwords
|
||||||
|
@ -254,6 +275,7 @@ if ($query->param) {
|
||||||
&box_init($query->param('password'));
|
&box_init($query->param('password'));
|
||||||
$pagedata->setValue('Data.Action', 'config_form');
|
$pagedata->setValue('Data.Action', 'config_form');
|
||||||
}
|
}
|
||||||
|
#################### config_ask ######################
|
||||||
} elsif ($action eq 'config_ask') {
|
} elsif ($action eq 'config_ask') {
|
||||||
if ( ! &check_config()) {
|
if ( ! &check_config()) {
|
||||||
$pagedata->setValue('Data.Warning', 'NotConfigured');
|
$pagedata->setValue('Data.Warning', 'NotConfigured');
|
||||||
|
@ -261,24 +283,30 @@ if ($query->param) {
|
||||||
} else {
|
} else {
|
||||||
$pagedata->setValue('Data.Action', 'config_form');
|
$pagedata->setValue('Data.Action', 'config_form');
|
||||||
}
|
}
|
||||||
|
#################### config_do #######################
|
||||||
} elsif ($action eq 'config_do') {
|
} elsif ($action eq 'config_do') {
|
||||||
# TODO: not implemented yet!
|
# TODO: not implemented yet!
|
||||||
system("$CB_SCRIPT", "set_config", "language", $query->param('language'));
|
system("$CB_SCRIPT", "set_config", "language", $query->param('language'));
|
||||||
system("$CB_SCRIPT", "set_config", "timeout", $query->param('timeout'));
|
system("$CB_SCRIPT", "set_config", "timeout", $query->param('timeout'));
|
||||||
system("$CB_SCRIPT", "set_config", "ip", $query->param('ip'));
|
system("$CB_SCRIPT", "set_config", "ip", $query->param('ip'));
|
||||||
$pagedata->setValue('Data.Action', 'intro');
|
$pagedata->setValue('Data.Action', 'intro');
|
||||||
|
#################### show_log ########################
|
||||||
} elsif ($action eq 'show_log') {
|
} elsif ($action eq 'show_log') {
|
||||||
$pagedata->setValue('Data.Action', 'show_log');
|
$pagedata->setValue('Data.Action', 'show_log');
|
||||||
|
##################### doc ############################
|
||||||
} elsif ($action eq 'doc') {
|
} elsif ($action eq 'doc') {
|
||||||
if ($query->param('page')) {
|
if ($query->param('page')) {
|
||||||
$pagedata->setValue('Data.Doc.Page', $query->param('page'));
|
$pagedata->setValue('Data.Doc.Page', $query->param('page'));
|
||||||
|
$pagedata->setValue('Data.Action', 'doc');
|
||||||
} else {
|
} else {
|
||||||
$pagedata->setValue('Data.Doc.Page', 'CryptoBox.html');
|
$pagedata->setValue('Data.Doc.Page', 'CryptoBox.html');
|
||||||
|
$pagedata->setValue('Data.Action', 'doc');
|
||||||
}
|
}
|
||||||
$pagedata->setValue('Data.Action', 'doc');
|
################### unknown #########################
|
||||||
} else {
|
} else {
|
||||||
$pagedata->setValue('Data.Error', 'UnknownAction');
|
$pagedata->setValue('Data.Error', 'UnknownAction');
|
||||||
}
|
}
|
||||||
|
###################### default ##########################
|
||||||
} else {
|
} else {
|
||||||
$pagedata->setValue('Data.Action', 'intro');
|
$pagedata->setValue('Data.Action', 'intro');
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ body {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.warning {
|
.warning {
|
||||||
background-color: #FF6060;
|
background-color: #FF6060;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
Loading…
Reference in New Issue