Code Monkey home page Code Monkey logo

Comments (4)

tokkonopapa avatar tokkonopapa commented on August 16, 2024

You mean that you want to put your domain name into Whitelist of country code instead of putting 2 letters of country code, am I right?

I think it's easy to configure your .htaccess (or something) to restrict IP addresses or domains for wp-login.php.

How do you think?

from wordpress-ip-geo-block.

ddur avatar ddur commented on August 16, 2024

No, what I mean here is to use provider domain instead of (unknown) provider IP address range.

Afaik, .htaccess has same limitation as IP white/black list. It accepts only IP numbers.

Any country usually have more than one internet provider.
I guess, most of internet provider domains do not cross country borders.
In example, "US" country filter makes huge number of IP accessible to login.
But each ISP provider in US (I guess) uses his own domain to assign reverse lookup for connected (dhcp) clients.

Actually this would be reverse lookup of visitor IP compared with isp provider domain.
Something like

if (preg_match( "/gethostbyaddr(visitor-ip)$/", $provider-domain)).

where visitor IP (123.34.56.78) reverse lookup is "123.34.56.78.adsl.provider.net" and filter is ".adsl.provider.net"

from wordpress-ip-geo-block.

tokkonopapa avatar tokkonopapa commented on August 16, 2024

Hi @ddur,

I got your point. Then how about this:

function my_allow_domain( $validate ) {
    $allowed_domain = 'your.domain';
    $visitor_domain = gethostbyaddr( $validate['ip'] );

    if ( preg_match( "/${visitor_domain}$/", $allowed_domain ) ) {
        $validate['result'] = 'passed';
    } elseif ( ! defined( 'DOING_AJAX' ) ) {
        $validate['result'] = 'blocked';
    } // else WP-ZEP block a malicious request

    return $validate;
}
add_filter( 'ip-geo-block-login', 'my_allow_domain' );
add_filter( 'ip-geo-block-admin', 'my_allow_domain' );

See http://www.ipgeoblock.com/codex/ip-geo-block-xxxxx.html

from wordpress-ip-geo-block.

ddur avatar ddur commented on August 16, 2024

Thanks

from wordpress-ip-geo-block.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.