PluginProbe
Vigilant – 100% Free Security Suite: Firewall, 2FA, Login, Headers, Scanner… / 3.0.0
Vigilant – 100% Free Security Suite: Firewall, 2FA, Login, Headers, Scanner… v3.0.0
3.0.0 2.11.12 2.11.11 2.11.10 2.11.9 2.11.7 2.11.8 2.11.6 2.11.5 2.11.4 2.11.3 2.11.1 2.11.2 2.11.0 2.10.5 2.10.4 2.10.3 2.10.2 2.10.1 2.10.0 2.9.9 2.9.8 2.9.6 2.9.7 2.9.5 All 88 releases
← All changes | includes/class-activator.php +43 -21 2.11.23.0.0 View file →
@@ -72,11 +72,8 @@
72 72 $settings = new Vigilante_Settings();
73 73 }
74 74 }
75 75
76 - // Create backup of current files FIRST (before any modifications)
77 - self::create_activation_backup( $settings );
78 -
79 76 // Apply htaccess protection (part of firewall module)
80 77 if ( $settings->is_module_enabled( 'firewall' ) ) {
81 78 self::apply_htaccess_protection( $settings );
82 79 }
@@ -109,8 +106,11 @@
109 106
110 107 // Schedule cron events
111 108 self::schedule_events();
112 109
110 + // Capture the self-integrity anchor (A3: manifest fingerprint in DB).
111 + self::anchor_self_integrity( $settings );
112 +
113 113 // Set activation transient for admin notice
114 114 set_transient( 'vigilante_activated', true, 30 );
115 115
116 116 // Store activation time
@@ -126,8 +126,35 @@
126 126 ob_end_clean();
127 127 }
128 128
129 129 /**
130 + * Anchor the self-integrity check on activation
131 + *
132 + * The first activation captures the fingerprint of the shipped manifest,
133 + * unless WordPress.org distributes something else for that version, so
134 + * the self-check has a baseline from the very first run. A
135 + * reactivation keeps the anchor it already has and checks against it:
136 + * capturing again adopted whatever manifest the folder held at that
137 + * moment, a regenerated one included, the same reason the critical files
138 + * baseline is not thrown away on reactivation.
139 + *
140 + * @since 3.0.0
141 + *
142 + * @param Vigilante_Settings $settings Settings instance.
143 + * @return void
144 + */
145 + public static function anchor_self_integrity( $settings ) {
146 + if ( ! class_exists( 'Vigilante_Self_Integrity' ) ) {
147 + require_once VIGILANTE_INCLUDES_DIR . 'class-self-integrity.php';
148 + }
149 + // run_check() captures on the first run itself, but only when
150 + // WordPress.org does not contradict the manifest; with an anchor already
151 + // there it checks against it.
152 + $self_integrity = new Vigilante_Self_Integrity( $settings );
153 + $self_integrity->run_check( 'activation' );
154 + }
155 +
156 + /**
130 157 * Idempotent migrations for existing installations.
131 158 *
132 159 * @param array $current_options Current vigilante_options array.
133 160 * @return bool True if any migration changed the stored option.
@@ -226,25 +253,8 @@
226 253 return true;
227 254 }
228 255
229 256 /**
230 - * Create backup of important files
231 - *
232 - * @param Vigilante_Settings $settings Settings instance.
233 - */
234 - private static function create_activation_backup( $settings ) {
235 - require_once VIGILANTE_INCLUDES_DIR . 'class-backup-manager.php';
236 -
237 - $backup_manager = new Vigilante_Backup_Manager();
238 - $result = $backup_manager->create_backups();
239 -
240 - if ( is_wp_error( $result ) ) {
241 - // Store error for admin notice
242 - set_transient( 'vigilante_backup_error', $result->get_error_message(), 60 );
243 - }
244 - }
245 -
246 - /**
247 257 * Apply htaccess protection
248 258 *
249 259 * @param Vigilante_Settings $settings Settings instance.
250 260 */
@@ -334,8 +344,14 @@
334 344 *
335 345 * @param Vigilante_Settings $settings Settings instance.
336 346 */
337 347 private static function remove_sensitive_files( $settings ) {
348 + // They sit in the root every site of a network shares. Until 2.11.6 the
349 + // activation on any site removed them.
350 + if ( ! Vigilante_Settings::can_write_shared_files() ) {
351 + return;
352 + }
353 +
338 354 $advanced = $settings->get_section( 'advanced' );
339 355
340 356 // Remove readme.html
341 357 if ( ! empty( $advanced['remove_readme'] ) ) {
@@ -375,9 +391,15 @@
375 391 $database = new Vigilante_Database();
376 392 $activity_log = null; // Not needed for baseline generation
377 393
378 394 $fi = new Vigilante_File_Integrity( $settings, $database, $activity_log );
379 - $fi->regenerate_all_baselines();
395 +
396 + // Same care as the migration: reactivating the plugin on a site that
397 + // already has an approved baseline must not throw it away and adopt
398 + // whatever the files say today.
399 + if ( ! $fi->get_critical_files_baseline() ) {
400 + $fi->regenerate_all_baselines();
401 + }
380 402 }
381 403
382 404 /**
383 405 * Schedule cron events