summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Neves2012-06-25 17:53:44 +0200
committerMichael Neves2012-06-25 17:53:44 +0200
commit3a8652c5932db3e8c66ac40ce3a5343d41859ee6 (patch)
tree03c8346cad2c29eb828bdb49118944066937d890
parentipxe ssl image (diff)
downloadpbs2-3a8652c5932db3e8c66ac40ce3a5343d41859ee6.tar.gz
pbs2-3a8652c5932db3e8c66ac40ce3a5343d41859ee6.tar.xz
pbs2-3a8652c5932db3e8c66ac40ce3a5343d41859ee6.zip
https check in ipxe
-rw-r--r--application/modules/ipxe/controllers/AuthController.php27
-rw-r--r--application/modules/ipxe/controllers/ResourceController.php4
-rw-r--r--application/modules/ipxe/views/scripts/resource/getvesamenu.phtml6
3 files changed, 23 insertions, 14 deletions
diff --git a/application/modules/ipxe/controllers/AuthController.php b/application/modules/ipxe/controllers/AuthController.php
index 27feff7..ba10e5c 100644
--- a/application/modules/ipxe/controllers/AuthController.php
+++ b/application/modules/ipxe/controllers/AuthController.php
@@ -14,6 +14,7 @@ class Ipxe_AuthController extends Zend_Controller_Action {
protected $session;
protected $sessionMapper;
protected $error;
+ protected $httpmode;
public function init() {
$this->_helper->layout->disableLayout();
@@ -35,6 +36,14 @@ class Ipxe_AuthController extends Zend_Controller_Action {
$this->error = "session";
}
}
+
+ if(isset($_SERVER['HTTPS']))
+ {
+ if ($_SERVER['HTTPS'] == 'on')
+ $this->httpmode = 'https';
+ else
+ $this->httpmode = 'http';
+ }
}
public function serialAction() {
@@ -78,12 +87,12 @@ class Ipxe_AuthController extends Zend_Controller_Action {
$result = "#!ipxe\n";
if(isset($this->session)) {
- $result .= "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/".$this->error."\n";
+ $result .= "set filename ".$this->httpmode."://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/".$this->error."\n";
$result .= ":start\n";
- $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 \${filename}\n";
+ $result .= "chain ".$this->httpmode."://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 \${filename}\n";
$result .= "goto start\n";
} else {
- $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/serialnumber/$serialnumber/mac/$mac/error/$this->error\n";
+ $result .= "chain ".$this->httpmode."://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/serialnumber/$serialnumber/mac/$mac/error/$this->error\n";
}
header("Content-Length: ".(strlen($result)));
echo $result;
@@ -101,7 +110,7 @@ class Ipxe_AuthController extends Zend_Controller_Action {
$result .= "clear password\n";
$result .= "login\n";
$result .= "isset \${username} || set username null\n";
- $result .= "chain http://\${username:uristring}:\${password:uristring}@".$_SERVER['HTTP_HOST']."/ipxe/auth/login/alpha/".$alpha."\n";
+ $result .= "chain ".$this->httpmode."://\${username:uristring}:\${password:uristring}@".$_SERVER['HTTP_HOST']."/ipxe/auth/login/alpha/".$alpha."\n";
header("Content-Length: ".(strlen($result)));
echo $result;
exit;
@@ -111,7 +120,7 @@ class Ipxe_AuthController extends Zend_Controller_Action {
header('WWW-Authenticate: Basic realm=""');
header('HTTP/1.0 401 Unauthorized');
$result = "#!ipxe\n";
- $result .= "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/login\n";
+ $result .= "set filename ".$this->httpmode."://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/login\n";
header("Content-Length: ".(strlen($result)));
echo $result;
exit;
@@ -151,7 +160,7 @@ class Ipxe_AuthController extends Zend_Controller_Action {
header('Content-Type: text/plain');
$result = "#!ipxe\n";
- $result .= "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/".$this->error."\n";
+ $result .= "set filename ".$this->httpmode."://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/".$this->error."\n";
header("Content-Length: ".(strlen($result)));
echo $result;
exit;
@@ -174,7 +183,7 @@ class Ipxe_AuthController extends Zend_Controller_Action {
header('Content-Type: text/plain');
$result = "#!ipxe\n";
- $result .= "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/".$this->error."\n";
+ $result .= "set filename ".$this->httpmode."://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/".$this->error."\n";
header("Content-Length: ".(strlen($result)));
echo $result;
exit;
@@ -196,7 +205,7 @@ class Ipxe_AuthController extends Zend_Controller_Action {
header('Content-Type: text/plain');
$result = "#!ipxe\n";
- $result .= "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/".$this->error."\n";
+ $result .= "set filename ".$this->httpmode."://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/".$this->error."\n";
header("Content-Length: ".(strlen($result)));
echo $result;
exit;
@@ -219,7 +228,7 @@ class Ipxe_AuthController extends Zend_Controller_Action {
header('Content-Type: text/plain');
$result = "#!ipxe\n";
- $result .= "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/".$this->error."\n";
+ $result .= "set filename ".$this->httpmode."://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/".$this->error."\n";
header("Content-Length: ".(strlen($result)));
echo $result;
exit;
diff --git a/application/modules/ipxe/controllers/ResourceController.php b/application/modules/ipxe/controllers/ResourceController.php
index 3c1ce3a..0c96a36 100644
--- a/application/modules/ipxe/controllers/ResourceController.php
+++ b/application/modules/ipxe/controllers/ResourceController.php
@@ -64,9 +64,9 @@ class Ipxe_ResourceController extends Zend_Controller_Action {
if(isset($_SERVER['HTTPS']))
{
if ($_SERVER['HTTPS'] == 'on')
- $vesamenuView->ssl = true;
+ $vesamenuView->httpmode = 'https';
else
- $vesamenuView->ssl = false;
+ $vesamenuView->httpmode = 'http';
}
if (isset($this->session)) {
diff --git a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml
index 75b2a4f..cd00ff5 100644
--- a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml
+++ b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml
@@ -79,7 +79,7 @@
PROMPT 0
DEFAULT /ipxe/vesamenu.c32
-<?php if($this->ssl)
+<?php if($this->httpmode === 'https')
echo "MENU BACKGROUND /ipxe/pbs2ssl.png\n";
else
echo "MENU BACKGROUND /ipxe/pbs2.png\n";?>
@@ -159,10 +159,10 @@ MENU MSGCOLOR #ff1c2a33 #00000000 none
if($bme->getKcl() && $kcl != null){
uriboot ( $bme->getTitle(),
- "http://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=http://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs $kcl alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
+ "$this->httpmode://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=$this->httpmode://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs $kcl alpha=$this->alphaID file=$this->httpmode://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
}else{
uriboot ( $bme->getTitle(),
- "http://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=http://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
+ "$this->httpmode://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=$this->httpmode://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs alpha=$this->alphaID file=$this->httpmode://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
}
}
}else{