iPXE/PHP
|
2012-09-17, 11:15
Post: #1
|
|||
|
|||
iPXE/PHP
Hi!
I am pretty new to iPXE, but fell in love when I could build dynamic around my menus. As of $NOW I have a working installmenu /dynamic, which allows reinstall, based on if we can find our MACADDRESS in a hostfile together with a HOSTNAME, that sets this hostname together with a bunch of other variables. If its a new computer we have a password protected menu, and hostname as input (we dont allow our users to install new computers, for that we use our IT-personell). I have som simple problems with PHP in my iPXE menu (which I have ignored (found other solutions), but I dont understanda why PHP is behaving the way it does (I am testing my PHP scripts in a browser before I try on the iPXE menu). * How does actually PHP work together with iPXE? * Can I do everything in iPXE with PHP as I can do on a website with a browser reading? * Some simple logic in my menu like turning on and off a variable does not work (instead iPXE runs brutally over the variables, and sets them instead of checking, even if I use "===" my If/elseif it is not working as it should (the logic is working correctly in my browser ) Everything in iPXE with PHP is running on the server right? I can use shell_exec and use the output to something useful. Like ls and get back a filelist on the server. Read and write files on the server. $_SERVER variables is also giving me the server IP For instance (atm) I am using the "login" menu to check username/password, with iseq (what bothers me is that this password is in clear text if anyone tries to read this menu with a browser, if they know the filename of course I tried to use simple PHP logic for cheking this password, and go back to "login" if not correct. But PHP is not able to do that (in iPXE). Why is PHP in iPXE not always working as PHP does on my browser... Its hard to find some documents around this, so any input/advice etc? Regards, Torgeir (When I am doneTweaking/optimizing the menu, Ill be happy to share my findings/solutions. |
|||
2012-09-17, 11:55
Post: #2
|
|||
|
|||
RE: iPXE/PHP
I think you should post some code for what you're trying to do. Please post the setting you use in your DHCP server to load the initial iPXE script, and if that points to a PHP file, it would be useful if you post the PHP script (with any sensitive information garbled) so any PHP wizard can see where things go wrong.
|
|||
2012-09-17, 13:44
(This post was last modified: 2012-09-17 14:10 by Torgeir.)
Post: #3
|
|||
|
|||
RE: iPXE/PHP
Hi!
Ive tried with different configs: Config 1: With undionly.kpxe built from git (newest version) Code: if exists user-class and option user-class = "iPXE" { Config 2 (which i prefer. With our current config in mind): With ipxe linux kernel built from git (newest version) make bin/ipxe.lkrn EMBED=dhcp.ipxe with an ipxe script: Code: #!ipxe DHCP option Code: if exists user-class and option user-class = "iPXE" { And with this in my pxelinux.cfg/default Code: label ipxe For various reasons, Ive tried to make undinoly.kpxe/ipxe.lkrn with and without EMBED scripts (with our current config in mind). The example is as easy as this (this was written by hand, no copy/paste, so may contain "bugs" But the logic should be clear. PURE PHP login.php (This login does work as intended) Code: $user = "torgeir"; login.check.php (chain login.check2.php with arguments $_REQUEST. I know I'm not using MAC in this one, but this is the way my menu is working. Code: header ("Content-type: text/plain"); login.check2.php (this logic is not working) Code: header ("Content-type: text/plain"); |
|||
2012-09-18, 07:29
(This post was last modified: 2012-09-18 07:29 by Torgeir.)
Post: #4
|
|||
|
|||
RE: iPXE/PHP
Got it working with this:
login.check.php Code: <? login.check2.php Code: <? |
|||
2012-09-18, 11:52
(This post was last modified: 2018-11-08 21:55 by Torgeir.)
Post: #5
|
|||
|
|||
RE: iPXE/PHP
Edit: cleanup!
— Torgeir |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)