Esempio n. 1
0
function bpsPro_new_feature_autoupdate()
{
    $BPS_LSM_Options = get_option('bulletproof_security_options_login_security');
    if (!$BPS_LSM_Options['bps_login_security_remaining']) {
        $BPS_Options_lsm = array('bps_max_logins' => $BPS_LSM_Options['bps_max_logins'], 'bps_lockout_duration' => $BPS_LSM_Options['bps_lockout_duration'], 'bps_manual_lockout_duration' => $BPS_LSM_Options['bps_manual_lockout_duration'], 'bps_max_db_rows_display' => $BPS_LSM_Options['bps_max_db_rows_display'], 'bps_login_security_OnOff' => $BPS_LSM_Options['bps_login_security_OnOff'], 'bps_login_security_logging' => $BPS_LSM_Options['bps_login_security_logging'], 'bps_login_security_errors' => $BPS_LSM_Options['bps_login_security_errors'], 'bps_login_security_remaining' => 'On', 'bps_login_security_pw_reset' => $BPS_LSM_Options['bps_login_security_pw_reset'], 'bps_login_security_sort' => $BPS_LSM_Options['bps_login_security_sort']);
        foreach ($BPS_Options_lsm as $key => $value) {
            update_option('bulletproof_security_options_login_security', $BPS_Options_lsm);
        }
    }
    $bps_Root_CC_Options = 'bulletproof_security_options_customcode';
    if (!is_multisite()) {
        $Root_CC_Options = array('bps_customcode_one' => '', 'bps_customcode_server_signature' => '', 'bps_customcode_directory_index' => '', 'bps_customcode_server_protocol' => '', 'bps_customcode_error_logging' => '', 'bps_customcode_deny_dot_folders' => '', 'bps_customcode_admin_includes' => '', 'bps_customcode_wp_rewrite_start' => '', 'bps_customcode_request_methods' => '', 'bps_customcode_two' => '', 'bps_customcode_timthumb_misc' => '', 'bps_customcode_bpsqse' => '', 'bps_customcode_deny_files' => '', 'bps_customcode_three' => '');
    } else {
        $Root_CC_Options = array('bps_customcode_one' => '', 'bps_customcode_server_signature' => '', 'bps_customcode_directory_index' => '', 'bps_customcode_server_protocol' => '', 'bps_customcode_error_logging' => '', 'bps_customcode_deny_dot_folders' => '', 'bps_customcode_admin_includes' => '', 'bps_customcode_wp_rewrite_start' => '', 'bps_customcode_request_methods' => '', 'bps_customcode_two' => '', 'bps_customcode_timthumb_misc' => '', 'bps_customcode_bpsqse' => '', 'bps_customcode_wp_rewrite_end' => '', 'bps_customcode_deny_files' => '', 'bps_customcode_three' => '');
    }
    if (!get_option($bps_Root_CC_Options)) {
        foreach ($Root_CC_Options as $key => $value) {
            update_option('bulletproof_security_options_customcode', $Root_CC_Options);
        }
    }
    $bps_wpadmin_CC_Options = 'bulletproof_security_options_customcode_WPA';
    $wpadmin_CC_Options = array('bps_customcode_deny_files_wpa' => '', 'bps_customcode_one_wpa' => '', 'bps_customcode_two_wpa' => '', 'bps_customcode_bpsqse_wpa' => '');
    if (!get_option($bps_wpadmin_CC_Options)) {
        foreach ($wpadmin_CC_Options as $key => $value) {
            update_option('bulletproof_security_options_customcode_WPA', $wpadmin_CC_Options);
        }
    }
    // BPS .52.6: Pre-save UI Theme Skin with Blue Theme if DB option does not exist
    bpsPro_presave_ui_theme_skin_options();
    // .52.7: Set Security Log Limit POST Request Body Data option to checked/limited by default
    $bps_seclog_post_limit_Options = 'bulletproof_security_options_sec_log_post_limit';
    $seclog_post_limit_Options = array('bps_security_log_post_limit' => '1');
    if (!get_option($bps_seclog_post_limit_Options)) {
        foreach ($seclog_post_limit_Options as $key => $value) {
            update_option('bulletproof_security_options_sec_log_post_limit', $seclog_post_limit_Options);
        }
    }
}
Esempio n. 2
0
function bpsSetupWizardPrechecks()
{
    $successTextBegin = '<font color="green"><strong>';
    $successMessage = __(' DB Table created Successfully!', 'bulletproof-security');
    $successTextEnd = '</strong></font><br>';
    $failTextBegin = '<font color="red"><strong>';
    $failMessage = __('Error: Unable to create DB Table ', 'bulletproof-security');
    $failTextEnd = '</strong></font><br>';
    $sapi_type = php_sapi_name();
    echo '<h3>' . __('Setup Wizard Pre-Installation Checks:', 'bulletproof-security') . '</h3>
	<div style="font-size:12px;margin:-10px 0px 10px 0px;font-weight:bold;">' . __('If you see any Red font or Blue font messages displayed below, click the Read Me help button above and read the "Notes" help section before clicking the Setup Wizard button.', 'bulletproof-security') . '</div>';
    echo '<div id="Wizard-background" style="max-height:250px;width:85%;overflow:auto;margin:0px;padding:10px;border:2px solid black;background-color:#ffffe0;">';
    echo '<span class="setup-wizard-checks-text">';
    if (@substr($sapi_type, 0, 6) != 'apache' && get_filesystem_method() == 'direct') {
        echo $successTextBegin . __('Pass! Compatible Server Configuration: Server API: CGI | WP Filesystem API Method: direct.', 'bulletproof-security') . $successTextEnd;
    } elseif (@substr($sapi_type, 0, 6) == 'apache' && preg_match('#\\\\#', ABSPATH, $matches) && get_filesystem_method() == 'direct') {
        echo $successTextBegin . __('Pass! Compatible Server Configuration: Server Type Apache: XAMPP, WAMP, MAMP or LAMP | WP Filesystem API Method: direct.', 'bulletproof-security') . $successTextEnd;
    } elseif (@substr($sapi_type, 0, 6) == 'apache' && !preg_match('#\\\\#', ABSPATH, $matches) && get_filesystem_method() == 'direct') {
        echo $successTextBegin . __('Pass! Compatible Server Configuration: Server API: DSO | WP Filesystem API Method: direct.', 'bulletproof-security') . $successTextEnd;
    } elseif (@substr($sapi_type, 0, 6) == 'apache' && get_filesystem_method() != 'direct') {
        echo $failTextBegin . __('Server API: Apache DSO Server Configuration | WP Filesystem API Method: ', 'bulletproof-security') . get_filesystem_method() . $failTextEnd . '<br>' . __('Your Server type is DSO and the WP Filesystem API Method is NOT "direct". You can use the Setup Wizard, but you must first make some one-time manual changes to your website before running the Setup Wizard. Please click this Forum Link for instructions: ', 'bulletproof-security') . '<a href="http://forum.ait-pro.com/forums/topic/dso-setup-steps/" target="_blank" title="Link opens in a new Browser window"><strong>' . __('DSO Setup Steps', 'bulletproof-security') . '</a></strong><br><br>';
    }
    $memoryLimitM = get_cfg_var('memory_limit');
    $memoryLimit = str_replace('M', '', $memoryLimitM);
    if ($memoryLimit == '' || !$memoryLimitM) {
        echo '<strong><font color="blue">' . __('Unable to get the PHP Configuration Memory Limit value from the Server. It is recommended that your PHP Configuration Memory Limit is set to at least 128M. Contact your Web Host and ask them what your PHP Configuration Memory Limit is for your website.', 'bulletproof-security') . '</font></strong><br>';
    } else {
        switch ($memoryLimit) {
            case $memoryLimit >= '128':
                echo $successTextBegin . __('Pass! PHP Configuration Memory Limit is set to: ', 'bulletproof-security') . $memoryLimit . 'M' . $successTextEnd;
                break;
            case $memoryLimit >= '64' && $memoryLimit < '128':
                echo $successTextBegin . __('Pass! PHP Configuration Memory Limit is set to: ', 'bulletproof-security') . $memoryLimit . 'M. ' . __('It is recommended that you increase your memory limit to at least 128M. Contact your Web Host and ask them to increase your memory limit to the maximum memory limit setting allowed by your Host.', 'bulletproof-security') . $successTextEnd;
                break;
            case $memoryLimit > '0' && $memoryLimit < '64':
                echo '<br>' . $failTextBegin . __('Error: Your PHP Configuration Memory Limit is set to: ', 'bulletproof-security') . $memoryLimit . 'M. ' . __('WordPress needs a bare minimum Memory Limit setting of 64M to perform well. Contact your Web Host and ask them to increase your memory limit to the maximum memory limit setting allowed by your Host.', 'bulletproof-security') . $failTextEnd . '<br>';
                break;
        }
    }
    // BPS .52.6: Pre-save UI Theme Skin with Blue Theme if DB option does not exist
    bpsPro_presave_ui_theme_skin_options();
    // PHP/php.ini htaccess code pre-check - Check if root .htaccess file has php.ini handler code and if that code has been added to BPS Custom Code
    bpsSetupWizardPhpiniHandlerCheck();
    // mod_authz_core forward/backward compatibility: create new htaccess files if needed
    bpsPro_apache_mod_directive_check();
    // writable checks:
    // folders: /bps-backup/ and /htaccess/ folder
    // files: default.htaccess, secure.htaccess and wpadmin-secure.htaccess
    $htaccess_dir = WP_PLUGIN_DIR . '/bulletproof-security/admin/htaccess';
    $bps_backup_dir = WP_CONTENT_DIR . '/bps-backup';
    $secureHtaccess = $htaccess_dir . '/secure.htaccess';
    $wpadminHtaccess = $htaccess_dir . '/wpadmin-secure.htaccess';
    $defaultHtaccess = $htaccess_dir . '/default.htaccess';
    if (is_writable($htaccess_dir)) {
        echo $successTextBegin . __('Pass! The ', 'bulletproof-security') . $htaccess_dir . __(' Folder is writable.', 'bulletproof-security') . $successTextEnd;
    } else {
        echo $failTextBegin . __('Error: The ', 'bulletproof-security') . $htaccess_dir . __(' Folder is NOT writable. If your Server type is DSO and the WP Filesystem API Method is NOT "direct" you can use the Setup Wizard, but you must first make some one-time manual changes to your website before running the Setup Wizard. Please click this Forum Link for instructions: ', 'bulletproof-security') . '<a href="http://forum.ait-pro.com/forums/topic/dso-setup-steps/" target="_blank" title="Link opens in a new Browser window"><strong>' . __('DSO Setup Steps', 'bulletproof-security') . '</a>' . __(' If your Server type is CGI check the folder permissions. Folder permissions should be either 755 or 705.', 'bulletproof-security') . $failTextEnd . '<br>';
    }
    if (is_writable($bps_backup_dir)) {
        echo $successTextBegin . __('Pass! The ', 'bulletproof-security') . $bps_backup_dir . __(' Folder is writable.', 'bulletproof-security') . $successTextEnd;
    } else {
        echo $failTextBegin . __('Error: The ', 'bulletproof-security') . $bps_backup_dir . __(' Folder is NOT writable. If your Server type is DSO and the WP Filesystem API Method is NOT "direct" you can use the Setup Wizard, but you must first make some one-time manual changes to your website before running the Setup Wizard. Please click this Forum Link for instructions: ', 'bulletproof-security') . '<a href="http://forum.ait-pro.com/forums/topic/dso-setup-steps/" target="_blank" title="Link opens in a new Browser window"><strong>' . __('DSO Setup Steps', 'bulletproof-security') . '</a>' . __(' If your Server type is CGI check the folder permissions. Folder permissions should be either 755 or 705.', 'bulletproof-security') . $failTextEnd . '<br>';
    }
    if (is_writable($secureHtaccess)) {
        echo $successTextBegin . __('Pass! The ', 'bulletproof-security') . $secureHtaccess . __(' File is writable.', 'bulletproof-security') . $successTextEnd;
    } else {
        echo $failTextBegin . __('Error: The ', 'bulletproof-security') . $secureHtaccess . __(' File is NOT writable. If your Server type is DSO and the WP Filesystem API Method is NOT "direct" you can use the Setup Wizard, but you must first make some one-time manual changes to your website before running the Setup Wizard. Please click this Forum Link for instructions: ', 'bulletproof-security') . '<a href="http://forum.ait-pro.com/forums/topic/dso-setup-steps/" target="_blank" title="Link opens in a new Browser window"><strong>' . __('DSO Setup Steps', 'bulletproof-security') . '</a>' . __(' If your Server type is CGI check the file permissions. File permissions should be either 644 or 604.', 'bulletproof-security') . $failTextEnd . '<br>';
    }
    if (is_writable($wpadminHtaccess)) {
        echo $successTextBegin . __('Pass! The ', 'bulletproof-security') . $wpadminHtaccess . __(' File is writable.', 'bulletproof-security') . $successTextEnd;
    } else {
        echo $failTextBegin . __('Error: The ', 'bulletproof-security') . $wpadminHtaccess . __(' File is NOT writable. If your Server type is DSO and the WP Filesystem API Method is NOT "direct" you can use the Setup Wizard, but you must first make some one-time manual changes to your website before running the Setup Wizard. Please click this Forum Link for instructions: ', 'bulletproof-security') . '<a href="http://forum.ait-pro.com/forums/topic/dso-setup-steps/" target="_blank" title="Link opens in a new Browser window"><strong>' . __('DSO Setup Steps', 'bulletproof-security') . '</a>' . __(' If your Server type is CGI check the file permissions. File permissions should be either 644 or 604.', 'bulletproof-security') . $failTextEnd . '<br>';
    }
    if (is_writable($defaultHtaccess)) {
        echo $successTextBegin . __('Pass! The ', 'bulletproof-security') . $defaultHtaccess . __(' File is writable.', 'bulletproof-security') . $successTextEnd;
    } else {
        echo $failTextBegin . __('Error: The ', 'bulletproof-security') . $defaultHtaccess . __(' File is NOT writable. If your Server type is DSO and the WP Filesystem API Method is NOT "direct" you can use the Setup Wizard, but you must first make some one-time manual changes to your website before running the Setup Wizard. Please click this Forum Link for instructions: ', 'bulletproof-security') . '<a href="http://forum.ait-pro.com/forums/topic/dso-setup-steps/" target="_blank" title="Link opens in a new Browser window"><strong>' . __('DSO Setup Steps', 'bulletproof-security') . '</a>' . __(' If your Server type is CGI check the file permissions. File permissions should be either 644 or 604.', 'bulletproof-security') . $failTextEnd . '<br>';
    }
    echo '</span>';
    echo '</div>';
}