no drive should stay no drive in web. Createkey, gitignore

This commit is contained in:
mad 2018-09-23 15:51:44 +02:00
parent 3367b8a13f
commit 223090c0e4
3 changed files with 15 additions and 2 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.key
*.crt

9
nlvmi
View File

@ -102,7 +102,10 @@ function createdb {
fi fi
checkdb && echo "DB creation successful!" || (echo "Failed to create the DB"; exit 1) checkdb && echo "DB creation successful!" || (echo "Failed to create the DB"; exit 1)
} }
#create signing key
function createkey {
openssl req -nodes -x509 -sha256 -newkey rsa:4096 -keyout "nlvmi_priv.key" -out "nlvmi_sign.crt" -days 9999 -subj "/CN=nlvmi_signing"
}
#autostart VMs #autostart VMs
function vmautostart { function vmautostart {
if [ $DATABASETYPE == "sqlite" ]; then if [ $DATABASETYPE == "sqlite" ]; then
@ -291,6 +294,10 @@ if [ $# -gt 0 ]; then
echo "not allowed"; echo "not allowed";
fi fi
fi fi
elif [ $1 == "createkey" ]; then
if [ ! -z $MASTERSERVER ]; then
createkey
fi
fi fi
else else
checkdb checkdb

View File

@ -42,7 +42,7 @@ function serverdepropdown($server, $val, $what){
echo "<a class=dropdown-item href=\"javascript:dropdown('".$what."button','$file[$lastpart]')\">$file[$lastpart]</a>"; echo "<a class=dropdown-item href=\"javascript:dropdown('".$what."button','$file[$lastpart]')\">$file[$lastpart]</a>";
} }
} }
echo "$enddiv</div></div></div><input type=hidden id=".$what."buttonh name=$what value=$val>"; echo "$enddiv</div></div></div><input type=hidden id=".$what."buttonh name=$what value=\"$val\">";
} }
function formatbuttons($label, $val){ function formatbuttons($label, $val){
echo "<div class=row><div class=col>$label</div><div class=col><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=".$label."button$label data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>"; echo "<div class=row><div class=col>$label</div><div class=col><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=".$label."button$label data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
@ -290,6 +290,8 @@ if (isset($_SESSION['username'])){
$rvalue = clean($_REQUEST[$rkey]); $rvalue = clean($_REQUEST[$rkey]);
if ($rvalue == "x86_64"){ if ($rvalue == "x86_64"){
$rvalue = "qemu-system-x86_64"; $rvalue = "qemu-system-x86_64";
} elseif ((preg_match('/no drive/', $rvalue))||($rvalue == "no cdrom")){
$rvalue = "";
} }
$sqlc .= "$rkey,"; $sqlc .= "$rkey,";
$sqlv .= "'$rvalue',"; $sqlv .= "'$rvalue',";
@ -318,6 +320,8 @@ if (isset($_SESSION['username'])){
} }
if ($rvalue == "x86_64"){ if ($rvalue == "x86_64"){
$rvalue = "qemu-system-x86_64"; $rvalue = "qemu-system-x86_64";
} elseif ((preg_match('/no drive/', $rvalue))||($rvalue == "no cdrom")){
$rvalue = "";
} }
$sql .= " $rkey='$rvalue',"; $sql .= " $rkey='$rvalue',";
} }