diff options
-rw-r--r-- | apis/exec.inc.php | 5 | ||||
-rw-r--r-- | inc/crypto.inc.php | 2 | ||||
-rw-r--r-- | modules/sysconfig.inc.php | 3 | ||||
-rw-r--r-- | templates/page-ipxe.html | 6 | ||||
-rw-r--r-- | templates/txt-pxeconfig.html | 18 |
5 files changed, 21 insertions, 13 deletions
diff --git a/apis/exec.inc.php b/apis/exec.inc.php index 749ca86a..60ca679f 100644 --- a/apis/exec.inc.php +++ b/apis/exec.inc.php @@ -47,6 +47,8 @@ switch ($type) { case 'ipxe': if (!isset($_REQUEST['ip'])) die('No IP given'); $ip = preg_replace('/[^0-9\.]/', '', $_REQUEST['ip']); + $default = $_REQUEST['default']; + if (!preg_match('/openslx|hddboot/', $default)) $default = 'openslx'; $command = '/opt/openslx/build_ipxe.sh "' . CONFIG_IPXE_DIR . '/last-ip" "' . $ip . '"'; $conf = Render::parse('txt-ipxeconfig', array( 'SERVER' => $ip @@ -54,7 +56,8 @@ case 'ipxe': if (false === file_put_contents('/opt/openslx/ipxe/ipxelinux.ipxe', $conf)) die('Error writing iPXE Config'); $conf = Render::parse('txt-pxeconfig', array( 'SERVER' => $ip, - 'DEFAULT' => 'openslx' + 'DEFAULT' => $default, + $default => 'MENU DEFAULT' )); if (false === file_put_contents(CONFIG_TFTP_DIR . '/pxelinux.cfg/default', $conf)) die('Error writing PXE Menu'); Database::exec("INSERT IGNORE INTO setting_global (setting, value) VALUES ('SLX_VM_NFS', :value)", array(':value' => "$ip:/srv/openslx/nfs")); diff --git a/inc/crypto.inc.php b/inc/crypto.inc.php index 54cdef8a..56f5073c 100644 --- a/inc/crypto.inc.php +++ b/inc/crypto.inc.php @@ -10,7 +10,7 @@ class Crypto */ public static function hash6($password) { - $salt = substr(str_replace('+', '.', base64_encode(pack('N4', mt_rand(), mt_rand(), mt_rand(), mt_rand()))), 0, 22); + $salt = substr(str_replace('+', '.', base64_encode(pack('N4', mt_rand(), mt_rand(), mt_rand(), mt_rand()))), 0, 16); $hash = crypt($password, '$6$' . $salt); if (strlen($hash) < 60) Util::traceError('Error hashing password using SHA-512'); return $hash; diff --git a/modules/sysconfig.inc.php b/modules/sysconfig.inc.php index 063ae65d..c883eb68 100644 --- a/modules/sysconfig.inc.php +++ b/modules/sysconfig.inc.php @@ -17,7 +17,8 @@ if (isset($_POST['action']) && $_POST['action'] === 'upload') { $dest = $_FILES['customtgz']['name']; $dest = preg_replace('/[^a-z0-9\-_]/', '', $dest); $dest = substr($dest, 0, 30); - if (substr($dest, -3) !== 'tgz') $dest .= '.tgz'; + if (substr($dest, -3) === 'tgz') $dest = substr($dest, 0, -3); + $dest .= '.tgz'; # TODO: Validate its a (compressed) tar? if (move_uploaded_file($_FILES['customtgz']['tmp_name'], CONFIG_TGZ_LIST_DIR . '/' . $dest)) { Message::addSuccess('upload-complete', $dest); diff --git a/templates/page-ipxe.html b/templates/page-ipxe.html index 7910c5af..ba56582e 100644 --- a/templates/page-ipxe.html +++ b/templates/page-ipxe.html @@ -5,7 +5,11 @@ </div> {{#ips}} <div class="panel-body">{{ip}} - <a class="btn btn-success" href="#" onclick="this.style.display='none';loadContent('#compiler', 'api.php?do=exec&type=ipxe&ip={{ip}}&id=compiler')">Kompilieren</a>{{#current}} (Aktuelle Konfiguration){{/current}} + <span> + <a class="btn btn-success" href="#" onclick="this.parentNode.style.display='none';loadContent('#compiler', 'api.php?do=exec&type=ipxe&ip={{ip}}&id=compiler&default=hddboot')">Kompilieren (HDD Default)</a> + <a class="btn btn-success" href="#" onclick="this.parentNode.style.display='none';loadContent('#compiler', 'api.php?do=exec&type=ipxe&ip={{ip}}&id=compiler&default=openslx')">Kompilieren (OpenSLX Default)</a> + {{#current}}(Aktuelle Konfiguration){{/current}} + </span> </div> {{/ips}} </div> diff --git a/templates/txt-pxeconfig.html b/templates/txt-pxeconfig.html index 6998a205..acef8802 100644 --- a/templates/txt-pxeconfig.html +++ b/templates/txt-pxeconfig.html @@ -39,8 +39,8 @@ menu color help 37;40 #ff1c2a33 #00000000 none MENU MSGCOLOR #ff1c2a33 #00000000 none -TIMEOUT 10 -TOTALTIMEOUT 120 +TIMEOUT 100 +TOTALTIMEOUT 1200 MENU TITLE bwLehrpool ALPHA VERSION ONTIMEOUT {{{DEFAULT}}} @@ -54,15 +54,15 @@ LABEL shutdown LABEL openslx - MENU LABEL bwLehrpool ^Kursumgebung - KERNEL http://{{{SERVER}}}/boot/default/kernel - INITRD http://{{{SERVER}}}/boot/default/initramfs-stage31 - APPEND slxsrv={{{SERVER}}} slxbase=boot/default - IPAPPEND 3 + MENU LABEL bwLehrpool ^Kursumgebung + KERNEL http://{{{SERVER}}}/boot/default/kernel + INITRD http://{{{SERVER}}}/boot/default/initramfs-stage31 + APPEND slxsrv={{{SERVER}}} slxbase=boot/default + IPAPPEND 3 + {{{openslx}}} LABEL hddboot MENU LABEL Von ^lokaler Festplatte booten LOCALBOOT 0 - - + {{{hddboot}}} |