Skip to content

Instantly share code, notes, and snippets.

@pstoute
Last active June 2, 2023 21:35
Show Gist options
  • Save pstoute/ee1e43c722f35ec4afd8b0918f6d674b to your computer and use it in GitHub Desktop.
Save pstoute/ee1e43c722f35ec4afd8b0918f6d674b to your computer and use it in GitHub Desktop.
fortress-make_com-whitelist.php
<?php
/**
* Plugin Name: GridPane Fortress - Skip the check for a session being in sudo-mode for make.com connections.
* Description: Companion plugin to the Fortress Security module to whitelist make.com connections.
* Author: Company
*
* 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) {
// Make.com IPs taken from: https://www.make.com/en/help/connections/allowing-connections-to-and-from-make-ip-addresses
$ips = [
'54.209.79.175',
'54.80.47.193',
'54.161.178.114',
'54.75.157.176',
'54.78.149.203',
'52.18.144.195',
'44.196.246.20',
'3.94.51.90',
'52.4.48.212',
'3.125.27.86',
'3.68.125.41',
'18.193.24.45'
];
if(in_array($_SERVER['REMOTE_ADDR'], $ips, true)){
$event->skip_for_current_request = true;
}
});
@pstoute
Copy link
Author

pstoute commented Jun 1, 2023

To install this on your site upload this PHP file to your /wp-content/mu-plugins directory. No other configurations will be required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment