WordPress.org

Forums

WP fail2ban
[resolved] Support for X-Forwarded-For (8 posts)

  1. litemotiv
    Member
    Posted 2 years ago #

    Since REMOTE_ADDR is only available for direct connections and not on proxies, could you perhaps add support for X_FORWARDED_FOR headers? Something like below would work:

    function($user_login, $user)
    {
        $ip = ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') ? $_SERVER['REMOTE_ADDR'] : $_SERVER['X_FORWARDED_FOR'];
        openlog('wordpress('.$_SERVER['HTTP_HOST'].')',LOG_NDELAY|LOG_PID,LOG_AUTH);
        syslog(LOG_INFO,"Accepted password for $user_login from {$ip}");
    },10,2);

    Thanks. :-)

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

  2. sireneweb
    Member
    Posted 2 years ago #

    Where you add this code ?

  3. sireneweb
    Member
    Posted 2 years ago #

    tks i founded

  4. Ovidiu
    Member
    Posted 2 years ago #

    very useful, I hope this works as intended and can be incorporated into the next plugin version please?

  5. invisnet
    Member
    Plugin Author

    Posted 1 year ago #

    I've just released 2.0.0 which has some *experimental* code to handle this; it's a little different from what you've done but the principle is the same.
    Details are in the readme - let me know how you get on.

  6. Ovidiu
    Member
    Posted 1 year ago #

    Going to check this out soon! Thanks for following up!

  7. Ovidiu
    Member
    Posted 1 year ago #

    jsut read the readme and you say:

    so don't add whitespace or CIDR notations

    but what I need this for is for the CloudFlare IPs and they only specify them in CIDR format => https://www.cloudflare.com/ips

    Any chance you could add CIDR support?

    204.93.240.0/24
    204.93.177.0/24
    199.27.128.0/21
    173.245.48.0/20
    103.21.244.0/22
    103.22.200.0/22
    103.31.4.0/22
    141.101.64.0/18
    108.162.192.0/18
    190.93.240.0/20
    188.114.96.0/20
    197.234.240.0/22
    198.41.128.0/17
    162.158.0.0/15

  8. invisnet
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry for the delay in mentioning it, but the latest release now has support for CIDR.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP fail2ban
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.