Support » Plugin: Login LockDown » Multisite Compatibility?

Viewing 15 replies - 1 through 15 (of 16 total)
  • +1:

    There is another topic (http://wordpress.org/support/topic/multisite-php-log-errors?replies=3) on the same question.

    Dear, mvandemar, answer us pls 🙂

    Hi all, interested in this aspect (how does Login LockDown perform on a multisite) I can share my experience with Limit Login Attempts http://wordpress.org/plugins/limit-login-attempts/ :

    Although Limit Login Attempts does not provide specific multisite options it does work well on a multisite when Network activated. The default settings provide all the security you expect right out of the box on all sites in the network.

    I would not be surprised if it turns out that Login LockDown behaves the same way. Can the developer confirm this?

    However, it would be even better if there was full multisite compatibility in that it provides a network admin options page where super admin can define different default settings and (for example) allow or prevent individual site admins to change settings on their own site…

    UPDATE: just had the chance to test Login LockDown on a multisite installation. Activated network-wide, it seems to function only on the main site, not on sub-sites. At least not on a subdir installation…

    Plugin Author mvandemar

    (@mvandemar)

    Sorry, no, I still have not fixed this. I do know what I need to change now, I just haven’t had a chance to do so. I will try and get it updated soon.

    -Michael

    Hi Michael, thanks for the update 🙂 … is this issue occurring because the plugin needs it’s own database tables that are not created for all sites on network-activation?

    May I make a suggestion? Instead of fixing the plugin so that it does start working after a network activation just like it would after activation on a single site installation (hope you understand what I’m trying to say), you might want to move forward and make it truely a multisite compatible plugin. Just like the plugin Login Security Solution does it: after network-wide activation we get ONE network admin settings page (to control the plugin network-wide) instead of a settings page on each site in the network.

    Advantages are: 1. easy control by super admin without bothering site admins with new options 2. no need for the plugin to create new database tables for all sites and 3. global network-wide lockouts of attacker IPs.

    Hope that helps 🙂

    Nice idea!

    mvandemar, answer here pls when you update the plugin – I am subscribed at this topic.

    Plugin Author mvandemar

    (@mvandemar)

    Hey guys, I plan to make it fully multisite compatible when I update it, and not just fix the symptoms. I will update this thread and the other one once I get it fixed.

    -Michael

    Ok, thank you!

    The main problem I can not use it for now – simple sites admins have too much settings. I don’t remember which exactly but the definitely should not have the opportunity to see/change paths, modify vital files, no JS/PHP/ect text area, block super admins and the server must be safed from them to be overloaded…

    So, it’s ok they have some options (may be they want to set 3 attempts or 30 but not 10), but they still should stay in a sandbox. Only super-admin should rule vital server/net things.

    Good coding – waiting your success! 🙂

    any progress on this? my error logs flooded!

    (again — love the plugin, one of the greats – saying this with positivity!)

    +1 on this for multisite…any ETA for when it will be fully Multiste compatible?

    Just commenting here to get subscribed to the topic. Would like to see this implemented. Cheers

    I’ve written a patch for multi-site support. Based off of shibashake.com

    This patch runs the install for a network site when:

    • Login lockdowns “network enable” plugin button is pressed
    • adding a new network site
    • entering a special URL to patch sites missing these tables from before

    General Installation:

    1. Add the code below into the bottom of /wp-content/plugins/loginlockdown/loginlockdown.php, right before the closing ?>

    Legacy Patch Instructions: (if you hit “network enable” before this and now your error logs are endless)

    1. For legacy support visit your websites dashboard, and add the following to the url: ? loginlockdown_network_patch, i.e. http://example.com/wp-admin/? loginlockdown_network_patch – this triggers a cycle that checks for the missing tables and installs when missing
    /**
     * multisite: network wide plugin-activation patch
     *
     * small patch for Login Lockdown that activates Login Lockdown for all sites when set to network enabled
     *
     * @since 1.6.(?)
     * @author davidsword
     */
    register_activation_hook( __FILE__, 'handsomefox_loginlockdown_multisite_activate' );
    function handsomefox_loginlockdown_multisite_activate($networkwide) {
        global $wpdb;
    
        if (function_exists('is_multisite') && is_multisite()) {
            // check if it is a network activation - if so, run the activation function for each blog id
            if ($networkwide) {
                $old_blog = $wpdb->blogid;
                // Get all blog ids
                $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
                foreach ($blogids as $blog_id) {
                    switch_to_blog($blog_id);
                    loginLockdown_install();
                }
                switch_to_blog($old_blog);
                return;
            }
        }
    }
    /**
     * multisite: new site activation patch
     *
     * small patch for Login Lockdown that runs the table+options creations for newly created sites when LL is network enabled
     *
     * @since 1.6.(?)
     * @author davidsword
     */
    add_action( 'wpmu_new_blog', 'handsomefox_loginlockdown_multisite_newsite', 10, 6);
    function handsomefox_loginlockdown_multisite_newsite($blog_id, $user_id, $domain, $path, $site_id, $meta ) {
        global $wpdb;
    
        if (is_plugin_active_for_network('loginlockdown/loginlockdown.php')) {
            $old_blog = $wpdb->blogid;
            switch_to_blog($blog_id);
            loginLockdown_install();
            switch_to_blog($old_blog);
        }
    }
    /**
     * multisite: old sites check
     *
     * prior to these patches you could network enable, see the options page, but none of the tables exsist
     * this function repairs all instances where the plugin is network enabled but not properly installed.
     * to prevent this from firing unessisaryly, we'll add a GET var to trigger it
     *
     * @since 1.6.(?)
     * @author davidsword
     */
    add_action('admin_init','handsomefox_loginlockdown_multisite_legacy');
    function handsomefox_loginlockdown_multisite_legacy() {
    	global $wpdb;
    
        if (function_exists('is_multisite') && is_multisite() && isset($_GET['loginlockdown_network_patch'])) {
    
            $old_blog = $wpdb->blogid;
    
            // Get all blog ids
            $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
            foreach ($blogids as $blog_id) {
    
                // check if already exists
    			$bed_check = $wpdb->query("SHOW TABLES LIKE '{$wpdb->base_prefix}{$blog_id}_login_fails'");
                if (!$bed_check) {
    
                    switch_to_blog($blog_id);
    				loginLockdown_install();
    
    			}
            }
            switch_to_blog($old_blog);
            return;
        }
    }

    Hope you all enjoy and the author integrates this!

    Plugin Author mvandemar

    (@mvandemar)

    @davidsword – thank you for coming up with this. I have stickied this thread in the support forum until I can get to patching the plugin itself.

    -Michael

    So I’m slightly confused – all three bits of code need to be added to the same file – /wp-content/plugins/loginlockdown/loginlockdown.php – or they need to be added in different places?

    This enables the settings for all sites to be managed by SuperAdmin instead of individual site management, correct? Or it does not do that yet?

    yes, add 3 snippets to bottom of loginlockdown.php .. then trigger the patch for your already created sites by visiting:

    .../wp-admin/?loginlockdown_network_patch

    (in retrospect I should of just made that patch fire and checked against it with a wp option value.. oops)

    no, doesn’t allow for only-superadmin

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Multisite Compatibility?’ is closed to new replies.