Help With Advanced Menu with Login
-
@sebastian-roth here goes the info you asked:
Pastebin output from http://10.6.23.8/fog/service/ipxe/boot.php?mac=b8:ae:ed:85:3e:65
Pastebin output from http://10.6.23.8/fog/service/ipxe/advanced.php?login=1&username=fog&password=password
About the Hirens, yes, i can download from the URL. To make it work, i used this method, from @haylander (thanks, btw!), in this topic
-
Well? Anyone have insights about this? Should I try another version of FOG, perhaps one directly from GitHub?
-
@scosta Well, afaik, FOG went from 1.4.4 to 1.5, so not sure how you have 1.4.5
-
@quazz Typoed version, it is 1.5.4 they’re using.
@scosta What i’m seeing is:
#!ipxe clear username clear password login params param username ${username} param password ${password} chain ${boot-url}/service/ipxe/advanced.php##params #!ipxe
Do you know where the second
#!ipxe
is coming from? As far as I can tell, this is where things are breaking down. Essentially what it’s doing is clearing the login information, rebuilding it, then restarting the whole of iPXE. This would explain why you’re seeing an error.The advanced menu itself, should not be edited from the Boot Menu element, beyond telling it to display to all hosts if thats how you want it. However, you shouldn’t need to change this portion. You would put your information under:
FOG Configuration Page->FOG Settings->FOG_PXE_ADVANCED
In the advanced side you would put your necessary items, like your Hirens bootCD information.
The advanced menu element hasn’t changed in quite some time, and I’ll admit I haven’t exactly tested it, as creating a new item is usually just easier. That said your advanced field should contain the menu items you want. (Essentially Advanced Menu is a clean slate separate from the main FOG Default menu stuff.)
Here’s the wiki on example setup for the advanced system. https://wiki.fogproject.org/wiki/index.php?title=Advanced_Boot_Menu_Configuration_options (Though you don’t need the “secured” portion as that’s kind of the purpose of hte advanced login handling. But I could be wrong, I really haven’t played much with “advanced” stuff in a long time.)
An example put on the FOG_PXE_ADVANCED field might be (again untested):
goto MENU :MENU menu item --gap Please Select one of the items below item hirens Hirens BootCD 15.2 item return Return to main menu choose --default hirens target && goto ${target} :hirens initrd http://${fog-ip}/fog/iso/Hiren_s_BootCD_15_2.iso chain memdisk iso raw :return chain http://${fog-ip}/${fog-webroot}/service/ipxe/boot.php?mac=${net0/mac} || goto MENU autoboot
-
@scosta Sorry, haven’t had time to look into this so far. Did Tom’s advice help you out?
-
@sebastian-roth i’m looking into @Tom-Elliott hints, he asked me about from where that second “#!ipxe” is comming from, so I went to check the code from “advanced.php”, it looks like this:
*/ require '../../commons/base.inc.php'; header('Content-type: text/plain'); /** * Parses the statements to print the advanced menu * * @param array $Send the data to be parsed * * @return void */ $parseMe = function ($Send) { foreach ($Send as $ipxe => &$val) { printf("%s\n", implode("\n", (array)$val)); unset($val); } }; $login = isset($_REQUEST['login']); $user = trim($_REQUEST['username']); $pass = trim($_REQUEST['password']); if ($login) { $Send['loginstuff'] = array( '#!ipxe', 'clear username', 'clear password', 'login', 'params', 'param username ${username}', 'param password ${password}', 'chain ${boot-url}/service/ipxe/advanced.php##params', ); $parseMe($Send); unset($_REQUEST['login']); } if (!empty($user)) { $tmp = FOGCore::attemptLogin($user, $pass); if ($tmp) { $Send['loginsuccess'] = array( '#!ipxe', 'set userID ${username}', 'chain ${boot-url}/service/ipxe/advanced.php', ); } else { $Send['loginfail'] = array( '#!ipxe', 'clear username', 'clear password', 'echo Invalid login!', 'sleep 3', 'chain -ar ${boot-url}/service/ipxe/advanced.php', ); $parseMe($Send); unset($user, $pass); } } printf( "#!ipxe\n%s", FOGCore::getSetting('FOG_PXE_ADVANCED') );
so Im guessing that extra piece of “#!ipxe” that @Tom-Elliott told is not meant to be there is that last 4 lines, am I right?
printf( "#!ipxe\n%s", FOGCore::getSetting('FOG_PXE_ADVANCED') );
Im thinking on changing it to this one, so the extra unnecessary #!ipxe would be gone, what do you think?
printf( "\n%s", FOGCore::getSetting('FOG_PXE_ADVANCED') );```
-
@scosta the last 4 lines are where that’s coming from. Remember how I said it’s been a while since I looked at the advanced code? If my forgetfulness indicates anything it really has been a long time. The second #!ipxe is intended.
-
@tom-elliott and @Sebastian-Roth again, thanks a lot for your time and explanations! The code @Tom-Elliott suggested me to put under FOG_ADVANCED_PXE field did the trick, and also helped me understand a bit more about the logic behind the boot menus.
Can you help me understand where my interpretation was wrong in the first time?
- First I went to the “iPXE New Menu Entry” option and added a Hiren’s Boot CD entry, and configured its field “Menu Show with” to “Advanced Login Required”
- Second, I went to iPXE Menu Item Settings -> fog.advancedlogin and changed its “Menu Show with” to “All Hosts”
With these steps, I was hopping to have, when booting PXE, the Advanced Menu with login showing on the starting menu, and when selecting it, the Hiren’s Boot Cd would show up. Like and hierarchy, boot, choose advanced menu, fill login and password and have access to the menus under it.
I hope you can undersand my pavorous english
-
When I re-designed the boot menu, I created all the different elements I could think about. The intention, hopefully, for advanced menu was you could create menu’s like everything else and associate them to the “advanced” side. That said, I still don’t have a good understanding of how to implement a menu system that would link to the advanced system. The item is designed, but not flushed out. So for right now, the “Advanced” and “Advanced Login” are essentially simple placeholders for a feature I might get to think about and implement down the road. Mostly, these days, I’ve been more worried about working out bugs and minor things for 1.5 while working toward getting 1.6 to a more suitable testing state.
Mind you (et. al) that I just started a new job and have much less time than in the past to actually work on FOG. This doesn’t mean I won’t work on it, simply that I’m very busy during the working week and by the time I get home it’s nearly time for bed already
Hopefully this helps you understand the ideology, even if it doesn’t work quite as I would have hoped (or as anybody might expect.)
-
@tom-elliott i completely understand, and cant thank you enough for the time and the effort you guys put on this awesome solution! now I understood the ideas and the concepts of the iPXE menus, so this topic can be marked as solved.
just to let you guys know, i’m implementing Fog on our company, it will be managing around 3000 hosts, distributed around 200 diferent locations, so I’ll try to get involved with the project as much as I can from now on.
keep up the good work, guys!
-
Hey, I don’t know if I can do it myself, but you guys can set this one to solved
-
Hi! Has anyone solved the authentication problem yet? After setting fog.advancedlogin for all hosts and for an ixpe example entry to “Advanced login required” the example entry does not appear after authentication.
Thank you! -
@foguser2018 Please start a new thread with pictures of how you have it setup. I understand your situation may be similar but your configuration may not be exact. To avoid confusing future readers we like to keep issues isolated if possible unless your conditions match exactly.