Skip to content

Instantly share code, notes, and snippets.

@pstoute
Last active June 6, 2023 14:39
Show Gist options
  • Save pstoute/e1d0946eeabdec672efba85f722dce54 to your computer and use it in GitHub Desktop.
Save pstoute/e1d0946eeabdec672efba85f722dce54 to your computer and use it in GitHub Desktop.
Fortress whitelist for Celigo connector IPs
<?php
/**
* Plugin Name: GridPane Fortress - Skip the check for a session being in sudo-mode for Celigo connections.
* Description: Companion plugin to the Fortress Security module to whitelist Celigo 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) {
// Celigo IPs provided by the Celigo Technical team. Your specific IP addresses may be different and should be confirmed with your Celigo account rep.
$ips = [
'52.2.63.213',
'52.7.99.234',
'52.71.48.248',
'44.204.21.0',
'44.204.21.1',
'44.204.21.2',
'44.204.21.3',
'44.204.21.4',
'44.204.21.5',
'44.204.21.6',
'44.204.21.7',
'44.204.21.8',
'44.204.21.9',
'44.204.21.10',
'44.204.21.11',
'44.204.21.12',
'44.204.21.13',
'44.204.21.14',
'44.204.21.15',
'44.204.21.16',
'44.204.21.17',
'44.204.21.18',
'44.204.21.19',
'44.204.21.20',
'44.204.21.21',
'44.204.21.22',
'44.204.21.23',
'44.204.21.24',
'44.204.21.25',
'44.204.21.26',
'44.204.21.27',
'44.204.21.28',
'44.204.21.29',
'44.204.21.30',
'44.204.21.31',
'44.204.21.32',
'44.204.21.33',
'44.204.21.34',
'44.204.21.35',
'44.204.21.36',
'44.204.21.37',
'44.204.21.38',
'44.204.21.39',
'44.204.21.40',
'44.204.21.41',
'44.204.21.42',
'44.204.21.43',
'44.204.21.44',
'44.204.21.45',
'44.204.21.46',
'44.204.21.47',
'44.204.21.48',
'44.204.21.49',
'44.204.21.50',
'44.204.21.51',
'44.204.21.52',
'44.204.21.53',
'44.204.21.54',
'44.204.21.55',
'44.204.21.56',
'44.204.21.57',
'44.204.21.58',
'44.204.21.59',
'44.204.21.60',
'44.204.21.61',
'44.204.21.62',
'44.204.21.63',
'44.204.21.64',
'44.204.21.65',
'44.204.21.66',
'44.204.21.67',
'44.204.21.68',
'44.204.21.69',
'44.204.21.70',
'44.204.21.71',
'44.204.21.72',
'44.204.21.73',
'44.204.21.74',
'44.204.21.75',
'44.204.21.76',
'44.204.21.77',
'44.204.21.78',
'44.204.21.79',
'44.204.21.80',
'44.204.21.81',
'44.204.21.82',
'44.204.21.83',
'44.204.21.84',
'44.204.21.85',
'44.204.21.86',
'44.204.21.87',
'44.204.21.88',
'44.204.21.89',
'44.204.21.90',
'44.204.21.91',
'44.204.21.92',
'44.204.21.93',
'44.204.21.94',
'44.204.21.95',
'44.204.21.96',
'44.204.21.97',
'44.204.21.98',
'44.204.21.99',
'44.204.21.100',
'44.204.21.101',
'44.204.21.102',
'44.204.21.103',
'44.204.21.104',
'44.204.21.105',
'44.204.21.106',
'44.204.21.107',
'44.204.21.108',
'44.204.21.109',
'44.204.21.110',
'44.204.21.111',
'44.204.21.112',
'44.204.21.113',
'44.204.21.114',
'44.204.21.115',
'44.204.21.116',
'44.204.21.117',
'44.204.21.118',
'44.204.21.119',
'44.204.21.120',
'44.204.21.121',
'44.204.21.122',
'44.204.21.123',
'44.204.21.124',
'44.204.21.125',
'44.204.21.126',
'44.204.21.127',
'44.204.21.128',
'44.204.21.129',
'44.204.21.130',
'44.204.21.131',
'44.204.21.132',
'44.204.21.133',
'44.204.21.134',
'44.204.21.135',
'44.204.21.136',
'44.204.21.137',
'44.204.21.138',
'44.204.21.139',
'44.204.21.140',
'44.204.21.141',
'44.204.21.142',
'44.204.21.143',
'44.204.21.144',
'44.204.21.145',
'44.204.21.146',
'44.204.21.147',
'44.204.21.148',
'44.204.21.149',
'44.204.21.150',
'44.204.21.151',
'44.204.21.152',
'44.204.21.153',
'44.204.21.154',
'44.204.21.155',
'44.204.21.156',
'44.204.21.157',
'44.204.21.158',
'44.204.21.159',
'44.204.21.160',
'44.204.21.161',
'44.204.21.162',
'44.204.21.163',
'44.204.21.164',
'44.204.21.165',
'44.204.21.166',
'44.204.21.167',
'44.204.21.168',
'44.204.21.169',
'44.204.21.170',
'44.204.21.171',
'44.204.21.172',
'44.204.21.173',
'44.204.21.174',
'44.204.21.175',
'44.204.21.176',
'44.204.21.177',
'44.204.21.178',
'44.204.21.179',
'44.204.21.180',
'44.204.21.181',
'44.204.21.182',
'44.204.21.183',
'44.204.21.184',
'44.204.21.185',
'44.204.21.186',
'44.204.21.187',
'44.204.21.188',
'44.204.21.189',
'44.204.21.190',
'44.204.21.191',
'44.204.21.192',
'44.204.21.193',
'44.204.21.194',
'44.204.21.195',
'44.204.21.196',
'44.204.21.197',
'44.204.21.198',
'44.204.21.199',
'44.204.21.200',
'44.204.21.201',
'44.204.21.202',
'44.204.21.203',
'44.204.21.204',
'44.204.21.205',
'44.204.21.206',
'44.204.21.207',
'44.204.21.208',
'44.204.21.209',
'44.204.21.210',
'44.204.21.211',
'44.204.21.212',
'44.204.21.213',
'44.204.21.214',
'44.204.21.215',
'44.204.21.216',
'44.204.21.217',
'44.204.21.218',
'44.204.21.219',
'44.204.21.220',
'44.204.21.221',
'44.204.21.222',
'44.204.21.223',
'44.204.21.224',
'44.204.21.225',
'44.204.21.226',
'44.204.21.227',
'44.204.21.228',
'44.204.21.229',
'44.204.21.230',
'44.204.21.231',
'44.204.21.232',
'44.204.21.233',
'44.204.21.234',
'44.204.21.235',
'44.204.21.236',
'44.204.21.237',
'44.204.21.238',
'44.204.21.239',
'44.204.21.240',
'44.204.21.241',
'44.204.21.242',
'44.204.21.243',
'44.204.21.244',
'44.204.21.245',
'44.204.21.246',
'44.204.21.247',
'44.204.21.248',
'44.204.21.249',
'44.204.21.250',
'44.204.21.251',
'44.204.21.252',
'44.204.21.253',
'44.204.21.254',
'44.204.21.255',
'3.120.79.235',
'3.121.31.161',
'3.121.38.240',
'3.121.191.221',
'3.122.30.121',
'3.123.59.83',
'3.123.61.228',
'3.123.62.245',
'3.123.65.151',
'3.123.74.63',
'3.123.74.173',
'3.123.78.170',
'3.123.79.121',
'3.123.89.249',
'3.123.91.86',
'3.123.95.179',
'3.123.100.144',
'3.123.102.222',
'3.123.103.31',
'3.123.104.1',
'3.123.106.252',
'3.123.106.20',
'3.123.107.95',
'3.123.107.137',
'3.123.112.120',
'3.123.112.204',
'18.185.247.145',
'18.194.166.156',
'18.194.194.36',
'18.195.44.181',
'18.195.86.209',
'18.196.37.103',
'18.196.91.219',
'18.196.94.38',
'18.196.252.5',
'18.197.225.85',
'35.156.91.172',
'35.156.178.220',
'35.156.240.6',
'35.157.169.174',
'35.157.25.45',
'35.157.59.64',
'35.157.83.232',
'34.203.78.45'
];
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