PluginProbe ʕ •ᴥ•ʔ
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) / 9.5.11
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) v9.5.11
9.5.11 9.5.10.1 9.5.10 trunk 9.4.0 9.4.1 9.4.2 9.4.3 9.5.0 9.5.0.1 9.5.0.2 9.5.1 9.5.2 9.5.2.2 9.5.2.3 9.5.3 9.5.3.1 9.5.3.2 9.5.4 9.5.5 9.5.6 9.5.7 9.5.8 9.5.9
really-simple-ssl / security / notices.php
really-simple-ssl / security Last commit date
includes 4 weeks ago server 4 weeks ago tests 4 weeks ago wordpress 4 weeks ago class-rsssl-htaccess-file-manager.php 4 weeks ago cron.php 4 weeks ago deactivate-integration.php 4 weeks ago firewall-manager.php 4 weeks ago functions.php 4 weeks ago index.php 4 weeks ago integrations.php 4 weeks ago notices.php 4 weeks ago security.php 4 weeks ago sync-settings.php 4 weeks ago tests.php 4 weeks ago
notices.php
162 lines
1 <?php defined( 'ABSPATH' ) or die();
2 /**
3 * Convert htaccess rules to html friendly layout
4 *
5 * @param string $code
6 *
7 * @return string
8 */
9 function rsssl_parse_htaccess_to_html( string $code): string {
10 if ( strpos($code, "\n")===0 ) {
11 $code = preg_replace('/\n/', '', $code, 1);
12 }
13 //split into linebreak separated array, so we can run esc_html on the result
14 $code = preg_replace('/\n/', '--br--', $code, 1);
15 $code = preg_replace('/<br>/', '--br--', $code, 1);
16 $code_arr = explode('--br--', $code);
17 $code_arr = array_map('esc_html', $code_arr);
18 $code = implode('<br>', $code_arr);
19 return '<br><code>' . $code . '</code><br>';
20 }
21
22 function rsssl_general_security_notices( $notices ) {
23 $code = rsssl_parse_htaccess_to_html( get_site_option( 'rsssl_htaccess_rules', '' ) );
24 $uploads_code = rsssl_parse_htaccess_to_html( get_site_option( 'rsssl_uploads_htaccess_rules', '' ) );
25 $open_hardening_count = rsssl_count_open_hardening_features();
26
27 $notices['htaccess_status'] = array(
28 'callback' => 'rsssl_htaccess_status',
29 'score' => 5,
30 'output' => array(
31 'not-writable' => array(
32 'title' => __( ".htaccess not writable", "really-simple-ssl" ),
33 'msg' => __( "An option that requires the .htaccess file is enabled, but the file is not writable.", "really-simple-ssl" ) . ' ' . __( "Please add the following lines to your .htaccess, or set it to writable:", "really-simple-ssl" ) . $code,
34 'icon' => 'warning',
35 'dismissible' => true,
36 'plusone' => true,
37 'url' => 'manual/editing-htaccess/',
38 ),
39 'not-exists' => array(
40 'title' => __( ".htaccess does not exist", "really-simple-ssl" ),
41 'msg' => __( "An option that requires the .htaccess file is enabled, but the file does not exist.", "really-simple-ssl" ) . ' ' . __( "Please add the following lines to your .htaccess, or set it to writable:", "really-simple-ssl" ) . $code,
42 'icon' => 'warning',
43 'dismissible' => true,
44 'plusone' => true,
45 'url' => 'manual/editing-htaccess/',
46 ),
47 ),
48 'show_with_options' => [
49 'disable_indexing',
50 'redirect'
51 ]
52 );
53
54 $notices['htaccess_status_uploads'] = array(
55 'callback' => 'rsssl_uploads_htaccess_status',
56 'score' => 5,
57 'output' => array(
58 'not-writable' => array(
59 'title' => __( ".htaccess in uploads not writable", "really-simple-ssl" ),
60 'msg' => __( "An option that requires the .htaccess file in the uploads directory is enabled, but the file is not writable.", "really-simple-ssl" ) . ' ' . __( "Please add the following lines to your .htaccess, or set it to writable:", "really-simple-ssl" ) . $uploads_code,
61 'icon' => 'warning',
62 'dismissible' => true,
63 'plusone' => true,
64 'url' => 'manual/editing-htaccess/',
65 ),
66 ),
67 'show_with_options' => [
68 'block_code_execution_uploads',
69 ]
70 );
71
72 $notices['display_name_is_login_exists'] = array(
73 'condition' => [ 'rsssl_get_users_where_display_name_is_login' ],
74 'callback' => '_true_',
75 'score' => 5,
76 'output' => array(
77 'true' => array(
78 'url' => 'manual/login-and-display-names-should-be-different-for-wordpress/',
79 'msg' => __( "We have detected administrator roles where the login and display names are the same.", "really-simple-ssl" ) . "&nbsp;<b>" . rsssl_list_users_where_display_name_is_login_name() . "</b>",
80 'icon' => 'open',
81 'dismissible' => true,
82 ),
83 ),
84 );
85
86 $notices['new_username_empty'] = array(
87 'condition' => [ 'rsssl_has_admin_user', 'option_rename_admin_user', 'NOT rsssl_new_username_valid' ],
88 'callback' => '_true_',
89 'score' => 5,
90 'output' => array(
91 'true' => array(
92 'highlight_field_id' => 'rename_admin_user',
93 'title' => __( "Username", "really-simple-ssl" ),
94 'msg' => __( "Rename admin user enabled: Please choose a new username of at least 3 characters, which is not in use yet.", "really-simple-ssl" ),
95 'icon' => 'warning',
96 'dismissible' => true,
97 ),
98 ),
99 'show_with_options' => [
100 'new_admin_user_login',
101 ],
102 );
103
104 $notices['enable_vulnerability_scanner'] = array(
105 'callback' => 'option_enable_vulnerability_scanner',
106 'score' => 5,
107 'output' => array(
108 'false' => array(
109 'highlight_field_id' => 'enable_vulnerability_scanner',
110 'msg' => __( "Enable the Vulnerability scan to detect possible vulnerabilities.", 'really-simple-ssl' ),
111 'icon' => 'open',
112 'admin_notice' => false,
113 'dismissible' => true,
114 'plusone' => false,
115 ),
116 'true' => array(
117 'msg' => __( "Vulnerability scanning is enabled.", 'really-simple-ssl' ),
118 'icon' => 'success',
119 ),
120 ),
121 );
122
123 $notices['count_open_hardening_features'] = array(
124 'callback' => 'rsssl_has_open_hardening_features',
125 'score' => 5,
126 'output' => array(
127 'true' => array(
128 'highlight_field_id' => 'disable_anyone_can_register',
129 'msg' => sprintf(
130 _n(
131 "You have %s open hardening feature.",
132 "You have %s open hardening features.",
133 $open_hardening_count,
134 "really-simple-ssl"
135 ),
136 $open_hardening_count
137 ),
138 'icon' => 'open',
139 'dismissible' => true,
140 ),
141 'false' => array(
142 'msg' => __( "All recommended hardening features enabled.", "really-simple-ssl" ),
143 'icon' => 'success',
144 ),
145 ),
146 );
147
148 $notices['lock_file_exists'] = array(
149 'callback' => 'rsssl_lock_file_exists',
150 'score' => 5,
151 'output' => array(
152 'true' => array(
153 'msg' => __( 'The Firewall, LLA and 2FA are currently inactive, as you have activated Safe Mode with the rsssl-safe-mode.lock file. Remove the file from your /wp-content folder after you have finished debugging.', 'really-simple-ssl' ),
154 'icon' => 'warning',
155 ),
156 ),
157 );
158
159 return $notices;
160 }
161 add_filter('rsssl_notices', 'rsssl_general_security_notices');
162