• Resolved kendawes

    (@kendawes)


    I normally whitelist my clients’ IP address in their .htaccess file. I generally don’t need to update their IP very frequently.

    I now have a client who has a frequently changing IP address.

    I do have Administrators whitelisted in her Ninjafirewall, but I’d like to whitelist her username specifically in .htninja.

    I know how to whitelist a username for access to the Ninjafirewall settings, but I’m wondering if it would be possible to completely whitelist her username in her .htninja file.

    Thanks!!

Viewing 1 replies (of 1 total)
  • Plugin Author nintechnet

    (@nintechnet)

    It is possible but this can only be based on the cookie so it is not the safest way to do it (because NinjaFirewall works before WP, you cannot know yet whether the person is really authenticated).
    But this code should work:

    <?php
    /*
     +====================================================================+
     | NinjaFirewall optional configuration file                          |
     |                                                                    |
     | See: https://nintechnet.com/ninjafirewall/wp-edition/help/?htninja |
     +====================================================================+
    */
    
    if ( isset( $_SERVER['HTTP_COOKIE'] ) && preg_match( '/\bwordpress_logged_in_.{32}=USERNAME%7C/', $_SERVER['HTTP_COOKIE'] ) ) {
       return 'ALLOW'; // whitelist
    }
    

    Replace USERNAME with the user login name.

Viewing 1 replies (of 1 total)

The topic ‘Whitelisting a username’ is closed to new replies.