Need some help: Patch to show usernames without authentication used to work but doesn't work anymore.



  • Hey everyone,
    I’m here to ask for some help. I’ve got this scenario where I want to be able to capture the usernames that people enter in the captive portal without authentication.
    Someone wrote a patch for it years ago that modifies the portal to do exactly that but sadly I can’t get that to work anymore.This thread sums up exactly what I want to do and has the patch listed too.
    Would really appreciate some help from people more experienced than I am on this subject matter.
    Cheers,
    Lex



  • Hi,

    That code still works, although the diff file is old so it can't patched in using the patch command against a recent /usr/local/captiveportal/index.php file.

    Change (nearly to the bottom of the index.php file) :

    } else if ($_POST['accept'] && $clientip && $cpcfg['auth_method'] == "none") {
    	captiveportal_logportalauth("unauthenticated", $clientmac, $clientip, "ACCEPT");
    	portal_allow($clientip, $clientmac, "unauthenticated");
    
    } else {
    

    for

    } else if ($_POST['accept'] && $clientip && $cpcfg['auth_method'] == "none") {
    	$user = "unauthenticated"; // or $user = "Unknown - no USER name entered";
    	if ($_POST['auth_user'])
    		$user = $_POST['auth_user'];
        captiveportal_logportalauth($user, $clientmac, $clientip, "ACCEPT");
        portal_allow($clientip, $clientmac, $user);
    
    } else {
    

    I didn't test-drive this code.

    edit : See this https://redmine.pfsense.org/issues/8361 (proposed in the much bigger https://github.com/pfsense/pfsense/pull/3640 )



  • Gertjan,

    Thanks for your reply. Fun fact; I've managed to do the same thing yesterday and got it working.
    Good to see that I've done it right. I'll make sure to check the links your provided!

    Thanks again dude.

    Cheers,
    Lex