Ninja FirWall Fails to Recognize I’m Admin on Login –
-
Hi,
When I login WordPress using MFA, Ninja Fire Wall fails to recognize I’m admin, asks to send notification email, and for some reason WP SES fails to send the email, most likely, as the login just happened, and was postponed by the MFA login.
The function asking to fire the mail although I’m admin is:
file ‘ninjafirewall.php’ line 546:
// Check if the user is an admin and if we must whitelist them. function nfw_login_hook( $user_login, $user ) { nfw_session_start(); $nfw_options = nfw_get_option( 'nfw_options' ); // Don't do anything if NinjaFirewall is disabled: if ( empty( $nfw_options['enabled'] ) ) { return; } // Fetch user roles: $whoami = ''; foreach( $user->roles as $k => $v ) { if ( $v == 'administrator' ) { $admin_flag = 1; } $whoami .= "$v "; } $whoami = trim( $whoami ); // Still nothing: Maybe an additional superadmin if ( empty( $whoami ) && is_multisite() ) { // $user->ID is required here if ( is_super_admin( $user->ID ) ) { $admin_flag = 1; $whoami = 'administrator'; } } // Are we supposed to send an alert? if (! empty($nfw_options['a_0']) ) { if ( ( $nfw_options['a_0'] == 1 && isset( $admin_flag ) ) || $nfw_options['a_0'] == 2 ) { nfw_send_loginemail( $user_login, $whoami ); // Write event to log? if (! empty($nfw_options['a_41']) ) { nfw_log2('Logged in user', "{$user_login} ({$whoami})", 6, 0); } } } //Whitelist: if (! empty( $nfw_options['wl_admin']) ) { if ( ( $nfw_options['wl_admin'] == 1 && isset( $admin_flag ) ) || $nfw_options['wl_admin'] == 2 ) { // Set the goodguy flag: $_SESSION['nfw_goodguy'] = 1; return; } } // Clear the flag, this user isn't whitelisted: if ( isset( $_SESSION['nfw_goodguy'] ) ) { unset( $_SESSION['nfw_goodguy'] ); } }
I managed to find this out, after I deliberately changed the WP SES function name, getting a trace to follow:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined method DeliciousBrains\\WP_Offload_SES\\WP_Offload_SES::trigger_queue() in /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/wp-ses/classes/WP-Offload-SES.php:1327\nStack trace:\n#0 /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/wp-ses/wp-ses.php(162): DeliciousBrains\\WP_Offload_SES\\WP_Offload_SES->mail_handler()\n#1 /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/ninjafirewall/lib/utils.php(1660): wp_mail()\n#2 /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/ninjafirewall/lib/utils.php(838): nfw_mail()\n#3 /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/ninjafirewall/ninjafirewall.php(577): nfw_send_loginemail()\n#4 /var/www/vhosts/example.com/staging.example.com/wp-includes/class-wp-hook.php(303): nfw_login_hook()\n#5 /var/www/vhosts/example.com/staging.example.com/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()\n#6 /var/www/vhost...PHP message: PHP Fatal error: Uncaught Error: Call to undefined method DeliciousBrains\\WP_Offload_SES\\WP_Offload_SES::trigger_queue() in /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/wp-ses/classes/WP-Offload-SES.php:1327\nStack trace:\n#0 /var/www/vhosts/example.com/staging.example.com/wp-content/plugins/wp-ses/wp-ses.php(162): DeliciousBrains\\WP_Offload_SES\\WP_Offload_SES->mail_handler()\n#1 /var/www/vhosts/example.com/staging.example.com/wp-includes/class-wp-recovery-mode-email-service.php(229): wp_mail()\n#2 /var/www/vhosts/example.com/staging.example.com/wp-includes/class-wp-recovery-mode-email-service.php(61): WP_Recovery_Mode_Email_Service->send_recovery_mode_email()\n#3 /var/www/vhosts/example.com/staging.example.com/wp-includes/class-wp-recovery-mode.php(184): WP_Recovery_Mode_Email_Service->maybe_send_recovery_mode_email()\n#4 /var/www/vhosts/example.com/staging.example.com/wp-includes/class-wp-fatal-error-handler.php(52): WP_Recovery_Mode->handle_error()\n#5 [internal...', referer: https://staging.example.com/wp-login.php
- The topic ‘Ninja FirWall Fails to Recognize I’m Admin on Login –’ is closed to new replies.