ARGUS WordPress Defence 1.0.0 — first production release
Automatic WordPress security: local firewall, malware and file-integrity scanning, vulnerability protection, quarantine, scheduled backups, an optional page cache, and automatic global threat intelligence. See README.md for installation, update, and uninstall instructions.
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Argus_Templates {
|
||||
|
||||
const ACTIVE_OPTION = 'argus_wpd_active_template';
|
||||
|
||||
public static function all() {
|
||||
return array(
|
||||
'personal' => array(
|
||||
'label' => __( 'Personal / Blog', 'argus-wordpress-defence' ),
|
||||
'description' => __( 'A personal site or small blog -- real protection without getting in the way of the one person who actually logs in.', 'argus-wordpress-defence' ),
|
||||
'settings' => array(
|
||||
'mode' => Argus_Settings::MODE_BLOCK,
|
||||
'waf_enabled' => true,
|
||||
'login_protection_enabled' => true,
|
||||
'xmlrpc_block_pingback' => true,
|
||||
'rest_api_protection_enabled' => true,
|
||||
'integrity_scan_enabled' => true,
|
||||
'malware_scan_enabled' => true,
|
||||
'vuln_intel_enabled' => true,
|
||||
'geoip_rir_enabled' => true,
|
||||
'challenge_enabled' => true,
|
||||
'login_attempt_threshold' => 5,
|
||||
'login_attempt_window_secs' => 600,
|
||||
'login_lockout_secs' => 900,
|
||||
'backup_interval_hours' => 168,
|
||||
'backup_retention_count' => 4,
|
||||
),
|
||||
),
|
||||
'business' => array(
|
||||
'label' => __( 'Business', 'argus-wordpress-defence' ),
|
||||
'description' => __( 'A company site with several editors/admins -- tighter login tolerance than a personal blog, everything else fully on.', 'argus-wordpress-defence' ),
|
||||
'settings' => array(
|
||||
'mode' => Argus_Settings::MODE_BLOCK,
|
||||
'waf_enabled' => true,
|
||||
'login_protection_enabled' => true,
|
||||
'xmlrpc_block_pingback' => true,
|
||||
'rest_api_protection_enabled' => true,
|
||||
'integrity_scan_enabled' => true,
|
||||
'malware_scan_enabled' => true,
|
||||
'vuln_intel_enabled' => true,
|
||||
'geoip_rir_enabled' => true,
|
||||
'challenge_enabled' => true,
|
||||
'login_attempt_threshold' => 4,
|
||||
'login_attempt_window_secs' => 600,
|
||||
'login_lockout_secs' => 1800,
|
||||
'backup_interval_hours' => 24,
|
||||
'backup_retention_count' => 7,
|
||||
),
|
||||
),
|
||||
'enterprise' => array(
|
||||
'label' => __( 'Enterprise', 'argus-wordpress-defence' ),
|
||||
'description' => __( 'A larger organization -- many admins/editors across more content and integrations, a bigger and more attractive attack surface than a single-team business site. STRICT mode, tight login tolerance.', 'argus-wordpress-defence' ),
|
||||
'settings' => array(
|
||||
'mode' => Argus_Settings::MODE_STRICT,
|
||||
'waf_enabled' => true,
|
||||
'login_protection_enabled' => true,
|
||||
'xmlrpc_block_pingback' => true,
|
||||
'rest_api_protection_enabled' => true,
|
||||
'integrity_scan_enabled' => true,
|
||||
'malware_scan_enabled' => true,
|
||||
'vuln_intel_enabled' => true,
|
||||
'geoip_rir_enabled' => true,
|
||||
'challenge_enabled' => true,
|
||||
'login_attempt_threshold' => 3,
|
||||
'login_attempt_window_secs' => 600,
|
||||
'login_lockout_secs' => 3600,
|
||||
'backup_interval_hours' => 24,
|
||||
'backup_retention_count' => 14,
|
||||
),
|
||||
),
|
||||
'ecommerce' => array(
|
||||
'label' => __( 'Online Store (WooCommerce, Easy Digital Downloads, or other)', 'argus-wordpress-defence' ),
|
||||
'description' => __( 'Real customer accounts, payment/order data, and a REST API third parties call -- the highest-value target of the four, so STRICT mode, the tightest login tolerance, and the longest lockout (payment fraud is a stronger incentive to keep retrying than most other attacks).', 'argus-wordpress-defence' ),
|
||||
'settings' => array(
|
||||
'mode' => Argus_Settings::MODE_STRICT,
|
||||
'waf_enabled' => true,
|
||||
'login_protection_enabled' => true,
|
||||
'xmlrpc_block_pingback' => true,
|
||||
'rest_api_protection_enabled' => true,
|
||||
'integrity_scan_enabled' => true,
|
||||
'malware_scan_enabled' => true,
|
||||
'vuln_intel_enabled' => true,
|
||||
'geoip_rir_enabled' => true,
|
||||
'challenge_enabled' => true,
|
||||
'login_attempt_threshold' => 3,
|
||||
'login_attempt_window_secs' => 600,
|
||||
'login_lockout_secs' => 7200,
|
||||
'backup_interval_hours' => 12,
|
||||
'backup_retention_count' => 10,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public static function recommended() {
|
||||
return self::is_ecommerce_site() ? 'ecommerce' : null;
|
||||
}
|
||||
|
||||
public static function is_ecommerce_site() {
|
||||
if ( class_exists( 'WooCommerce' ) ) {
|
||||
return true;
|
||||
}
|
||||
if ( function_exists( 'EDD' ) ) {
|
||||
return true;
|
||||
}
|
||||
return (bool) apply_filters( 'argus_wpd_is_ecommerce_site', false );
|
||||
}
|
||||
|
||||
public static function apply( $key ) {
|
||||
$templates = self::all();
|
||||
if ( ! isset( $templates[ $key ] ) ) {
|
||||
return false;
|
||||
}
|
||||
Argus_Settings::update( $templates[ $key ]['settings'] );
|
||||
update_option( self::ACTIVE_OPTION, $key, false );
|
||||
Argus_Events::record(
|
||||
'template_applied',
|
||||
'info',
|
||||
sprintf( 'Applied the "%s" protection template', $templates[ $key ]['label'] ),
|
||||
array( 'template' => $key )
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function active() {
|
||||
return get_option( self::ACTIVE_OPTION, '' );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user