diff options
Diffstat (limited to 'application/modules/ipxe/controllers')
-rw-r--r-- | application/modules/ipxe/controllers/ResourceController.php | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/application/modules/ipxe/controllers/ResourceController.php b/application/modules/ipxe/controllers/ResourceController.php index 8ca9195..686abab 100644 --- a/application/modules/ipxe/controllers/ResourceController.php +++ b/application/modules/ipxe/controllers/ResourceController.php @@ -253,7 +253,7 @@ class Ipxe_ResourceController extends Zend_Controller_Action { }else{ $result .= "imgargs kernel alpha=".$this->session->getAlphasessionID()." file=$this->httpmode://$this->host/c/".$this->session->getAlphasessionID()."/default.tgz ".$bootmenuentry->getKclappend()."\n"; } - //$result .= "boot"; + $result .= "boot"; } else { $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/serialnumber/$serialnumber/mac/$mac/error/session\n"; @@ -264,6 +264,52 @@ class Ipxe_ResourceController extends Zend_Controller_Action { } + public function boottrustedsystemAction() { + + $bootmenuntryID = $this->_request->getParam('bme'); + + if(isset($bootmenuntryID) && isset($this->session)) { + //TODO check if allowed + $sessionMapper = new Application_Model_SessionMapper(); + $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); + $bootmenuentry = new Application_Model_BootMenuEntries(); + $bootmenuentriesMapper->find($bootmenuntryID, $bootmenuentry); + + $this->session->setBootmenuentryID($bootmenuntryID); + $this->session->setBootosID($bootmenuentry->getBootosID()); + $sessionMapper->save($this->session); + } + + header('Content-Type: text/plain'); + + $result = "#!ipxe\n"; + if(isset($this->session)) { + $bootosID = $this->session->getBootosID(); + $bootosmapper = new Application_Model_BootOsMapper(); + + $kcl = $bootosmapper->find($bootosID)->getDefaultkcl(); + + $result .= "imgtrust --permanent"; + $result .= "kernel --name kernel $this->httpmode://$this->host/ipxe/resource/getkernel/alpha/".$this->session->getAlphasessionID()."\n"; + $result .= "imgverify kernel $this->httpmode://$this->host/ipxe/resource/getsignature/file/kernel/alpha/".$this->session->getAlphasessionID()."\n"; + $result .= "initrd --name initramfs $this->httpmode://$this->host/ipxe/resource/getinitramfs/alpha/".$this->session->getAlphasessionID()."\n"; + $result .= "imgverify initramfs $this->httpmode://$this->host/ipxe/resource/getsignature/file/initramfs/alpha/".$this->session->getAlphasessionID()."\n"; + + if($bootmenuentry->getKcl() && $kcl != null){ + $result .= "imgargs kernel $kcl alpha=".$this->session->getAlphasessionID()." file=$this->httpmode://$this->host/c/".$this->session->getAlphasessionID()."/default.tgz ".$bootmenuentry->getKclappend()."\n"; + }else{ + $result .= "imgargs kernel alpha=".$this->session->getAlphasessionID()." file=$this->httpmode://$this->host/c/".$this->session->getAlphasessionID()."/default.tgz ".$bootmenuentry->getKclappend()."\n"; + } + $result .= "boot"; + + } else { + $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/serialnumber/$serialnumber/mac/$mac/error/session\n"; + } + header("Content-Length: ".(strlen($result))); + echo $result; + + + } } |