diff options
| author | michael pereira | 2011-07-18 13:14:19 +0200 |
|---|---|---|
| committer | michael pereira | 2011-07-18 13:14:19 +0200 |
| commit | 83fee3ad5545e3902519cf7cc0fb44d56e881f22 (patch) | |
| tree | 54e846f596486b31c8f4669d0619305200e0bc6c /application | |
| parent | ipxe.lkrn (diff) | |
| download | pbs2-83fee3ad5545e3902519cf7cc0fb44d56e881f22.tar.gz pbs2-83fee3ad5545e3902519cf7cc0fb44d56e881f22.tar.xz pbs2-83fee3ad5545e3902519cf7cc0fb44d56e881f22.zip | |
login fuer ipxe
Diffstat (limited to 'application')
4 files changed, 41 insertions, 340 deletions
diff --git a/application/modules/ipxe/controllers/AuthController.php b/application/modules/ipxe/controllers/AuthController.php index 12a897b..ba06456 100644 --- a/application/modules/ipxe/controllers/AuthController.php +++ b/application/modules/ipxe/controllers/AuthController.php @@ -69,8 +69,9 @@ class Ipxe_AuthController extends Zend_Controller_Action $result = "#!ipxe\n"; $result .= "imgfree\n"; - - $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenu/alpha/".$session->getAlphasessionID()." http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$session->getAlphasessionID(); + $result .= "login\n"; + + $result .= "chain http://\${username:uristring}:\${password:uristring}@".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenu/alpha/".$session->getAlphasessionID()." http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$session->getAlphasessionID(); header("Content-Length: ".(strlen($result))); diff --git a/application/modules/ipxe/controllers/IndexController.php b/application/modules/ipxe/controllers/IndexController.php deleted file mode 100644 index e1211c6..0000000 --- a/application/modules/ipxe/controllers/IndexController.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php -/* - * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg - * This program is free software distributed under the GPL version 2. - * See http://gpl.openslx.org/ - * - * If you have any feedback please consult http://feedback.openslx.org/ and - * send your suggestions, praise, or complaints to feedback@openslx.org - * - * General information about OpenSLX can be found at http://openslx.org/ - */ - -class Ipxe_IndexController extends Zend_Controller_Action -{ - protected $membership; - - public function init() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - } - - public function errorAction() - { - $result = $this->_request->getParam('serialresult'); - if($result != ""){ - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('serial',$result); - } - } - - public function indexAction() - { - $mySession = new Zend_Session_Namespace('pbs'); - - if(count($mySession->postdata)<=0){ - $mySession->postdata = $_POST; - } - -// $d = new Pbs_Debug(); -// $d->debug(array('IpxeIndexController',$_SERVER['REMOTE_ADDR'],implode("\t",$mySession->postdata))); - - if(isset($mySession->postdata['serialnumber'])){ - // Create a session - $n = new Pbs_Session(); - - $bootisomapper = new Application_Model_BootIsoMapper(); - $bootiso = new Application_Model_BootIso(); - - $results = $bootisomapper->findBy(array('serialnumber' => $mySession->postdata['serialnumber']),true); - if(count($results) == 0){ - $this->_redirect('/ipxe/index/error/serialresult/noserial2'); - } - $bootiso->setOptions($results[0]); - $bootiso->setID($results[0]['bootisoID']); - $groupID = $bootiso->getGroupID(); - - - - $client = new Application_Model_Client(); - $client->setMacadress($mySession->postdata['mac']); - $client->setGroupID($groupID); - $client->setCreated(time()); - $client = $n->createClient($client); - $clientID = $client->getID(); - - $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); - - if(!isset($_SESSION['alphasessionID'])){ - $session = new Application_Model_Session(); - $session->setBootisoID($bootiso->getID()); - $session->setClientID($clientID); - $session->setTime(time()); - if($this->membership->getID() != ''){ - $session->setMembershipID($this->membership->getID()); - } - $session->setIp($_SERVER['REMOTE_ADDR']); - $session = $n->createSession($session); - $_SESSION['alphasessionID'] = $session->getAlphasessionID(); - } - else{ - $session = new Application_Model_Session(); - $sessionMapper = new Application_Model_SessionMapper(); - $sessions = $sessionMapper->findBy(array('alphasessionID'=>$_SESSION['alphasessionID'])); - $session = $sessions[0]; - } -// // Request Bootmenu -// $pbsFilter = new Pbs_Filter(); -// $bootmenuID = $pbsFilter->evaluate(); -// if($bootmenuID != null){ -// $this->view->alphasessionID = $_SESSION['alphasessionID']; -// // print_a('Debug Output', -// // 'Session is now set', -// // 'Your sessionID is '.$session->getID(), -// // 'Your alphasessionID is '.$session->getAlphasessionID(), -// // 'Your client is '.$session->getClientID(), -// // 'goto bootmenu '.$bootmenuID); -// -// $bootmenuMapper = new Application_Model_BootMenuMapper(); -// $bm = $bootmenuMapper->find($bootmenuID); -// $this->view->title = $bm->getTitle(); -// $this->view->startcounter = $bm->getStartcounter(); -// -// $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); -// $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false); -// $this->view->entries = $res; -// -// } -// else{ -// // print_a('Debug Output', -// // 'Session is now set', -// // 'Your sessionID is '.$session->getID(), -// // 'Your alphasessionID is '.$session->getAlphasessionID(), -// // 'Your client is '.$session->getClientID(), -// // 'there is no bootmenu for you'); -// if (!Zend_Auth::getInstance()->hasIdentity()) { -// $this->view->loginmenu = true; -// $pbsNotifier = new Pbs_Notifier(); -// $this->view->notification = $pbsNotifier->notify("There is no default BootMenu, please Login to get your BootMenu.",'info'); -// } -// else{ -// $pbsNotifier = new Pbs_Notifier(); -// $this->view->notification = $pbsNotifier->notify("You have no BootMenu.",'info'); -// } -// $this->view->nobootmenu = true; -// } - } - else{ - $this->_redirect('/ipxe/index/error/serialresult/noserial'); - } - - } - public function startAction(){ - $bootmenuntryID = $this->_request->getParam('bme'); - $a = $_SESSION['alphasessionID']; - $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); - $bootmenuentry = new Application_Model_BootMenuEntries(); - $bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry); - - $sessionMapper = new Application_Model_SessionMapper(); - $session_k = $sessionMapper->findBy(array('alphasessionID' => $a),true); - - $session = new Application_Model_Session(); - $session->setOptions($session_k[0]); - $session->setID($session_k[0]['sessionID']); - - $session->setBootmenuentryID($bootmenuntryID); - $session->setBootosID($bootmenuentry->getBootosID()); - $sessionMapper->save($session); - - - $this->view->host = 'pbs2.mp.openslx.org'; - $this->view->alphasessionID = $a; - } - -} diff --git a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml index dc9892e..0e00f9c 100644 --- a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml +++ b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml @@ -1,7 +1,7 @@ <?php -// $username = $_SERVER["PHP_AUTH_USER"]; -// $password = $_SERVER["PHP_AUTH_PW"]; + $username = $_SERVER["PHP_AUTH_USER"]; + $password = $_SERVER["PHP_AUTH_PW"]; $index = 0; @@ -53,11 +53,11 @@ global $password; switch ( "$username:$password" ) { - case "test:test": - case "guest:guest": - return 1; - default: - return 0; + case "test:test": + case "guest:guest": + return 1; + default: + return 0; } } @@ -102,37 +102,38 @@ menu color sel 7;37;40 #ff1c2a33 #667799bb all MENU MSGCOLOR #ff1c2a33 #00000000 none <? - if(!isset($this->error)) - title ( $this->title ); - else - title($this->error); - -// if ( ! authenticated() ) { -// retry(); -// } else { -// -// if ( $username == "test" ) { -// -// localboot(); -// } - -$bootosmapper = new Application_Model_BootOsMapper(); - -if(isset($this->bmelist)){ - foreach($this->bmelist as $bme){ - - $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl(); + if(!isset($this->error)) + title ( $this->title ); + else + title($this->error); + + if ( ! authenticated() ) { + retry(); + } else { - 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()); - }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()); + if ( $username == "test" ) { + + localboot(); } - } -} + } + +//$bootosmapper = new Application_Model_BootOsMapper(); +// +//if(isset($this->bmelist)){ +// foreach($this->bmelist as $bme){ +// +// $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl(); +// +// 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()); +// }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()); +// } +// } +//} +// +//localboot(); -localboot(); - ?>
\ No newline at end of file diff --git a/application/views/scripts/resource/getvesamenu.phtml b/application/views/scripts/resource/getvesamenu.phtml deleted file mode 100644 index c920d65..0000000 --- a/application/views/scripts/resource/getvesamenu.phtml +++ /dev/null @@ -1,144 +0,0 @@ -<?php - -// $username = $_SERVER["PHP_AUTH_USER"]; -// $password = $_SERVER["PHP_AUTH_PW"]; - - $index = 0; - - function title ( $title ) { - global $username; - echo "menu title ".$title; - echo ( $username ? " for ".$username : "" )."\n"; - } - - function label ( $label ) { - global $index; - $index++; - echo "label item".$index."\n"; - echo " menu label "; - echo "^".( ( $index < 10 ) ? $index : - sprintf ( "%c", $index + ord ( 'A' ) - 10 ) )." "; - echo $label."\n"; - } - - function uriboot ( $label, $uri, $args ) { - label ( $label ); - echo " kernel ".$uri."\n"; - if ( $args ) - echo " append ".$args."\n"; - } - - function localboot () { - label ( "LOCALBOOT"); - echo "LOCALBOOT -1\n"; - texthelp("Gets you out of here by booting from next device in BIOS boot - order."); - } - - function texthelp ( $texthelp ){ - echo "TEXT HELP\n"; - echo $texthelp."\n"; - echo "ENDTEXT\n"; - } - - function retry () { - echo "label failed\n"; - echo " menu label Authentication Failed\n"; - echo " menu disable\n"; - uriboot ( "Try again", "ipxe.php", "" ); - } - - function authenticated () { - global $username; - global $password; - - switch ( "$username:$password" ) { - case "test:test": - case "guest:guest": - return 1; - default: - return 0; - } - } - - ?> -TIMEOUT 100 -PROMPT 0 -DEFAULT vesamenu.c32 - -MENU BACKGROUND http://pbs2.mp.openslx.org/media/img/pbs2.png -MENU WIDTH 78 -MENU MARGIN 9 -MENU PASSWORDMARGIN 9 -MENU ROWS 10 -MENU TABMSGROW 16 -MENU CMDLINEROW 16 -MENU ENDROW -1 -MENU PASSWORDROW 16 -MENU TIMEOUTROW 20 -MENU HELPMSGROW 16 -MENU HELPMSGENDROW -1 -MENU HSHIFT 0 -MENU VSHIFT 7 - -#menu color screen 37;40 #80ffffff #00000000 std -menu color border 37;40 #00000000 #00000000 std -menu color title 1 #ee004a99 #00000000 all -menu color unsel 37;40 #ff4f75aa #00000000 all -menu color hotkey 1;37;40 #ffff8b00 #ff8093a1 std -menu color sel 7;37;40 #ff1c2a33 #667799bb all -#menu color hotsel 1;7;37;40 #ffff8b00 #667799bb all -#menu color disabled 1;37;40 #ffff8b00 #ff8093a1 std -#menu color scrollbar 37;40 #40000000 #ee000000 std -#menu color tabmsg 37;40 #ffff8b00 #ff8093a1 std -#menu color cmdmark 1;37;40 #ffff8b00 #ff8093a1 std -#menu color cmdline 37;40 #fff0f0f0 #ff8093a1 std -#menu color pwdborder 37;40 #40000000 #ff8093a1 std -#menu color pwdheader 37;40 #ffff8b00 #ff8093a1 std -#menu color pwdentry 37;40 #ffff8b00 #ff8093a1 std -#menu color timeout_msg 37;40 #fff0f0f0 #ff8093a1 std -#menu color timeout 1;37;40 #ffff8b00 #ff8093a1 std -#menu color help 37;40 #ff1c2a33 #00000000 none -MENU MSGCOLOR #ff1c2a33 #00000000 none - -<? - -// title ( "Welcome to OpenSLX PreBoot USB Ext2/3 (Mini Linux/Kexec)" ); -// -// if ( ! authenticated() ) { -// retry(); -// } else { -// -// if ( $username == "test" ) { -// -// localboot(); -// } -foreach($bmelist as $bmelist){ - -uriboot ( "Ubuntu 10.04", - "http://$this->host/resource/getkernel/alpha/0/bootmenuentryID/7/file/kernel", "initrd=http://$this->host/resource/getinitramfs/alpha/0/bootmenuentryID/7/file/initramfs alpha=0 file=http://$this->host/resource/getconfig/alpha/0/bootmenuentryID/7/file/default.tgz"); - -} - -localboot(); -// } - -// LABEL SLXSTDBOOT -// MENU LABEL -// KERNEL kernel -// APPEND initrd=init vga=0x317 -// TEXT HELP -// Use this (default) entry if you have configured your client. -// You have chance to edit the kernel commandline by hitting the -// TAB key (e.g. for adding debug=3 to it for bug hunting) ... -// ENDTEXT -//LABEL DEBUGBOOT -// MENU LABEL OpenSLX PreBoot - Debug Mode -// KERNEL kernel -// APPEND initrd=init vga=0x317 debug=3 -// TEXT HELP -// Use this to start the preboot environment with debug shells. -// ENDTEXT - - - ?>
\ No newline at end of file |
