dolibarr 21.0.0-alpha
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
24require '../../main.inc.php';
25require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
26require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
31require_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
36if (!$user->admin) {
38}
39
40if (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
53llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-admin page-system_security');
54
55print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
56
57print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span>';
58print ' &nbsp; &nbsp; ';
59print '<a href="'.$_SERVER["PHP_SELF"].'">';
60print img_picto($langs->trans("Reload"), 'refresh').' ';
61print $langs->trans("Reload");
62print '</a>';
63print '<br>';
64print '<br>';
65
66
67print '<br>';
68
69
70print load_fiche_titre($langs->trans("PHPSetup"), '', 'folder');
71
72
73print '<div class="divsection wordbreak">';
74
75// Get version of PHP
76$phpversion = version_php();
77print "<strong>PHP</strong>: ".$langs->trans("Version").": ".$phpversion;
78if (function_exists('php_ini_loaded_file')) {
79 $inipath = php_ini_loaded_file();
80 print " - <strong>INI</strong>: ".$inipath;
81}
82print "<br>\n";
83
84// Get version of web server
85print "<br><strong>Web server - ".$langs->trans("Version")."</strong>: ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
86print '<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');
90if ($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)
98if (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}
106print '<br>';
107
108print "<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";
109print "<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";
110print "<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";
111print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie_samesite') ? img_picto('', 'tick').' ' .ini_get('session.cookie_samesite') : 'None');
112if (!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}
117print "<br>\n";
118
119print "<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";
120
121print "<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(1)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).')</span>'."<br>\n";
122
123print "<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"))." but may be required by some external modules)</span><br>\n";
124
125print "<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";
126//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";
127
128print "<strong>PHP disable_functions</strong> = ";
129$arrayoffunctionsdisabled = explode(',', ini_get('disable_functions'));
130$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');
131//$arrayoffunctionstodisable[] = 'stream_wrapper_restore';
132//$arrayoffunctionstodisable[] = 'stream_wrapper_register';
133if ($execmethod == 1) {
134 $arrayoffunctionstodisable2 = explode(',', 'passthru,shell_exec,system,proc_open,popen');
135 $functiontokeep = 'exec';
136} else {
137 $arrayoffunctionstodisable2 = explode(',', 'exec,passthru,shell_exec,system,proc_open');
138 $functiontokeep = 'popen';
139}
140$i = 0;
141foreach ($arrayoffunctionsdisabled as $functionkey) {
142 if ($i > 0) {
143 print ', ';
144 }
145 print '<span class="opacitymedium">'.$functionkey.'</span>';
146 $i++;
147}
148print "<br>\n";
149$todisabletext = '';
150$i = 0;
151foreach ($arrayoffunctionstodisable as $functiontodisable) {
152 if (! in_array($functiontodisable, $arrayoffunctionsdisabled)) {
153 if ($i > 0) {
154 $todisabletext .= ', ';
155 }
156 $todisabletext .= ' <span class="opacitymedium">'.$functiontodisable.'</span>';
157 $i++;
158 }
159}
160if ($todisabletext) {
161 print img_picto('', 'warning', 'class="pictofixedwidth"').$langs->trans("YouShouldDisablePHPFunctions").': '.$todisabletext;
162 print '<br>';
163}
164$todisabletext = '';
165$i = 0;
166foreach ($arrayoffunctionstodisable2 as $functiontodisable) {
167 if (! in_array($functiontodisable, $arrayoffunctionsdisabled)) {
168 if ($i > 0) {
169 $todisabletext .= ', ';
170 }
171 $todisabletext .= ' <span class="opacitymedium">'.$functiontodisable.'</span>';
172 $i++;
173 }
174}
175if ($todisabletext) {
176 print img_picto('', 'warning', 'class="pictofixedwidth"').$langs->trans("IfCLINotRequiredYouShouldDisablePHPFunctions").': '.$todisabletext;
177 print '<br>';
178}
179
180if (in_array($functiontokeep, $arrayoffunctionsdisabled)) {
181 print img_picto($langs->trans("PHPFunctionsRequiredForCLI"), 'warning', 'class="pictofixedwidth"');
182} else {
183 print img_picto('', 'tick', 'class="pictofixedwidth"');
184}
185print $langs->trans("PHPFunctionsRequiredForCLI").': ';
186print '<span class="opacitymedium">'.$functiontokeep.'</span>';
187print '<br>';
188
189print '<br>';
190
191// JSON
192print '<strong>JSON</strong>: ';
193$loadedExtensions = array_map('strtolower', get_loaded_extensions(false));
194$test = !in_array('json', $loadedExtensions);
195if ($test || function_exists('dol_json_decode')) {
196 print img_picto('', 'error').' '.$langs->trans("NotInstalled").' - '.$langs->trans("VulnerableToRCEAttack");
197} else {
198 print img_picto('', 'tick').' '.$langs->trans("Available").' <span class="opacitymedium">(PHP native so not emulated, safe)</span>';
199}
200print '<br>';
201
202// XDebug
203print '<strong>XDebug</strong>: ';
204$test = !function_exists('xdebug_is_enabled') && !extension_loaded('xdebug');
205if ($test) {
206 print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
207} else {
208 print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
209 print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
210}
211
212print '</div>';
213
214print '<br>';
215
216
217// OS Permissions
218
219print '<br>';
220print load_fiche_titre($langs->trans("OSSetup").' - '.$langs->trans("PermissionsOnFiles"), '', 'folder');
221
222print '<div class="divsection wordbreak">';
223
224print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
225$arrayoffilesinroot = dol_dir_list(DOL_DOCUMENT_ROOT, 'all', 1, '', array('\/custom'), 'name', SORT_ASC, 4, 1, '', 1);
226$fileswithwritepermission = array();
227foreach ($arrayoffilesinroot as $fileinroot) {
228 // Test if there is at least one write permission file. If yes, add the entry into array $fileswithwritepermission
229 if (isset($fileinroot['perm']) && ($fileinroot['perm'] & 0222)) {
230 $fileswithwritepermission[] = $fileinroot['relativename'];
231 }
232}
233if (empty($fileswithwritepermission)) {
234 print img_picto('', 'tick').' '.$langs->trans("NoWritableFilesFoundIntoRootDir");
235} else {
236 print img_warning().' '.$langs->trans("SomeFilesOrDirInRootAreWritable");
237 print '<br>'.$langs->trans("Example").': ';
238 $i = 0;
239 foreach ($fileswithwritepermission as $filewithwritepermission) {
240 if ($i > 0) {
241 print ', ';
242 }
243 print '<span class="opacitymedium">'.$filewithwritepermission.'</span>';
244 if ($i > 20) {
245 print ' ...';
246 break;
247 }
248 $i++;
249 }
250}
251print '<br>';
252print '<br>';
253
254print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $conffile is defined into filefunc.inc.php
255$perms = fileperms($dolibarr_main_document_root.'/'.$conffile);
256if ($perms) {
257 if (($perms & 0x0004) || ($perms & 0x0002)) {
258 print img_warning().' '.$langs->trans("ConfFileIsReadableOrWritableByAnyUsers");
259 // Web user group by default
260 $labeluser = dol_getwebuser('user');
261 $labelgroup = dol_getwebuser('group');
262 print ' '.$langs->trans("User").': '.$labeluser.':'.$labelgroup;
263 if (function_exists('posix_geteuid') && function_exists('posix_getpwuid')) {
264 $arrayofinfoofuser = posix_getpwuid(posix_geteuid());
265 print ' <span class="opacitymedium">(POSIX '.$arrayofinfoofuser['name'].':'.$arrayofinfoofuser['gecos'].':'.$arrayofinfoofuser['dir'].':'.$arrayofinfoofuser['shell'].')</span>';
266 }
267 } else {
268 print img_picto('', 'tick');
269 }
270} else {
271 print img_warning().' '.$langs->trans("FailedToReadFile", $conffile);
272}
273print '<br>';
274print '<br>';
275
276$installlock = DOL_DATA_ROOT.'/install.lock';
277$upgradeunlock = DOL_DATA_ROOT.'/upgrade.unlock';
278$installmoduleslock = DOL_DATA_ROOT.'/installmodules.lock';
279
280// Is install (upgrade) locked
281print '<strong>'.$langs->trans("DolibarrSetup").'</strong>: ';
282if (file_exists($installlock)) {
283 if (file_exists($upgradeunlock)) {
284 print img_picto('', 'tick').' '.$langs->trans("InstallLockedBy", $installlock);
285 } else {
286 print img_picto('', 'tick').' '.$langs->trans("InstallAndUpgradeLockedBy", $installlock);
287 }
288} else {
289 print img_warning().' '.$langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT);
290}
291print '<br>';
292
293// Is upgrade unlocked
294if (file_exists($installlock)) { // If install not locked, no need to show this.
295 if (file_exists($upgradeunlock)) {
296 print '<strong>'.$langs->trans("DolibarrUpgrade").'</strong>: ';
297 print img_warning().' '.$langs->trans("WarningUpgradeHasBeenUnlocked", $upgradeunlock);
298 print '<br>';
299 }
300}
301
302// Is addon install locked ?
303print '<strong>'.$langs->trans("DolibarrAddonInstall").'</strong>: ';
304if (file_exists($installmoduleslock)) {
305 print img_picto('', 'tick').' '.$langs->trans("InstallAndUpgradeLockedBy", $installmoduleslock);
306} else {
307 print $langs->trans("InstallOfAddonIsNotBlocked", DOL_DATA_ROOT);
308}
309
310print '</div>';
311
312
313
314// File conf.php
315
316print '<br>';
317print '<br>';
318print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffile.')', '', 'folder');
319
320print '<div class="divsection wordbreak">';
321print '<strong>$dolibarr_main_prod</strong>: '.($dolibarr_main_prod ? $dolibarr_main_prod : '0');
322if (empty($dolibarr_main_prod)) {
323 print ' &nbsp; &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
324}
325print '<br>';
326
327print '<strong>$dolibarr_nocsrfcheck</strong>: '.(empty($dolibarr_nocsrfcheck) ? '0' : $dolibarr_nocsrfcheck);
328if (!empty($dolibarr_nocsrfcheck)) {
329 print ' &nbsp; &nbsp;'.img_picto('', 'error').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
330} else {
331 print ' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span>';
332}
333print '<br>';
334
335print '<strong>$dolibarr_main_restrict_ip</strong>: ';
336if (empty($dolibarr_main_restrict_ip)) {
337 print $langs->trans("None");
338 print ' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("StaticIPsOfUsers")).')</span>';
339} else {
340 print $dolibarr_main_restrict_ip;
341}
342print '<br>';
343
344print '<strong>$dolibarr_main_restrict_os_commands</strong>: ';
345if (empty($dolibarr_main_restrict_os_commands)) {
346 print $langs->trans("None");
347} else {
348 print $dolibarr_main_restrict_os_commands;
349}
350print ' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'mysqldump, mysql, pg_dump, pg_restore, mariadb, mariadb-dump, clamdscan').')</span>';
351print '<br>';
352
353if (!getDolGlobalString('SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF')) {
354 print '<strong>$dolibarr_main_db_pass</strong>: ';
355 if (!empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
356 print img_picto('', 'warning').' '.$langs->trans("DatabasePasswordNotObfuscated").' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("SetOptionTo", $langs->transnoentitiesnoconv("MainDbPasswordFileConfEncrypted"), yn(1)).')</span>';
357 //print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
358 } else {
359 print img_picto('', 'tick').' '.$langs->trans("DatabasePasswordObfuscated");
360 }
361
362 print '<br>';
363}
364
365print '<strong>$dolibarr_main_stream_to_disable</strong>: ';
366// $arrayofstreamtodisable is defined into filefunc.inc.php
367if (empty($dolibarr_main_stream_to_disable)) {
368 print '<span class="opacitymedium">'.$langs->trans("Undefined").' = '.implode(', ', $arrayofstreamtodisable).'</span>';
369} else {
370 print implode(', ', $dolibarr_main_stream_to_disable);
371}
372print '<span class="bold"> -> Current PHP streams allowed = </span>';
373$arrayofstreams = stream_get_wrappers();
374if (!empty($arrayofstreams)) {
375 sort($arrayofstreams);
376 print(implode(',', $arrayofstreams)).' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php,zip').')</span>'."\n";
377}
378print '</div>';
379
380
381/*
382if (!empty($dolibarr_main_stream_do_not_disable)) {
383 print '<strong>$dolibarr_main_stream_do_not_disable</strong>: ';
384 if (empty($dolibarr_main_stream_do_not_disable)) {
385 print '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>';
386 } else {
387 print join(', ', $dolibarr_main_stream_do_not_disable);
388 }
389 print ' -> PHP stream allowed = ';
390 $arrayofstreams = stream_get_wrappers();
391 if (!empty($arrayofstreams)) {
392 sort($arrayofstreams);
393 print (join(',', $arrayofstreams)).' &nbsp; &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'Undefined').')</span>'."\n";
394 }
395
396 print '<br>';
397}
398*/
399
400// Menu Home - Setup - Security
401
402print '<br>';
403print '<br>';
404
405print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
406
407print '<div class="divsection wordbreak">';
408
409print '<strong>'.$langs->trans("UseCaptchaCode").'</strong>: ';
410print !getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA') ? '' : img_picto('', 'tick').' ';
411print yn(!getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA') ? 0 : 1);
412print '<br>';
413print '<br>';
414
415
416$sessiontimeout = ini_get("session.gc_maxlifetime");
417if (!getDolGlobalString('MAIN_SESSION_TIMEOUT')) {
418 $conf->global->MAIN_SESSION_TIMEOUT = $sessiontimeout;
419}
420print '<strong>'.$langs->trans("SessionTimeOut").'</strong>';
421if (!ini_get("session.gc_probability")) {
422 print $form->textwithpicto('', $langs->trans("SessionsPurgedByExternalSystem", ini_get("session.gc_maxlifetime")));
423} else {
424 print $form->textwithpicto('', $langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor"), ini_get("session.gc_maxlifetime")));
425}
426print ': '.getDolGlobalInt('MAIN_SESSION_TIMEOUT').' '.strtolower($langs->trans("Seconds"));
427print '<br><br>';
428
429print '<strong>'.$langs->trans("MaxNumberOfImagesInGetPost").'</strong>: ';
430print(getDolGlobalInt('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT') ? img_picto('', 'tick').' ' : '').getDolGlobalInt('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT').' '.strtolower($langs->trans("Images"));
431print '<br><br>';
432
433print '<strong>'.$langs->trans("MaxNumberOfPostOnPublicPagesByIP").'</strong>: ';
434print(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"));
435print '<br><br>';
436
437print '<strong>'.$langs->trans("MaxNumberOfAttachementOnForms").'</strong>: ';
438print(getDolGlobalInt('MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS', 10) ? img_picto('', 'tick').' ' : '').getDolGlobalInt("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 10).' '.strtolower($langs->trans("Files"));
439print '<br><br>';
440
441print '<strong>'.$langs->trans("DoNotStoreClearPassword").'</strong>: ';
442print !getDolGlobalString('DATABASE_PWD_ENCRYPTED') ? '' : img_picto('', 'tick').' ';
443print yn(!getDolGlobalString('DATABASE_PWD_ENCRYPTED') ? 0 : 1);
444if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
445 print ' <span class="opacitymedium">('.$langs->trans("Recommended").' '.yn(1).')</span>';
446}
447print '<br>';
448print '<br>';
449
450/* Already into section conf file */
451/*
452$usepassinconfencrypted = 0;
453global $dolibarr_main_db_pass, $dolibarr_main_db_encrypted_pass;
454if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) {
455 $usepassinconfencrypted = 1;
456}
457print '<strong>'.$langs->trans("MainDbPasswordFileConfEncrypted").'</strong>: ';
458print $usepassinconfencrypted ? img_picto('', 'tick').' ' : img_warning().' ';
459print yn($usepassinconfencrypted);
460if (empty($usepassinconfencrypted)) {
461 print ' <span class="opacitymedium">('.$langs->trans("Recommended").' '.yn(1).')</span>';
462}
463print '<br>';
464print '<br>';
465*/
466
467/* Password length
468
469// Stored into $tabconf[0] if module generator is "Perso" or specific to the module generator.
470$tabConf = explode(";", getDolGlobalString('USER_PASSWORD_PATTERN'));
471
472print '<strong>'.$langs->trans("PasswordLength").'</strong>: ';
473print empty($conf->global->DATABASE_PWD_ENCRYPTED) ? '' : img_picto('', 'tick').' ';
474print yn(empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1);
475if (empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
476 print ' <span class="opacitymedium">('.$langs->trans("Recommended").' '.yn(1).')</span>';
477}
478print '<br>';
479print '<br>';
480*/
481
482print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
483print !getDolGlobalString('MAIN_ANTIVIRUS_COMMAND') ? img_warning().' ' : img_picto('', 'tick').' ';
484print yn(!getDolGlobalString('MAIN_ANTIVIRUS_COMMAND') ? 0 : 1);
485if (!getDolGlobalString('MAIN_ANTIVIRUS_COMMAND')) {
486 print ' - <span class="opacitymedium">'.$langs->trans("Recommended").': '.$langs->trans("DefinedAPathForAntivirusCommandIntoSetup", $langs->transnoentitiesnoconv("Home")." - ".$langs->transnoentitiesnoconv("Setup")." - ".$langs->transnoentitiesnoconv("Security")).'</span>';
487} else {
488 print ' &nbsp; - ' . getDolGlobalString('MAIN_ANTIVIRUS_COMMAND');
489 if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) {
490 print ' - <span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
491 }
492}
493print '<br>';
494print '<br>';
495
496$umask = getDolGlobalString('MAIN_UMASK');
497
498print '<strong>'.$langs->trans("UMask").'</strong>: ';
499if (! in_array($umask, array('600', '660', '0600', '0660'))) {
500 print img_warning().' ';
501}
502print $umask;
503if (! in_array($umask, array('600', '660', '0600', '0660'))) {
504 print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0600 | 0660)</span>';
505}
506print '<br>';
507print '<br>';
508
509
510$securityevent = new Events($db);
511$eventstolog = $securityevent->eventstolog;
512
513print '<strong>'.$langs->trans("AuditedSecurityEvents").'</strong>: ';
514$out = '';
515if (!empty($eventstolog) && is_array($eventstolog)) {
516 // Loop on each event type
517 $i = 0;
518 foreach ($eventstolog as $key => $arr) {
519 if ($arr['id']) {
520 $key = 'MAIN_LOGEVENTS_'.$arr['id'];
521 $value = getDolGlobalString($key);
522 if ($value) {
523 if ($i > 0) {
524 $out .= ', ';
525 }
526 $out .= '<span class="opacitymedium">'.$key.'</span>';
527 $i++;
528 }
529 }
530 }
531 print $out;
532}
533
534if (empty($out)) {
535 print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Security").' - '.$langs->transnoentities("Audit")).'<br>';
536} else {
537 $s = $langs->trans("SeeSetupPage", '{s1}'.$langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Security").' - '.$langs->transnoentities("Audit").'{s2}');
538 print ' - '.str_replace('{s2}', '</a>', str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/admin/events.php" target="_blank">', $s));
539}
540
541print '</div>';
542
543print '<br>';
544
545
546// Modules/Applications
547
548print '<br>';
549print '<br>';
550print load_fiche_titre($langs->trans("Modules"), '', 'folder');
551
552print '<div class="divsection wordbreak">';
553
554// Module log
555print '<strong>'.$langs->trans("Syslog").'</strong>: ';
556$test = isModEnabled('syslog');
557if (!$test) {
558 print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
559} else {
560 if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) {
561 print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog"));
562 } else {
563 print img_picto('', 'tick').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL'));
564 }
565 //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
566}
567print '<br>';
568
569print '<br>';
570
571// Module debugbar
572print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
573$test = isModEnabled('debugbar');
574if (!$test) {
575 print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
576} else {
577 print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar"));
578 //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
579}
580print '<br>';
581
582print '<br>';
583
584// Modules for Payments
585$test = isModEnabled('stripe');
586if ($test) {
587 print '<strong>'.$langs->trans("Stripe").'</strong>: ';
588 if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
589 print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe"));
590 } else {
591 print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe"));
592 }
593 print '<br>';
594} else {
595 $test = isModEnabled('paypal');
596 if ($test) {
597 print '<strong>'.$langs->trans("Paypal").'</strong>: ';
598 if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
599 print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal"));
600 } else {
601 print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal"));
602 }
603 print '<br>';
604 }
605}
606
607print '</div>';
608
609
610// APIs
611
612print '<br>';
613print '<br>';
614print load_fiche_titre($langs->trans("API"), '', 'folder');
615
616print '<div class="divsection wordbreak">';
617
618if (!isModEnabled('api') && !isModEnabled('webservices')) {
619 print $langs->trans("APIsAreNotEnabled");
620} else {
621 if (isModEnabled('webservices')) {
622 print img_picto('', 'warning').' '.$langs->trans('YouEnableDeprecatedWSAPIsUseRESTAPIsInstead')."<br>\n";
623 print '<br>';
624 }
625 if (isModEnabled('api')) {
626 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";
627 }
628}
629
630print '</div>';
631
632
633print '<br>';
634print '<br>';
635
636
637print load_fiche_titre($langs->trans("OtherSetup"), '', 'folder');
638
639print '<div class="divsection wordbreak">';
640
641print '<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>';
642print '<br>';
643
644print '<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>';
645print '<br>';
646
647//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
648print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>')." &nbsp; ";
649if (!getDolGlobalString('MAIN_SECURITY_HASH_ALGO')) {
650 print '<span class="opacitymedium"> &nbsp; &nbsp; (If unset: \'md5\')</span>';
651}
652if (getDolGlobalString('MAIN_SECURITY_HASH_ALGO') != 'password_hash') {
653 print '<br><strong>MAIN_SECURITY_SALT</strong> = '.getDolGlobalString('MAIN_SECURITY_SALT', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').'<br>';
654} else {
655 print '<span class="opacitymedium">('.$langs->trans("Recommended").': password_hash)</span>';
656 print '<br>';
657}
658if (getDolGlobalString('MAIN_SECURITY_HASH_ALGO') != 'password_hash') {
659 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>';
660 print 'If you really want to switch, you must:<br>';
661 print '- Go on home - setup - other and add constant MAIN_SECURITY_HASH_ALGO to value \'password_hash\'<br>';
662 print '- In same session, WITHOUT LOGGING OUT, go into your admin user record and set a new password<br>';
663 print '- You can now logout and login with this new password. You must now reset password of all other users.<br>';
664 print '</div>';
665}
666print '<br>';
667
668print '<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>";
669print '<br>';
670
671print '<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>";
672
673print '</div>';
674
675
676print '<br>';
677print '<br>';
678
679
680// Other - experimental
681
682print load_fiche_titre($langs->trans("OtherSetup").' ('.$langs->trans("Experimental").')', '', 'folder');
683
684print '<div class="divsection wordbreak">';
685print '<strong>MAIN_EXEC_USE_POPEN</strong> = ';
686if (!getDolGlobalString('MAIN_EXEC_USE_POPEN')) {
687 print '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>';
688} else {
689 print $conf->global->MAIN_EXEC_USE_POPEN;
690}
691if ($execmethod == 1) {
692 print '<span class="opacitymedium"> &nbsp; &nbsp; "exec" PHP method will be used for shell commands';
693 print ' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
694 print '</span>';
695}
696if ($execmethod == 2) {
697 print '<span class="opacitymedium"> &nbsp; &nbsp; "popen" PHP method will be used for shell commands';
698 print ' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
699 print '</span>';
700}
701print '<br>';
702print '<br>';
703
704print '<strong>MAIN_SECURITY_MAXFILESIZE_DOWNLOADED</strong> = '.getDolGlobalString('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 100000000)</span>')."<br>";
705print '<br>';
706
707print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.(getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML') ? '1' : '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
708print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)</span>";
709$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;
710$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1;
711$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
712$result=dol_htmlwithnojs('<img onerror<=alert(document.domain)> src=>0xbeefed');
713if ($result == 'InvalidHTMLStringCantBeCleaned') {
714 print ' &nbsp; - &nbsp; '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !';
715} else {
716 print ' &nbsp; - &nbsp; Test of compatibility with this option seems ok';
717}
718print '<br>';
719
720print '<br>';
721
722print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY</strong> = '.(getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY') ? '1' : '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
723print ' &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').")";
724if (extension_loaded('tidy') && class_exists("tidy")) {
725 $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;
726 $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
727 $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
728 $result=dol_htmlwithnojs('<img onerror<=alert(document.domain)> src=>0xbeefed');
729 if ($result == 'InvalidHTMLStringCantBeCleaned') {
730 print ' &nbsp; - &nbsp; '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !';
731 } else {
732 print ' &nbsp; - &nbsp; Test of compatibility with this option seems ok';
733 }
734}
735print '<br>';
736
737print '<br>';
738
739print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES') ? '1' : '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
740print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)</span><br>";
741print '<br>';
742
743// MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1, disallow url links except if on /medias
744// MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 2, disallow all external urls link
745print '<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>";
746print '<br>';
747
748print '<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>";
749print '<br>';
750
751// MAIN_ALLOW_LOCAL_LINKS_AS_EXTERNAL_LINKS
752
753print '<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>";
754print '<br>';
755
756print '<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>";
757print '<br>';
758
759$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;";
760print '<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>';
761print '<br>';
762
763$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;";
764print '<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>';
765print '<br>';
766
767print '<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>";
768print '<br>';
769
770print '<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>";
771print '<br>';
772
773// For websites
774
775print '<strong>WEBSITE_MAIN_SECURITY_FORCECSPRO</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSPRO', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
776print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "';
777$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:;";
778print $examplecsprule;
779print '")</span><br>';
780print '<br>';
781
782print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
783print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "';
784$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:;";
785print $examplecsprule;
786print '")</span><br>';
787print '<br>';
788
789print '<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").'="strict-origin-when-cross-origin" '.$langs->trans("or").' "same-origin"=more secured)</span><br>';
790print '<br>';
791
792print '<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>";
793print '<br>';
794
795print '<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>";
796
797print '</div>';
798
799
800print '<br>';
801
802
803print load_fiche_titre($langs->trans("LimitsAndMitigation"), '', 'folder');
804
805print '<div class="divsection wordbreak">';
806
807print '<span class="opacitymedium">';
808print $langs->trans("RecommendMitigationOnURL").'<br>';
809print '</span>';
810
811print '<br>';
812$urlexamplebase = 'https://github.com/Dolibarr/dolibarr/blob/develop/dev/setup/fail2ban/filter.d/';
813print '<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>';
814print '<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>';
815print '<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>';
816print '<br>';
817$urlexamplebase = 'https://github.com/Dolibarr/dolibarr/blob/develop/dev/setup/apache/';
818print '<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>';
819
820print '</div>';
821
822// End of page
823llxFooter();
824$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Events class.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
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.
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.