dolibarr  20.0.0-beta
security.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2022 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
23 // Load Dolibarr environment
24 require '../../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
32 
33 // Load translation files required by the page
34 $langs->loadLangs(array("install", "other", "admin", "errors"));
35 
36 if (!$user->admin) {
38 }
39 
40 if (GETPOST('action', 'aZ09') == 'donothing') {
41  exit;
42 }
43 
44 $execmethod = getDolGlobalInt('MAIN_EXEC_USE_POPEN', 1);
45 
46 
47 /*
48  * View
49  */
50 
51 $form = new Form($db);
52 
53 llxHeader();
54 
55 print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
56 
57 print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span>';
58 print ' &nbsp; &nbsp; ';
59 print '<a href="'.$_SERVER["PHP_SELF"].'">';
60 print img_picto($langs->trans("Reload"), 'refresh').' ';
61 print $langs->trans("Reload");
62 print '</a>';
63 print '<br>';
64 print '<br>';
65 
66 
67 print '<br>';
68 
69 
70 print load_fiche_titre($langs->trans("PHPSetup"), '', 'folder');
71 
72 
73 print '<div class="divsection wordbreak">';
74 
75 // Get version of PHP
76 $phpversion = version_php();
77 print "<strong>PHP</strong>: ".$langs->trans("Version").": ".$phpversion;
78 if (function_exists('php_ini_loaded_file')) {
79  $inipath = php_ini_loaded_file();
80  print " - <strong>INI</strong>: ".$inipath;
81 }
82 print "<br>\n";
83 
84 // Get version of web server
85 print "<br><strong>Web server - ".$langs->trans("Version")."</strong>: ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
86 print '<strong>'.$langs->trans("DataRootServer")."</strong>: ".DOL_DATA_ROOT."<br>\n";
87 // Web user group by default
88 $labeluser = dol_getwebuser('user');
89 $labelgroup = dol_getwebuser('group');
90 if ($labeluser && $labelgroup) {
91  print '<strong>'.$langs->trans("WebUserGroup")." (env vars)</strong> : ".$labeluser.':'.$labelgroup;
92  if (function_exists('posix_geteuid') && function_exists('posix_getpwuid')) {
93  $arrayofinfoofuser = posix_getpwuid(posix_geteuid());
94  print ' <span class="opacitymedium">(POSIX '.$arrayofinfoofuser['name'].':'.$arrayofinfoofuser['gecos'].':'.$arrayofinfoofuser['dir'].':'.$arrayofinfoofuser['shell'].')</span><br>'."\n";
95  }
96 }
97 // Web user group real (detected by 'id' external command)
98 if (function_exists('exec')) {
99  $arrayout = array();
100  $varout = 0;
101  exec('id', $arrayout, $varout);
102  if (empty($varout)) { // Test command is ok. Work only on Linux OS.
103  print '<strong>'.$langs->trans("WebUserGroup")." (real, 'id' command)</strong> : ".implode(',', $arrayout)."<br>\n";
104  }
105 }
106 print '<br>';
107 
108 print "<strong>PHP session.use_strict_mode</strong> = ".(ini_get('session.use_strict_mode') ? img_picto('', 'tick').' ' : img_warning().' ').(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
109 print "<strong>PHP session.use_only_cookies</strong> = ".(ini_get('session.use_only_cookies') ? img_picto('', 'tick').' ' : img_warning().' ').(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
110 print "<strong>PHP session.cookie_httponly</strong> = ".(ini_get('session.cookie_httponly') ? img_picto('', 'tick').' ' : img_warning().' ').(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
111 print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie_samesite') ? img_picto('', 'tick').' ' .ini_get('session.cookie_samesite') : 'None');
112 if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') == 'Lax') {
113  print ' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'Lax').")</span>";
114 } elseif (ini_get('session.cookie_samesite') == 'Strict') {
115  print ' &nbsp; '.img_warning().' <span class="opacitymedium">'.$langs->trans("WarningPaypalPaymentNotCompatibleWithStrict")."</span>";
116 }
117 print "<br>\n";
118 print "<strong>PHP open_basedir</strong> = ".(ini_get('open_basedir') ? img_picto('', 'tick').' '.ini_get('open_basedir') : img_warning().' '.yn(0).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").': '.$_SERVER["DOCUMENT_ROOT"].','.DOL_DATA_ROOT).')</span>')."<br>\n";
119 print "<strong>PHP short_open_tag</strong> = ".((empty(ini_get('short_open_tag')) || ini_get('short_open_tag') == 'Off') ? img_picto('', 'tick').' '.yn(0) : img_warning().' '.yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).')</span>'."<br>\n";
120 print "<strong>PHP allow_url_fopen</strong> = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")</span><br>\n";
121 print "<strong>PHP allow_url_include</strong> = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : img_picto('', 'tick').' '.yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")</span><br>\n";
122 //print "<strong>PHP safe_mode</strong> = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).' &nbsp; <span class="opacitymedium">'.$langs->trans("Deprecated")." (removed in PHP 5.4)</span><br>\n";
123 print "<strong>PHP disable_functions</strong> = ";
124 $arrayoffunctionsdisabled = explode(',', ini_get('disable_functions'));
125 $arrayoffunctionstodisable = explode(',', 'dl,apache_note,apache_setenv,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,show_source,virtual');
126 //$arrayoffunctionstodisable[] = 'stream_wrapper_restore';
127 //$arrayoffunctionstodisable[] = 'stream_wrapper_register';
128 if ($execmethod == 1) {
129  $arrayoffunctionstodisable2 = explode(',', 'passthru,shell_exec,system,proc_open,popen');
130  $functiontokeep = 'exec';
131 } else {
132  $arrayoffunctionstodisable2 = explode(',', 'exec,passthru,shell_exec,system,proc_open');
133  $functiontokeep = 'popen';
134 }
135 $i = 0;
136 foreach ($arrayoffunctionsdisabled as $functionkey) {
137  if ($i > 0) {
138  print ', ';
139  }
140  print '<span class="opacitymedium">'.$functionkey.'</span>';
141  $i++;
142 }
143 print "<br>\n";
144 $todisabletext = '';
145 $i = 0;
146 foreach ($arrayoffunctionstodisable as $functiontodisable) {
147  if (! in_array($functiontodisable, $arrayoffunctionsdisabled)) {
148  if ($i > 0) {
149  $todisabletext .= ', ';
150  }
151  $todisabletext .= img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' <span class="opacitymedium">'.$functiontodisable.'</span>';
152  $i++;
153  }
154 }
155 if ($todisabletext) {
156  print $langs->trans("YouShouldDisablePHPFunctions").': '.$todisabletext;
157  print '<br>';
158 }
159 $todisabletext = '';
160 $i = 0;
161 foreach ($arrayoffunctionstodisable2 as $functiontodisable) {
162  if (! in_array($functiontodisable, $arrayoffunctionsdisabled)) {
163  if ($i > 0) {
164  $todisabletext .= ', ';
165  }
166  $todisabletext .= img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' <span class="opacitymedium">'.$functiontodisable.'</span>';
167  $i++;
168  }
169 }
170 if ($todisabletext) {
171  print $langs->trans("IfCLINotRequiredYouShouldDisablePHPFunctions").': '.$todisabletext;
172  print '<br>';
173 }
174 
175 print $langs->trans("PHPFunctionsRequiredForCLI").': ';
176 if (in_array($functiontokeep, $arrayoffunctionsdisabled)) {
177  print img_picto($langs->trans("PHPFunctionsRequiredForCLI"), 'warning');
178 }
179 print '<span class="opacitymedium">'.$functiontokeep.'</span>';
180 print '<br>';
181 
182 
183 // XDebug
184 print '<strong>'.$langs->trans("XDebug").'</strong>: ';
185 $test = !function_exists('xdebug_is_enabled') && !extension_loaded('xdebug');
186 if ($test) {
187  print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
188 } else {
189  print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
190  print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
191 }
192 
193 print '</div>';
194 
195 print '<br>';
196 
197 
198 // OS Permissions
199 
200 print '<br>';
201 print load_fiche_titre($langs->trans("OSSetup").' - '.$langs->trans("PermissionsOnFiles"), '', 'folder');
202 
203 print '<div class="divsection wordbreak">';
204 
205 print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
206 $arrayoffilesinroot = dol_dir_list(DOL_DOCUMENT_ROOT, 'all', 1, '', array('\/custom'), 'name', SORT_ASC, 4, 1, '', 1);
207 $fileswithwritepermission = array();
208 foreach ($arrayoffilesinroot as $fileinroot) {
209  // Test if there is at least one write permission file. If yes, add the entry into array $fileswithwritepermission
210  if (isset($fileinroot['perm']) && ($fileinroot['perm'] & 0222)) {
211  $fileswithwritepermission[] = $fileinroot['relativename'];
212  }
213 }
214 if (empty($fileswithwritepermission)) {
215  print img_picto('', 'tick').' '.$langs->trans("NoWritableFilesFoundIntoRootDir");
216 } else {
217  print img_warning().' '.$langs->trans("SomeFilesOrDirInRootAreWritable");
218  print '<br>'.$langs->trans("Example").': ';
219  $i = 0;
220  foreach ($fileswithwritepermission as $filewithwritepermission) {
221  if ($i > 0) {
222  print ', ';
223  }
224  print '<span class="opacitymedium">'.$filewithwritepermission.'</span>';
225  if ($i > 20) {
226  print ' ...';
227  break;
228  }
229  $i++;
230  }
231 }
232 print '<br>';
233 print '<br>';
234 
235 print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $conffile is defined into filefunc.inc.php
236 $perms = fileperms($dolibarr_main_document_root.'/'.$conffile);
237 if ($perms) {
238  if (($perms & 0x0004) || ($perms & 0x0002)) {
239  print img_warning().' '.$langs->trans("ConfFileIsReadableOrWritableByAnyUsers");
240  // Web user group by default
241  $labeluser = dol_getwebuser('user');
242  $labelgroup = dol_getwebuser('group');
243  print ' '.$langs->trans("User").': '.$labeluser.':'.$labelgroup;
244  if (function_exists('posix_geteuid') && function_exists('posix_getpwuid')) {
245  $arrayofinfoofuser = posix_getpwuid(posix_geteuid());
246  print ' <span class="opacitymedium">(POSIX '.$arrayofinfoofuser['name'].':'.$arrayofinfoofuser['gecos'].':'.$arrayofinfoofuser['dir'].':'.$arrayofinfoofuser['shell'].')</span>';
247  }
248  } else {
249  print img_picto('', 'tick');
250  }
251 } else {
252  print img_warning().' '.$langs->trans("FailedToReadFile", $conffile);
253 }
254 print '<br>';
255 print '<br>';
256 
257 $installlock = DOL_DATA_ROOT.'/install.lock';
258 $upgradeunlock = DOL_DATA_ROOT.'/upgrade.unlock';
259 $installmoduleslock = DOL_DATA_ROOT.'/installmodules.lock';
260 
261 // Is install (upgrade) locked
262 print '<strong>'.$langs->trans("DolibarrSetup").'</strong>: ';
263 if (file_exists($installlock)) {
264  if (file_exists($upgradeunlock)) {
265  print img_picto('', 'tick').' '.$langs->trans("InstallLockedBy", $installlock);
266  } else {
267  print img_picto('', 'tick').' '.$langs->trans("InstallAndUpgradeLockedBy", $installlock);
268  }
269 } else {
270  print img_warning().' '.$langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT);
271 }
272 print '<br>';
273 
274 // Is upgrade unlocked
275 if (file_exists($installlock)) { // If install not locked, no need to show this.
276  if (file_exists($upgradeunlock)) {
277  print '<strong>'.$langs->trans("DolibarrUpgrade").'</strong>: ';
278  print img_warning().' '.$langs->trans("WarningUpgradeHasBeenUnlocked", $upgradeunlock);
279  print '<br>';
280  }
281 }
282 
283 // Is addon install locked ?
284 print '<strong>'.$langs->trans("DolibarrAddonInstall").'</strong>: ';
285 if (file_exists($installmoduleslock)) {
286  print img_picto('', 'tick').' '.$langs->trans("InstallAndUpgradeLockedBy", $installmoduleslock);
287 } else {
288  print $langs->trans("InstallOfAddonIsNotBlocked", DOL_DATA_ROOT);
289 }
290 
291 print '</div>';
292 
293 
294 
295 // File conf.php
296 
297 print '<br>';
298 print '<br>';
299 print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffile.')', '', 'folder');
300 
301 print '<div class="divsection wordbreak">';
302 print '<strong>$dolibarr_main_prod</strong>: '.($dolibarr_main_prod ? $dolibarr_main_prod : '0');
303 if (empty($dolibarr_main_prod)) {
304  print ' &nbsp; &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
305 }
306 print '<br>';
307 
308 print '<strong>$dolibarr_nocsrfcheck</strong>: '.(empty($dolibarr_nocsrfcheck) ? '0' : $dolibarr_nocsrfcheck);
309 if (!empty($dolibarr_nocsrfcheck)) {
310  print ' &nbsp; &nbsp;'.img_picto('', 'error').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
311 } else {
312  print ' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span>';
313 }
314 print '<br>';
315 
316 print '<strong>$dolibarr_main_restrict_ip</strong>: ';
317 if (empty($dolibarr_main_restrict_ip)) {
318  print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
319  //print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
320 } else {
321  print $dolibarr_main_restrict_ip;
322 }
323 print '<br>';
324 
325 print '<strong>$dolibarr_main_restrict_os_commands</strong>: ';
326 if (empty($dolibarr_main_restrict_os_commands)) {
327  print $langs->trans("None");
328 } else {
329  print $dolibarr_main_restrict_os_commands;
330 }
331 print ' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'mysqldump, mysql, pg_dump, pgrestore, mariadb, mariadb-dump, clamdscan').')</span>';
332 print '<br>';
333 
334 if (!getDolGlobalString('SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF')) {
335  print '<strong>$dolibarr_main_db_pass</strong>: ';
336  if (!empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
337  print img_picto('', 'warning').' '.$langs->trans("DatabasePasswordNotObfuscated").' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("SetOptionTo", $langs->transnoentitiesnoconv("MainDbPasswordFileConfEncrypted"), yn(1)).')</span>';
338  //print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
339  } else {
340  print img_picto('', 'tick').' '.$langs->trans("DatabasePasswordObfuscated");
341  }
342 
343  print '<br>';
344 }
345 
346 print '<strong>$dolibarr_main_stream_to_disable</strong>: ';
347 // $arrayofstreamtodisable is defined into filefunc.inc.php
348 if (empty($dolibarr_main_stream_to_disable)) {
349  print '<span class="opacitymedium">'.$langs->trans("Undefined").' = '.implode(', ', $arrayofstreamtodisable).'</span>';
350 } else {
351  print implode(', ', $dolibarr_main_stream_to_disable);
352 }
353 print '<span class="bold"> -> Current PHP streams allowed = </span>';
354 $arrayofstreams = stream_get_wrappers();
355 if (!empty($arrayofstreams)) {
356  sort($arrayofstreams);
357  print(implode(',', $arrayofstreams)).' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php').')</span>'."\n";
358 }
359 print '</div>';
360 
361 
362 /*
363 if (!empty($dolibarr_main_stream_do_not_disable)) {
364  print '<strong>$dolibarr_main_stream_do_not_disable</strong>: ';
365  if (empty($dolibarr_main_stream_do_not_disable)) {
366  print '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>';
367  } else {
368  print join(', ', $dolibarr_main_stream_do_not_disable);
369  }
370  print ' -> PHP stream allowed = ';
371  $arrayofstreams = stream_get_wrappers();
372  if (!empty($arrayofstreams)) {
373  sort($arrayofstreams);
374  print (join(',', $arrayofstreams)).' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'Undefined').')</span>'."\n";
375  }
376 
377  print '<br>';
378 }
379 */
380 
381 // Menu Home - Setup - Security
382 
383 print '<br>';
384 print '<br>';
385 
386 print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
387 
388 print '<div class="divsection wordbreak">';
389 
390 print '<strong>'.$langs->trans("UseCaptchaCode").'</strong>: ';
391 print !getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA') ? '' : img_picto('', 'tick').' ';
392 print yn(!getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA') ? 0 : 1);
393 print '<br>';
394 print '<br>';
395 
396 
397 $sessiontimeout = ini_get("session.gc_maxlifetime");
398 if (!getDolGlobalString('MAIN_SESSION_TIMEOUT')) {
399  $conf->global->MAIN_SESSION_TIMEOUT = $sessiontimeout;
400 }
401 print '<strong>'.$langs->trans("SessionTimeOut").'</strong>';
402 if (!ini_get("session.gc_probability")) {
403  print $form->textwithpicto('', $langs->trans("SessionsPurgedByExternalSystem", ini_get("session.gc_maxlifetime")));
404 } else {
405  print $form->textwithpicto('', $langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor"), ini_get("session.gc_maxlifetime")));
406 }
407 print ': '.getDolGlobalInt('MAIN_SESSION_TIMEOUT').' '.strtolower($langs->trans("Seconds"));
408 print '<br><br>';
409 
410 print '<strong>'.$langs->trans("MaxNumberOfImagesInGetPost").'</strong>: ';
411 print(getDolGlobalInt('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT') ? img_picto('', 'tick').' ' : '').getDolGlobalInt('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT').' '.strtolower($langs->trans("Images"));
412 print '<br><br>';
413 
414 print '<strong>'.$langs->trans("MaxNumberOfPostOnPublicPagesByIP").'</strong>: ';
415 print(getDolGlobalInt('MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS', 200) ? img_picto('', 'tick').' ' : '').getDolGlobalInt('MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS', 200).' '.strtolower($langs->trans("Posts"));
416 print '<br><br>';
417 
418 print '<strong>'.$langs->trans("MaxNumberOfAttachementOnForms").'</strong>: ';
419 print(getDolGlobalInt('MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS', 10) ? img_picto('', 'tick').' ' : '').getDolGlobalInt("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 10).' '.strtolower($langs->trans("Files"));
420 print '<br><br>';
421 
422 print '<strong>'.$langs->trans("DoNotStoreClearPassword").'</strong>: ';
423 print !getDolGlobalString('DATABASE_PWD_ENCRYPTED') ? '' : img_picto('', 'tick').' ';
424 print yn(!getDolGlobalString('DATABASE_PWD_ENCRYPTED') ? 0 : 1);
425 if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
426  print ' <span class="opacitymedium">('.$langs->trans("Recommended").' '.yn(1).')</span>';
427 }
428 print '<br>';
429 print '<br>';
430 
431 /* Already into section conf file */
432 /*
433 $usepassinconfencrypted = 0;
434 global $dolibarr_main_db_pass, $dolibarr_main_db_encrypted_pass;
435 if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) {
436  $usepassinconfencrypted = 1;
437 }
438 print '<strong>'.$langs->trans("MainDbPasswordFileConfEncrypted").'</strong>: ';
439 print $usepassinconfencrypted ? img_picto('', 'tick').' ' : img_warning().' ';
440 print yn($usepassinconfencrypted);
441 if (empty($usepassinconfencrypted)) {
442  print ' <span class="opacitymedium">('.$langs->trans("Recommended").' '.yn(1).')</span>';
443 }
444 print '<br>';
445 print '<br>';
446 */
447 
448 /* Password length
449 
450 // Stored into $tabconf[0] if module generator is "Perso" or specific to the module generator.
451 $tabConf = explode(";", getDolGlobalString('USER_PASSWORD_PATTERN'));
452 
453 print '<strong>'.$langs->trans("PasswordLength").'</strong>: ';
454 print empty($conf->global->DATABASE_PWD_ENCRYPTED) ? '' : img_picto('', 'tick').' ';
455 print yn(empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1);
456 if (empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
457  print ' <span class="opacitymedium">('.$langs->trans("Recommended").' '.yn(1).')</span>';
458 }
459 print '<br>';
460 print '<br>';
461 */
462 
463 print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
464 print !getDolGlobalString('MAIN_ANTIVIRUS_COMMAND') ? img_warning().' ' : img_picto('', 'tick').' ';
465 print yn(!getDolGlobalString('MAIN_ANTIVIRUS_COMMAND') ? 0 : 1);
466 if (!getDolGlobalString('MAIN_ANTIVIRUS_COMMAND')) {
467  print ' - <span class="opacitymedium">'.$langs->trans("Recommended").': '.$langs->trans("DefinedAPathForAntivirusCommandIntoSetup", $langs->transnoentitiesnoconv("Home")." - ".$langs->transnoentitiesnoconv("Setup")." - ".$langs->transnoentitiesnoconv("Security")).'</span>';
468 } else {
469  print ' &nbsp; - ' . getDolGlobalString('MAIN_ANTIVIRUS_COMMAND');
470  if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) {
471  print ' - <span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
472  }
473 }
474 print '<br>';
475 print '<br>';
476 
477 $umask = getDolGlobalString('MAIN_UMASK');
478 
479 print '<strong>'.$langs->trans("UMask").'</strong>: ';
480 if (! in_array($umask, array('600', '660', '0600', '0660'))) {
481  print img_warning().' ';
482 }
483 print $umask;
484 if (! in_array($umask, array('600', '660', '0600', '0660'))) {
485  print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0600 | 0660)</span>';
486 }
487 print '<br>';
488 print '<br>';
489 
490 
491 $securityevent = new Events($db);
492 $eventstolog = $securityevent->eventstolog;
493 
494 print '<strong>'.$langs->trans("AuditedSecurityEvents").'</strong>: ';
495 $out = '';
496 if (!empty($eventstolog) && is_array($eventstolog)) {
497  // Loop on each event type
498  $i = 0;
499  foreach ($eventstolog as $key => $arr) {
500  if ($arr['id']) {
501  $key = 'MAIN_LOGEVENTS_'.$arr['id'];
502  $value = getDolGlobalString($key);
503  if ($value) {
504  if ($i > 0) {
505  $out .= ', ';
506  }
507  $out .= '<span class="opacitymedium">'.$key.'</span>';
508  $i++;
509  }
510  }
511  }
512  print $out;
513 }
514 
515 if (empty($out)) {
516  print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Security").' - '.$langs->transnoentities("Audit")).'<br>';
517 } else {
518  $s = $langs->trans("SeeSetupPage", '{s1}'.$langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Security").' - '.$langs->transnoentities("Audit").'{s2}');
519  print ' - '.str_replace('{s2}', '</a>', str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/admin/events.php" target="_blank">', $s));
520 }
521 
522 print '</div>';
523 
524 print '<br>';
525 
526 
527 // Modules/Applications
528 
529 print '<br>';
530 print '<br>';
531 print load_fiche_titre($langs->trans("Modules"), '', 'folder');
532 
533 print '<div class="divsection wordbreak">';
534 
535 // Module log
536 print '<strong>'.$langs->trans("Syslog").'</strong>: ';
537 $test = isModEnabled('syslog');
538 if (!$test) {
539  print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
540 } else {
541  if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) {
542  print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog"));
543  } else {
544  print img_picto('', 'tick').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL'));
545  }
546  //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
547 }
548 print '<br>';
549 
550 print '<br>';
551 
552 // Module debugbar
553 print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
554 $test = isModEnabled('debugbar');
555 if (!$test) {
556  print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
557 } else {
558  print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar"));
559  //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
560 }
561 print '<br>';
562 
563 print '<br>';
564 
565 // Modules for Payments
566 $test = isModEnabled('stripe');
567 if ($test) {
568  print '<strong>'.$langs->trans("Stripe").'</strong>: ';
569  if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
570  print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe"));
571  } else {
572  print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe"));
573  }
574  print '<br>';
575 } else {
576  $test = isModEnabled('paypal');
577  if ($test) {
578  print '<strong>'.$langs->trans("Paypal").'</strong>: ';
579  if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
580  print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal"));
581  } else {
582  print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal"));
583  }
584  print '<br>';
585  }
586 }
587 
588 print '</div>';
589 
590 
591 // APIs
592 
593 print '<br>';
594 print '<br>';
595 print load_fiche_titre($langs->trans("API"), '', 'folder');
596 
597 print '<div class="divsection wordbreak">';
598 
599 if (!isModEnabled('api') && !isModEnabled('webservices')) {
600  print $langs->trans("APIsAreNotEnabled");
601 } else {
602  if (isModEnabled('webservices')) {
603  print img_picto('', 'warning').' '.$langs->trans('YouEnableDeprecatedWSAPIsUseRESTAPIsInstead')."<br>\n";
604  print '<br>';
605  }
606  if (isModEnabled('api')) {
607  print '<strong>API_ENDPOINT_RULES</strong> = '.getDolGlobalString('API_ENDPOINT_RULES', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Example").': login:0,users:0,setup:1,status:1,tickets:1,...)</span>')."<br>\n";
608  }
609 }
610 
611 print '</div>';
612 
613 
614 print '<br>';
615 print '<br>';
616 
617 
618 print load_fiche_titre($langs->trans("OtherSetup"), '', 'folder');
619 
620 print '<div class="divsection wordbreak">';
621 
622 print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_IMAGES', '0').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span><br>';
623 print '<br>';
624 
625 print '<strong>MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE</strong> = '.getDolGlobalString('MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 1)</span><br>';
626 print '<br>';
627 
628 //print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
629 print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>')." &nbsp; ";
630 if (!getDolGlobalString('MAIN_SECURITY_HASH_ALGO')) {
631  print '<span class="opacitymedium"> &nbsp; &nbsp; If unset: \'md5\'</span>';
632 }
633 if (getDolGlobalString('MAIN_SECURITY_HASH_ALGO') != 'password_hash') {
634  print '<br><strong>MAIN_SECURITY_SALT</strong> = '.getDolGlobalString('MAIN_SECURITY_SALT', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').'<br>';
635 } else {
636  print '<span class="opacitymedium">('.$langs->trans("Recommended").': password_hash)</span>';
637  print '<br>';
638 }
639 if (getDolGlobalString('MAIN_SECURITY_HASH_ALGO') != 'password_hash') {
640  print '<div class="info">The recommended value for MAIN_SECURITY_HASH_ALGO is now \'password_hash\' but setting it now will make ALL existing passwords of all users not valid, so update is not possible.<br>';
641  print 'If you really want to switch, you must:<br>';
642  print '- Go on home - setup - other and add constant MAIN_SECURITY_HASH_ALGO to value \'password_hash\'<br>';
643  print '- In same session, WITHOUT LOGGING OUT, go into your admin user record and set a new password<br>';
644  print '- You can now logout and login with this new password. You must now reset password of all other users.<br>';
645  print '</div><br>';
646 }
647 print '<br>';
648 
649 print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span> &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': List of static IPs of server separated with coma - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)</span>')."<br>";
650 print '<br>';
651 
652 print '<strong>MAIN_SECURITY_CSRF_WITH_TOKEN</strong> = '.getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 2)</span>'."<br>";
653 
654 print '</div>';
655 
656 
657 print '<br>';
658 print '<br>';
659 
660 
661 // Other - experimental
662 
663 print load_fiche_titre($langs->trans("OtherSetup").' ('.$langs->trans("Experimental").')', '', 'folder');
664 
665 print '<div class="divsection wordbreak">';
666 print '<strong>MAIN_EXEC_USE_POPEN</strong> = ';
667 if (!getDolGlobalString('MAIN_EXEC_USE_POPEN')) {
668  print '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>';
669 } else {
670  print $conf->global->MAIN_EXEC_USE_POPEN;
671 }
672 if ($execmethod == 1) {
673  print '<span class="opacitymedium"> &nbsp; &nbsp; "exec" PHP method will be used for shell commands';
674  print ' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
675  print '</span>';
676 }
677 if ($execmethod == 2) {
678  print '<span class="opacitymedium"> &nbsp; &nbsp; "popen" PHP method will be used for shell commands';
679  print ' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
680  print '</span>';
681 }
682 print '<br>';
683 print '<br>';
684 
685 print '<strong>MAIN_SECURITY_MAXFILESIZE_DOWNLOADED</strong> = '.getDolGlobalString('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 100000000)</span>')."<br>";
686 print '<br>';
687 
688 print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.(getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML') ? '1' : '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
689 print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)</span>";
690 $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;
691 $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1;
692 $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
693 $result=dol_htmlwithnojs('<img onerror<=alert(document.domain)> src=>0xbeefed');
694 if ($result == 'InvalidHTMLStringCantBeCleaned') {
695  print ' &nbsp; - &nbsp; '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !';
696 } else {
697  print ' &nbsp; - &nbsp; Test of compatibility with this option seems ok';
698 }
699 print '<br>';
700 
701 print '<br>';
702 
703 print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY</strong> = '.(getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY') ? '1' : '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
704 print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 1)</span> &nbsp; - &nbsp; Module "php-tidy" must be enabled (currently: '.((extension_loaded('tidy') && class_exists("tidy")) ? 'Enabled' : img_picto('', 'warning').' Not available').")";
705 if (extension_loaded('tidy') && class_exists("tidy")) {
706  $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;
707  $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
708  $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
709  $result=dol_htmlwithnojs('<img onerror<=alert(document.domain)> src=>0xbeefed');
710  if ($result == 'InvalidHTMLStringCantBeCleaned') {
711  print ' &nbsp; - &nbsp; '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !';
712  } else {
713  print ' &nbsp; - &nbsp; Test of compatibility with this option seems ok';
714  }
715 }
716 print '<br>';
717 
718 print '<br>';
719 
720 print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES') ? '1' : '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
721 print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)</span><br>";
722 print '<br>';
723 
724 // MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1, disallow url links except if on /medias
725 // MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 2, disallow all external urls link
726 print '<strong>MAIN_DISALLOW_URL_INTO_DESCRIPTIONS</strong> = '.getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1=only local links allowed or 2=no links at all)</span>')."<br>";
727 print '<br>';
728 
729 print '<strong>MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS</strong> = '.getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
730 print '<br>';
731 
732 // MAIN_ALLOW_LOCAL_LINKS_AS_EXTERNAL_LINKS
733 
734 print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.getDolGlobalString('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
735 print '<br>';
736 
737 print '<strong>MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED</strong> = '.getDolGlobalString('MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
738 print '<br>';
739 
740 $examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;";
741 print '<strong>MAIN_SECURITY_FORCECSPRO</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSPRO', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><br>';
742 print '<br>';
743 
744 $examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;";
745 print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><br>';
746 print '<br>';
747 
748 print '<strong>MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\" so browser doesn't send any referrer when going into another web site domain)</span><br>";
749 print '<br>';
750 
751 print '<strong>MAIN_SECURITY_FORCE_ACCESS_CONTROL_ALLOW_ORIGIN</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCE_ACCESS_CONTROL_ALLOW_ORIGIN', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").": 1)</span><br>";
752 print '<br>';
753 
754 // For websites
755 
756 print '<strong>WEBSITE_MAIN_SECURITY_FORCECSPRO</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSPRO', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
757 print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "';
758 $examplecsprule = "default-src 'self' 'unsafe-inline' matomo.".getDomainFromURL($_SERVER["SERVER_NAME"], 1)." *.transifex.net *.transifex.com *.cloudflare.com *.cloudflareinsights.com *.google-analytics.com *.googletagmanager.com *.google.com *.gstatic.com *.googleapis.com *.googleadservices.com *.ads-twitter.com *.doubleclick.net; frame-ancestors 'self'; object-src *.youtube.com; frame-src 'self' *.twitter.com *.facebook.com *.youtube.com; img-src * data:;";
759 print $examplecsprule;
760 print '")</span><br>';
761 print '<br>';
762 
763 print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
764 print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "';
765 $examplecsprule = "default-src 'self' 'unsafe-inline' matomo.".getDomainFromURL($_SERVER["SERVER_NAME"], 1)." *.transifex.net *.transifex.com *.cloudflare.com *.cloudflareinsights.com *.google-analytics.com *.googletagmanager.com *.google.com *.gstatic.com *.googleapis.com *.googleadservices.com *.ads-twitter.com *.doubleclick.net; frame-ancestors 'self'; object-src *.youtube.com; frame-src 'self' *.twitter.com *.facebook.com *.youtube.com; img-src * data:;";
766 print $examplecsprule;
767 print '")</span><br>';
768 print '<br>';
769 
770 print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' "strict-origin-when-cross-origin")</span><br>';
771 print '<br>';
772 
773 print '<strong>WEBSITE_MAIN_SECURITY_FORCESTS</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCESTS', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"max-age=31536000; includeSubDomains\")</span><br>";
774 print '<br>';
775 
776 print '<strong>WEBSITE_MAIN_SECURITY_FORCEPP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCEPP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"camera=(), microphone=(), geolocation=*\")</span><br>";
777 
778 print '</div>';
779 
780 
781 print '<br>';
782 
783 
784 print load_fiche_titre($langs->trans("LimitsAndMitigation"), '', 'folder');
785 
786 print '<div class="divsection wordbreak">';
787 
788 print '<span class="opacitymedium">';
789 print $langs->trans("RecommendMitigationOnURL").'<br>';
790 print '</span>';
791 
792 print '<br>';
793 $urlexamplebase = 'https://github.com/Dolibarr/dolibarr/blob/develop/dev/setup/fail2ban/filter.d/';
794 print '<span class="fas fa-shield-alt"></span> Login or API authentication (see <a target="_blank" rel="noopener" href="'.$urlexamplebase.'web-dolibarr-rulesbruteforce.conf">fail2ban example on GitHub</a>)<br>';
795 print '<span class="fas fa-shield-alt"></span> '.DOL_URL_ROOT.'/passwordforgotten.php (see <a target="_blank" rel="noopener" href="'.$urlexamplebase.'web-dolibarr-rulespassforgotten.conf">fail2ban example on GitHub</a>)<br>';
796 print '<span class="fas fa-shield-alt"></span> '.DOL_URL_ROOT.'/public/* (see <a target="_blank" rel="noopener" href="'.$urlexamplebase.'web-dolibarr-limitpublic.conf">fail2ban example on GitHub</a>)<br>';
797 print '<br>';
798 $urlexamplebase = 'https://github.com/Dolibarr/dolibarr/blob/develop/dev/setup/apache/';
799 print '<span class="fas fa-shield-alt"></span> You can also protect the application using a HTTP Basic authentication layer (see <a target="_blank" rel="noopener" href="'.$urlexamplebase.'virtualhost">apache2 virtualhost example on GitHub</a>)<br>';
800 
801 print '</div>';
802 
803 // End of page
804 llxFooter();
805 $db->close();
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:55
llxFooter()
Empty footer.
Definition: wrapper.php:69
Events class.
Class to manage generation of HTML components Only common components must be here.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:63
version_php()
Return PHP version.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox=0, $check='restricthtml')
Sanitize a HTML to remove js, dangerous content and external link.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_getwebuser($mode)
Return user/group account of web server.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.