PluginProbe ʕ •ᴥ•ʔ
NinjaFirewall (WP Edition) – Advanced Security Plugin and Firewall / trunk
NinjaFirewall (WP Edition) – Advanced Security Plugin and Firewall vtrunk
4.8.8 4.8.7 4.8.6 trunk 4.5 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6 4.6.1 4.7 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.8 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5
ninjafirewall / lib / fw_centlog.php
ninjafirewall / lib Last commit date
share 8 years ago .htaccess 11 years ago anti_malware.php 4 years ago class-coupon.php 6 months ago class-email-sodium.php 3 weeks ago class-firewall-log.php 1 week ago class-helpers.php 7 months ago class-import-export.php 3 months ago class-ip.php 4 months ago class-nfw-database.php 6 months ago class-nfw-session.php 1 week ago class-php-session.php 1 year ago class-plugin-upgrade.php 1 week ago class_mail.php 3 weeks ago event_updates.php 9 months ago firewall.php 4 months ago fw_centlog.php 1 week ago fw_fileguard.php 4 months ago fw_livelog.php 1 year ago help.php 3 weeks ago helpers.php 1 week ago i18n-extra.php 3 weeks ago i18n.php 1 year ago index.html 13 years ago init_update.php 1 year ago install.php 1 year ago install_default.php 6 months ago loader.php 6 months ago mail_template_firewall.php 1 year ago mail_template_plugin.php 1 month ago scheduled_tasks.php 3 years ago settings_dashboard.php 1 month ago settings_dashboard_about.php 3 weeks ago settings_dashboard_statistics.php 1 month ago settings_event_notifications.php 1 month ago settings_events.php 1 month ago settings_firewall_options.php 1 month ago settings_firewall_policies.php 1 week ago settings_login_protection.php 1 month ago settings_logs.php 1 month ago settings_logs_firewall_log.php 3 weeks ago settings_logs_live_log.php 1 month ago settings_monitoring.php 3 weeks ago settings_monitoring_file_check.php 1 month ago settings_monitoring_file_guard.php 1 month ago settings_network.php 1 month ago settings_security_rules.php 1 month ago settings_security_rules_editor.php 1 month ago settings_security_rules_update.php 1 week ago sign.pub 7 years ago thickbox.php 4 years ago widget.php 3 years ago wpplus.php 3 months ago
fw_centlog.php
81 lines
1 <?php
2 // +---------------------------------------------------------------------+
3 // | NinjaFirewall (WP Edition) |
4 // | |
5 // | (c) NinTechNet - https://nintechnet.com/ |
6 // +---------------------------------------------------------------------+
7 // | This program is free software: you can redistribute it and/or |
8 // | modify it under the terms of the GNU General Public License as |
9 // | published by the Free Software Foundation, either version 3 of |
10 // | the License, or (at your option) any later version. |
11 // | |
12 // | This program is distributed in the hope that it will be useful, |
13 // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 // | GNU General Public License for more details. |
16 // +---------------------------------------------------------------------+ sa
17
18 if (! isset( $nfw_['nfw_options']['enabled']) ) {
19 header('HTTP/1.1 404 Not Found');
20 header('Status: 404 Not Found');
21 exit;
22 }
23
24 /* ------------------------------------------------------------------ */
25 function fw_centlog() {
26
27 global $nfw_;
28
29 $pubkey = explode( ':', $nfw_['nfw_options']['clogs_pubkey'], 2 );
30
31 if ( isset( $pubkey[1]) && $pubkey[1] != '*' ) {
32
33 if ( NFW_REMOTE_ADDR != $pubkey[1] ) {
34
35 NinjaFirewall_log::write(
36 'Centralized logging: IP not allowed',
37 NFW_REMOTE_ADDR,
38 NFWLOG_INFO, 0, $nfw_['nfw_options'], $nfw_['log_dir']
39 );
40 fw_centlog_die();
41 }
42 }
43
44 if ( empty( $pubkey[0] ) || ! hash_equals( $pubkey[0], sha1( $_POST['clogs_req'] ) ) ) {
45
46 NinjaFirewall_log::write(
47 'Centralized logging: public key rejected',
48 NFW_REMOTE_ADDR,
49 NFWLOG_INFO, 0, $nfw_['nfw_options'], $nfw_['log_dir']
50 );
51 fw_centlog_die();
52 }
53
54 $cur_month = date('Y-m');
55 $log_file = $nfw_['log_dir']. '/firewall_' . $cur_month . '.php';
56
57 if (! file_exists( $log_file ) ) {
58 exit('1:');
59 }
60
61 $data = file( $log_file, FILE_SKIP_EMPTY_LINES );
62 if ( $data === false ) {
63 exit('2:');
64 }
65
66 echo '0:~*~:' . base64_encode( json_encode( $data ) );
67 exit;
68 }
69
70 /* ------------------------------------------------------------------ */
71
72 function fw_centlog_die() {
73
74 header('HTTP/1.1 406 Not Acceptable');
75 header('Status: 406 Not Acceptable');
76 exit;
77 }
78
79 /* ------------------------------------------------------------------ */
80 // EOF
81