Changeset 3337763
- Timestamp:
- 08/01/2025 11:11:44 AM (7 months ago)
- Location:
- cloudaware-security-audit/trunk
- Files:
-
- 2 edited
-
cloudaware-security-audit.php (modified) (10 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cloudaware-security-audit/trunk/cloudaware-security-audit.php
r3334658 r3337763 4 4 Plugin URI: https://www.cloudaware.eu 5 5 Description: Plugin to monitor and audit security aspects of your Wordpress installation 6 Version: 1.0. 96 Version: 1.0.10 7 7 Author: Jeroen Hermans 8 8 License: GPLv2 … … 61 61 } 62 62 63 64 if ( ! function_exists( 'wp_check_php_version' ) ) { 65 require_once ABSPATH . 'wp-admin/includes/misc.php'; 66 } 63 67 $data = array('global_autoupdates' => array('themes' => $global_theme_autoupdate, 'plugins' => $global_plugin_autoupdate), 64 68 'core' => $core_updates, … … 67 71 'url' => get_option( 'siteurl' ), 68 72 'time' => time(), 73 'php' => wp_check_php_version()+array('version'=>PHP_VERSION), 69 74 'config' => cloudseca_get_config($plugins), 70 75 'themehashes' => hashFoldersInDirectory(ABSPATH, 'wp-content/themes'), 71 76 'pluginhashes' => hashFoldersInDirectory(ABSPATH, 'wp-content/plugins') 72 77 ); 78 $data['core']['php_version'] = $data['php']['version']; //Fix for Wordpress incorrect version 73 79 74 80 foreach($data['plugins'] as $name => &$plugindata) { … … 140 146 $data['themes'][$name]['Update'] = $themedata->update; 141 147 $data['themes'][$name]['Name'] = $themedetails->get('Name'); 142 $data['themes'][$name]['version'] = $themedetails->get(' version');148 $data['themes'][$name]['version'] = $themedetails->get('Version'); 143 149 144 150 if( array_key_exists($name, $theme_updates) ) { … … 230 236 echo " A new user <strong>cloudaware</strong> will be created with minimal access (role <code>cloudseca_api</code>).<br>\n"; 231 237 echo " If a cloudaware.eu callback url has been defined, a secure application password will be generated and sent to CloudAware’s secure callback URL for monitoring. If the callback url is not in the cloudaware.eu domain, it will be shown to you once and not send anywhere else.</p>\n"; 232 echo " <button id=\"cloudseca_confirm_btn\" class=\"button button-primary\" style=\"background-color: #28a745; border-color: #28a745;\">Confirm</button>\n";233 echo " <button id=\"cloudseca_cancel_btn\" class=\"button\" style=\"background-color: #dc3545; border-color: #dc3545; color: white;\">Cancel</button>\n";238 echo " <button id=\"cloudseca_confirm_btn\" class=\"button button-primary\">Confirm</button>\n"; 239 echo " <button id=\"cloudseca_cancel_btn\" class=\"button\">Cancel</button>\n"; 234 240 echo "</div>\n"; 235 241 echo "<div id=\"cloudseca_response\"></div>\n"; … … 269 275 echo " });\n"; 270 276 echo "});\n"; 277 278 echo "function cloudsecaCopyPassword() {\n"; 279 echo " const el = document.getElementById('cloudseca_app_password');\n"; 280 echo " const text = el.textContent || el.innerText;\n\n"; 281 echo " navigator.clipboard.writeText(text).then(() => {\n"; 282 echo " const feedback = document.getElementById('cloudseca_copy_feedback');\n"; 283 echo " feedback.style.display = 'inline';\n\n"; 284 echo " setTimeout(() => {\n"; 285 echo " feedback.style.display = 'none';\n"; 286 echo " }, 2000);\n"; 287 echo " }).catch(err => {\n"; 288 echo " console.error('Copy failed', err);\n"; 289 echo " });\n"; 290 echo "}\n"; 271 291 echo "</script>\n"; 272 292 } … … 327 347 $desired_perms = [ 328 348 'activate_plugins' => true, 349 'edit_others_posts' => true, //needed for list_users 329 350 'list_users' => true, 330 351 'read' => true, … … 417 438 // Show password to user 418 439 wp_send_json_success([ 419 'message' => 'API user created. Please copy the application password now — it will not be shown again: <code>'.$app_pass[0].'</code>' 420 ]); } 440 'message' => '<div style="display: flex; align-items: center; gap: 8px;"> API user created. Please copy the application password now — it will not be shown again: <code id="cloudseca_app_password">'.implode(' ', str_split($app_pass[0], 4)).'</code> <span id="cloudseca_copy_icon" style="cursor: pointer;" title="Copy password" onclick="cloudsecaCopyPassword()">📋</span> <span id="cloudseca_copy_feedback" style="display: none; color: green; font-weight: bold;">Copied!</span></div>' 441 ]); 442 } 421 443 } else { 422 444 wp_send_json_success(['message' => 'Application password already exists.']); … … 493 515 494 516 #Configuration 495 $config['admin_user_found'] = username_exists( 'admin' );517 $config['admin_user_found'] = username_exists( 'admin' ); 496 518 $config['disallow_file_edit'] = defined('DISALLOW_FILE_EDIT'); 497 $config['debug'] = (defined('WP_DEBUG') && WP_DEBUG); 498 $config['debug_log'] = (defined('WP_DEBUG_LOG') && WP_DEBUG_LOG); 499 $config['debug_display'] = defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY; 500 $config['script_debug'] = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG; 501 $config['home_https'] = (defined('WP_HOME') && strpos(WP_HOME, 'https://') === 0) ; 502 $config['siteurl_https'] = (defined('WP_SITEURL') && strpos(WP_SITEURL, 'https://') === 0); 503 $config['force_ssl_admin'] = (defined('FORCE_SSL_ADMIN') && strpos(FORCE_SSL_ADMIN, 'https://') === 0); 504 $config['autosave_interval'] = defined('AUTOSAVE_INTERVAL')?AUTOSAVE_INTERVAL:null; 505 $config['post_revisions'] = defined('WP_POST_REVISIONS')?WP_POST_REVISIONS:null; 506 $config['empty_trash_days'] = defined('EMPTY_TRASH_DAYS')?EMPTY_TRASH_DAYS:null; 507 $config['memory_limit'] = defined('WP_MEMORY_LIMIT')?WP_MEMORY_LIMIT:null; 519 $config['debug'] = (defined('WP_DEBUG') && WP_DEBUG); 520 $config['debug_log'] = (defined('WP_DEBUG_LOG') && WP_DEBUG_LOG); 521 $config['debug_display'] = defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY; 522 $config['script_debug'] = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG; 523 $config['home_https'] = (defined('WP_HOME') && strpos(WP_HOME, 'https://') === 0) ; 524 $config['siteurl_https'] = (defined('WP_SITEURL') && strpos(WP_SITEURL, 'https://') === 0); 525 $config['force_ssl_admin'] = (defined('FORCE_SSL_ADMIN') && strpos(FORCE_SSL_ADMIN, 'https://') === 0); 526 $config['autosave_interval'] = defined('AUTOSAVE_INTERVAL')?AUTOSAVE_INTERVAL:null; 527 $config['post_revisions'] = defined('WP_POST_REVISIONS')?WP_POST_REVISIONS:null; 528 $config['empty_trash_days'] = defined('EMPTY_TRASH_DAYS')?EMPTY_TRASH_DAYS:null; 529 $config['memory_limit'] = defined('WP_MEMORY_LIMIT')?WP_MEMORY_LIMIT:null; 530 $config['timezone_correct'] = ( 'UTC' == date_default_timezone_get() ); 531 532 //include some tests from site-health 533 if ( ! class_exists( 'WP_Site_Health' ) ) { 534 require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; 535 } 536 $site_health = new WP_Site_Health(); 537 538 $config['sql_server'] = cloudseca_get_db_info($site_health); 539 540 $config['cron'] = array( 541 "missed_cron" => $site_health->has_missed_cron(), 542 "late_cron" => $site_health->has_late_cron(), 543 ); 544 545 if ( ! function_exists( 'ini_get' ) ) { 546 $config['file_uploads'] = !empty( ini_get( 'file_uploads' ) ); 547 } 548 549 550 if ( function_exists( 'disk_free_space' ) ) { 551 $config['diskspace']['free'] = intval( @disk_free_space( WP_CONTENT_DIR ) / MB_IN_BYTES ); 552 if ( $config['diskspace']['free'] < 20 ) { 553 $config['diskspace']['status'] = 'critical'; 554 } elseif ( $config['diskspace']['free'] < 100 ) { 555 $config['diskspace']['status'] = 'low'; 556 } else { 557 $config['diskspace']['status'] = 'ok'; 558 } 559 } 508 560 509 561 $url = rtrim(get_option( 'siteurl' ), "/"); … … 514 566 515 567 return $config; 568 } 569 570 function cloudseca_get_db_info($site_health) { 571 global $wpdb; 572 $sql_server = $site_health->get_test_sql_server(); 573 574 $db_info = array( 575 "status" => $sql_server['status'], 576 "label" => $sql_server['label'], 577 "type" => stripos( $server_info, 'mariadb' ) !== false ? 'mariadb' : 'mysql', 578 "version" => $wpdb->db_version(), 579 ); 580 581 $file = ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; 582 583 if ( file_exists( $file ) ) { 584 $contents = file_get_contents( $file ); 585 586 $keys = [ 587 'mysql_required_version', 588 'mysql_recommended_version', 589 'mariadb_recommended_version', 590 ]; 591 592 foreach ( $keys as $key ) { 593 $re = '/^\s*private\s+\$'.$key.'\s*=\s*\'([^\']+)\'/m'; 594 if ( preg_match( $re, $contents, $matches ) ) { 595 $db_info[ $key ] = $matches[1]; 596 } 597 } 598 } 599 600 return $db_info; 516 601 } 517 602 -
cloudaware-security-audit/trunk/readme.txt
r3334658 r3337763 5 5 Requires at least: 6.0 6 6 Tested up to: 6.8 7 Stable tag: 1.0. 97 Stable tag: 1.0.10 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 75 75 == Changelog == 76 76 77 = v1.0.10 = 78 * SQL server version check 79 * disk space check 80 * cron information 81 * file uploads enabled in PHP config? 82 * timezone check 83 77 84 = v1.0.9 = 78 85 * Code cleanup
Note: See TracChangeset
for help on using the changeset viewer.