Plugin Directory

Changeset 3337763


Ignore:
Timestamp:
08/01/2025 11:11:44 AM (7 months ago)
Author:
cloudaware
Message:

New release 1.0.10

Location:
cloudaware-security-audit/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cloudaware-security-audit/trunk/cloudaware-security-audit.php

    r3334658 r3337763  
    44Plugin URI:   https://www.cloudaware.eu
    55Description:  Plugin to monitor and audit security aspects of your Wordpress installation
    6 Version:      1.0.9
     6Version:      1.0.10
    77Author:       Jeroen Hermans
    88License:      GPLv2
     
    6161  }
    6262
     63
     64  if ( ! function_exists( 'wp_check_php_version' ) ) {
     65    require_once ABSPATH . 'wp-admin/includes/misc.php';
     66  }
    6367  $data = array('global_autoupdates' => array('themes' => $global_theme_autoupdate, 'plugins' => $global_plugin_autoupdate),
    6468                'core'    => $core_updates,
     
    6771                'url'     => get_option( 'siteurl' ),
    6872                'time'    => time(),
     73                'php'     => wp_check_php_version()+array('version'=>PHP_VERSION),
    6974                'config'  => cloudseca_get_config($plugins),
    7075                'themehashes'  => hashFoldersInDirectory(ABSPATH, 'wp-content/themes'),
    7176                'pluginhashes' => hashFoldersInDirectory(ABSPATH, 'wp-content/plugins')
    7277          );
     78  $data['core']['php_version'] = $data['php']['version']; //Fix for Wordpress incorrect version
    7379
    7480  foreach($data['plugins'] as $name => &$plugindata) {
     
    140146    $data['themes'][$name]['Update']  = $themedata->update;
    141147    $data['themes'][$name]['Name']    = $themedetails->get('Name');
    142     $data['themes'][$name]['version'] = $themedetails->get('version');
     148    $data['themes'][$name]['version'] = $themedetails->get('Version');
    143149
    144150    if( array_key_exists($name, $theme_updates) ) {
     
    230236  echo "  A new user <strong>cloudaware</strong> will be created with minimal access (role <code>cloudseca_api</code>).<br>\n";
    231237  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";
    234240  echo "</div>\n";
    235241  echo "<div id=\"cloudseca_response\"></div>\n";
     
    269275  echo "    });\n";
    270276  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";
    271291  echo "</script>\n";
    272292}
     
    327347    $desired_perms = [
    328348        'activate_plugins'        => true,
     349        'edit_others_posts'       => true, //needed for list_users
    329350        'list_users'              => true,
    330351        'read'                    => true,
     
    417438            // Show password to user
    418439            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        }
    421443    } else {
    422444        wp_send_json_success(['message' => 'Application password already exists.']);
     
    493515
    494516  #Configuration
    495   $config['admin_user_found'] = username_exists( 'admin' );
     517  $config['admin_user_found']   = username_exists( 'admin' );
    496518  $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  }
    508560
    509561  $url = rtrim(get_option( 'siteurl' ), "/");
     
    514566
    515567  return $config;
     568}
     569
     570function 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;
    516601}
    517602
  • cloudaware-security-audit/trunk/readme.txt

    r3334658 r3337763  
    55Requires at least: 6.0
    66Tested up to: 6.8
    7 Stable tag: 1.0.9
     7Stable tag: 1.0.10
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7575== Changelog ==
    7676
     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
    7784= v1.0.9 =
    7885* Code cleanup
Note: See TracChangeset for help on using the changeset viewer.