Help With Advanced Menu with Login



  • Hello everybody! First of all, thanks for the incredible solution that is FOG, we’re about to start using FOG in our company, to manage about 1500 hosts distributed around 200 different locations. I’m just doing the final adjustments and tests, and I hope you can shed some light about the Advanced Menu with Login on the PXE menu boot.

    I’m aiming to use the advanced menu with login to group the functions like the Deploy Image, Memtest+ and possibly a Hirens Boot CD ISO, but I’m taking a beat to accomplish that! Here are my settings on the IPXE Menu Configurations:

    For this tests Im using Ubuntu 18.04 and FOG 1.4.5

    This is the fog.advanced configuration. If I change this to appear under All Hosts, I keep getting a Chainloading error when I select the menu on PXE
    0_1533941861450_fog.advanced.PNG

    This is the fog.advancedlogin configuration. Again If I change this to appear under All Hosts, when i choose this menu, it offers me the login and password, but after, I keep getting a Chainloading error when I select the menu on PXE
    0_1533941889028_fog.advancedlogin.PNG

    This is the Hirens menu i created. Under the All Hosts, it works perfectly, but i would like to put it under the Advanced Login Menus.
    0_1533941897368_hirens.PNG

    Seems to me that I’m missinterpreting something about the menus, and because of that i’m stuck in there Chainloading errors.

    Thanks a lot in advance and congratulations again for the great system and comunity!!


  • Moderator

    @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.



  • 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!



  • Hey, I don’t know if I can do it myself, but you guys can set this one to solved =)



  • @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!


  • Senior Developer

    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 :D

    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 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 =)


  • Senior Developer

    @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.



  • @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')
    );```

  • Developer

    @scosta Sorry, haven’t had time to look into this so far. Did Tom’s advice help you out?


  • Senior Developer

    @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

  • Moderator

    @scosta Well, afaik, FOG went from 1.4.4 to 1.5, so not sure how you have 1.4.5



  • Well? Anyone have insights about this? Should I try another version of FOG, perhaps one directly from GitHub?



  • @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


  • Developer

    @scosta Thanks for posting the picture and video! Please open the following URLS in your browser and post the full text houtput here: http://10.6.23.8/fog/service/ipxe/boot.php?mac=b8:ae:ed:85:3e:65 and http://10.6.23.8/fog/service/ipxe/advanced.php?login=1&username=fog&password=password (make sure you put in the correct password)

    Are you able to access (download) the ISO file via URL http://10.6.23.8/fog/iso/Hiren_s_BootCD_15_2.iso ??



  • @sebastian-roth thanks in advance and sorry, you’re right, my version of Fog is 1.5.4, the one available to download in FOG main page. Here is a picture of the Chainloading error, after i put fog.advancedlogin back to All Hosts.

    0_1534177144459_20180813_125736.mp4_snapshot_00.33.jpg

    Here is link a to a video booting up the machine and selecting the menu


  • Developer

    @scosta Probably best if you can take a picture of the chainloading error on screen and post here. Maybe even better a short video (make sure you rest the camera/smartphone on a pile of books to get a steady picture).

    Are you sure you are using FOG 1.4.5? Or 1.5.4?


Log in to reply
 

452
Online

6.1k
Users

13.4k
Topics

126.4k
Posts