WordPress.org

Ready to get started?Download WordPress

Forums

WP fail2ban
[resolved] Anonymous functions (4 posts)

  1. AleksCee
    Member
    Posted 1 year ago #

    Hi,

    could you please switch from "anonymous functions" to "normal functions" to support all versions of PHP, which are also supported by WordPress itself?

    Thanks for the greate idea of this plugin.

    http://wordpress.org/extend/plugins/wp-fail2ban/

  2. invisnet
    Member
    Plugin Author

    Posted 1 year ago #

    May I ask why you're not using at least PHP 5.3? I know some hosting companies take a little while to get around to upgrading, but surely 829 days is long enough? (http://php.net/eol.php)

  3. AleksCee
    Member
    Posted 1 year ago #

    Hi,

    because of the normal packet repository of "Ubuntu 8.04.4 LTS". But you are right, I will upgrade the OS because the EOL of it in this month....

  4. erich_k4wp
    Member
    Posted 11 months ago #

    related to eAccelerator:

    eAccelerator is not compatible with anonymous function/closure!
    more details here: https://github.com/eaccelerator/eaccelerator/issues/12

    so as a workaround:

    add_action( 'wp_login', 'fail2ban_onLogin' ,10,2);
    function fail2ban_onLogin($user_login, $user)
    {
    	openlog('wordpress('.$_SERVER['HTTP_HOST'].')',LOG_NDELAY|LOG_PID,LOG_AUTH);
    	syslog(LOG_INFO,"Accepted password for $user_login from {$_SERVER['REMOTE_ADDR']}");
    }
    
    add_action( 'wp_login_failed', 'fail2ban_onLoginFailed');
    function fail2ban_onLoginFailed($username)
    {
    	openlog('wordpress('.$_SERVER['HTTP_HOST'].')',LOG_NDELAY|LOG_PID,LOG_AUTH);
    	syslog(LOG_NOTICE,"Authentication failure for $username from {$_SERVER['REMOTE_ADDR']}");
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.