-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/cdn_self_check.ag' into cdn_self…
…_check.ag
- Loading branch information
Showing
13 changed files
with
626 additions
and
60 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
use CleantalkSP\SpbctWP\Cron as SpbcCron; | ||
use CleantalkSP\SpbctWP\HTTP\CDNHeadersChecker; | ||
use CleantalkSP\SpbctWP\Scanner\ScanningLog\ScanningLogFacade; | ||
use CleantalkSP\Variables\Post; | ||
use CleantalkSP\Variables\Server; | ||
|
@@ -534,6 +536,12 @@ function spbc_settings__register() | |
'options' => spbc_settings_field__secfw__get_ip__get_labels(), | ||
'title' => __('Get visitors IP from additional headers', 'security-malware-firewall'), | ||
'description' => spbc_settings_field__secfw__get_ip__get_description(), | ||
'long_description' => true, | ||
), | ||
'secfw__get_ip__enable_cdn_auto_self_check' => array( | ||
'type' => 'field', | ||
'title' => __('Enable automatic CDN headers checker', 'security-malware-firewall'), | ||
'description' => CDNHeadersChecker::getOptionDescriptionText(), | ||
), | ||
), | ||
), | ||
|
@@ -1647,6 +1655,16 @@ function spbc_field_statistics() | |
: __('Unknown last PHP log sending time.', 'security-malware-firewall')); | ||
} | ||
|
||
echo '<br/>'; | ||
|
||
|
||
//cdn checker data | ||
add_filter('safe_style_css', function ($styles) { | ||
$styles[] = 'display'; | ||
return $styles; | ||
}); | ||
echo Escape::escKsesPreset(CDNHeadersChecker::getSummaryBlockHTML(), 'spbc_cdn_checker_table'); | ||
|
||
echo '<br/>'; | ||
echo 'Plugin version: ' . SPBC_VERSION; | ||
echo '</div>'; | ||
|
@@ -4703,6 +4721,10 @@ function spbc_settings__get_description() | |
'desc' => __('The file hash is in denied list. It means that the Security analysts have marked this file | ||
as critically dangerous early. We do recommend you to order the Security Audit service.', 'security-malware-firewall') | ||
), | ||
'secfw__get_ip' => array( | ||
'title' => IP::getOptionLongDescriptionArray()['title'], | ||
'desc' => IP::getOptionLongDescriptionArray()['desc'], | ||
), | ||
'no_description' => array( | ||
'title' => esc_html($setting_id), | ||
'desc' => __('No description provided yet for this item. We are sorry about this. Please, contact [email protected] for further help.', 'security-malware-firewall'), | ||
|
@@ -4977,6 +4999,17 @@ function spbc__send_local_settings_to_api($settings) | |
API::methodSendLocalSettings($api_key, $hostname, $settings); | ||
} | ||
|
||
add_action('spbc_before_returning_settings', 'spbc_cdn_checker__run_check_on_settings_change'); | ||
|
||
function spbc_cdn_checker__run_check_on_settings_change($settings) | ||
{ | ||
if ( isset($settings['secfw__get_ip__enable_cdn_auto_self_check']) && $settings['secfw__get_ip__enable_cdn_auto_self_check'] != 0) { | ||
CDNHeadersChecker::sendCDNCheckerRequest(); | ||
SpbcCron::updateTask('cdn_check', 'spbc_cdn_checker__send_request', 86400, time() + 86400); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -5019,24 +5052,10 @@ function spbc_settings_field__secfw__get_ip__get_description() | |
|
||
function spbc_settings_field__secfw__get_ip__get_labels() | ||
{ | ||
$available_header = array( | ||
2 => array('slug' => 'remote_addr', 'name' => 'Remote Addr'), | ||
3 => array('slug' => 'x_forwarded_for', 'name' => 'X-Forwarder-For'), | ||
4 => array('slug' => 'x_real_ip', 'name' => 'X-Real-Ip'), | ||
5 => array('slug' => 'incapsula', 'name' => 'Incap-Client-Ip'), | ||
6 => array('slug' => 'ico_x_forwarded_for', 'name' => 'Ico-X-Forwarded-For'), | ||
7 => array('slug' => 'stackpath', 'name' => 'X-Sp-Forwarded-Ip'), | ||
8 => array('slug' => 'x_forwarded_by', 'name' => 'X-Client-Ip'), | ||
9 => array('slug' => 'sucury', 'name' => 'X-Sucuri-Clientip'), | ||
10 => array('slug' => 'ezoic', 'name' => 'X-Middleton-Ip'), | ||
11 => array('slug' => 'gtranslate', 'name' => 'X-Gt-Viewer-Ip'), | ||
12 => array('slug' => 'cloud_flare', 'name' => 'Cf-Connecting-Ip'), | ||
13 => array('slug' => 'ovh', 'name' => 'Remote-Ip'), | ||
); | ||
$options = array(); | ||
$options[] = array('val' => 1, 'label' => __('Auto', 'security-malware-firewall'),); | ||
|
||
foreach ( $available_header as $key => $header ) { | ||
foreach (IP::$known_headers_collection as $key => $header ) { | ||
IP::get($header['slug'], [], true); | ||
$option_value = $header['name']; | ||
$option_value .= isset(IP::getInstance()->ips_stored[$header['slug']]) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
jQuery(document).ready(function(){ | ||
console.log('TAB - SUMMARY'); | ||
}); | ||
}); |
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
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
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
Oops, something went wrong.