Last active
July 17, 2023 19:06
-
-
Save pstoute/d9383397c49551d504ecd9ad9b9dbda6 to your computer and use it in GitHub Desktop.
Use this plugin as a must use plugin for any Fortress secured site where you are using AWS Alloy to manage your connections with Amazon Buy with Prime buttons.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: GridPane Fortress - Skip the check for a session being in sudo-mode for AWS Alloy connections. | |
* Description: Companion plugin to the Fortress Security module to whitelist AWS Alloy connections. | |
* Author: Stoute Web Solutions | |
* Author URI: https://stoutewebsolutions.com | |
* Version: 1.0 | |
*/ | |
// This is a replication of the original whitelisted module for ManageWP found here: https://github.com/snicco/fortress/blob/beta/docs/modules/session/sudo-mode.md#skipping-the-sudo-mode-check-for-request-from-managewp | |
use Snicco\Enterprise\Fortress\Session\Infrastructure\Event\ShouldSudoModeCheckBeSkipped; | |
add_action(ShouldSudoModeCheckBeSkipped::class, function (ShouldSudoModeCheckBeSkipped $event) { | |
// Alloy IPs provided by the AWS Buy with Prime Technical team. Your specific IP addresses may be different and should be confirmed with your AWS Buy with Prime account rep. | |
$ips = [ | |
'54.160.36.113', | |
'3.211.13.53' | |
]; | |
if(in_array($_SERVER['REMOTE_ADDR'], $ips, true)){ | |
$event->skip_for_current_request = true; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment