| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/flywheel-config/plugins/flywheel/flywheel-security/ |
Upload File : |
<?php
/*
Plugin Name: Flywheel Security
Plugin URI:
Description: Flywheel Security Plugin
Version: 0.1
Author: Flywheel
Author URI: http://www.getflywheel.com
*/
/*
Copyright (C) 2009 Avery Fay
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
function flywheel_remote_addr()
{
$IP = $_SERVER['REMOTE_ADDR'];
if (!empty($_SERVER['X_FORWARDED_FOR'])) {
$X_FORWARDED_FOR = explode(',', $_SERVER['X_FORWARDED_FOR']);
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$X_FORWARDED_FOR = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
}
if (!empty($X_FORWARDED_FOR)) {
$IP = trim($X_FORWARDED_FOR[0]);
}
return $IP;
}
function flywheel_set_comment_ip()
{
$CLIENT_IP = flywheel_remote_addr();
return $CLIENT_IP;
}
function flywheel_spam_log_process_status( $comment_id, $comment_status )
{
if ($comment_status != 'spam')
return;
$comment = get_comment($comment_id);
if (empty($comment))
return;
$log_string =
date('Y-m-d H:i:s') .
" comment id=" . $comment_id .
" from host=" . $comment->comment_author_IP .
" marked as spam";
error_log('[Flywheel Security] ' . $log_string);
}
function flywheel_login_failed_403( $username )
{
$log_string =
date('Y-m-d H:i:s') .
" Failed login attempt from host=" . flywheel_remote_addr();
error_log('[Flywheel Security] ' . $log_string);
}
function flywheel_login_success( $username )
{
$log_string =
date('Y-m-d H:i:s') .
" user=" . $username . " host=" . flywheel_remote_addr();
error_log('[Flywheel Security] ' . $log_string);
}
function flywheel_password_reset( $user )
{
$log_string =
date('Y-m-d H:i:s') .
" Password reset user=" . $user->user_login . " host=" . flywheel_remote_addr();
error_log('[Flywheel Security] ' . $log_string);
}
function flywheel_password_update( $user_id, $old_user_data) {
if ( ! isset( $_POST['pass1'] ) || $_POST['pass1'] == '' ) {
return;
}
elseif(!$_POST['pass1'] === $_POST['pass2']){
return;
}
$log_string =
date('Y-m-d H:i:s') .
" Password updated user=" . $old_user_data->user_login . " host=" . flywheel_remote_addr();
error_log('[Flywheel Security] ' . $log_string);
}
add_filter('pre_comment_user_ip', 'flywheel_set_comment_ip');
add_action('wp_login', 'flywheel_login_success');
add_action('wp_login_failed', 'flywheel_login_failed_403');
add_action('comment_post', 'flywheel_spam_log_process_status', 10, 2);
add_action('wp_set_comment_status', 'flywheel_spam_log_process_status', 10, 2);
add_action('after_password_reset', 'flywheel_password_reset');
add_action('profile_update', 'flywheel_password_update', 10, 3);