security.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <?php
  2. /* Copyright (C) 2013-2019 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. /**
  18. * \file htdocs/admin/system/security.php
  19. * \brief Page to show Security information
  20. */
  21. require '../../main.inc.php';
  22. require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
  23. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
  29. // Load translation files required by the page
  30. $langs->loadLangs(array("install", "other", "admin", "errors"));
  31. if (!$user->admin) {
  32. accessforbidden();
  33. }
  34. if (GETPOST('action', 'aZ09') == 'donothing') {
  35. exit;
  36. }
  37. $execmethod = empty($conf->global->MAIN_EXEC_USE_POPEN) ? 1 : $conf->global->MAIN_EXEC_USE_POPEN;
  38. /*
  39. * View
  40. */
  41. llxHeader();
  42. print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
  43. print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
  44. print '<br>';
  45. print load_fiche_titre($langs->trans("PHPSetup"), '', 'folder');
  46. // Get version of PHP
  47. $phpversion = version_php();
  48. print "<strong>PHP</strong>: ".$langs->trans("Version").": ".$phpversion;
  49. if (function_exists('php_ini_loaded_file')) {
  50. $inipath = php_ini_loaded_file();
  51. print " - <strong>INI</strong>: ".$inipath;
  52. }
  53. print "<br>\n";
  54. // Get version of web server
  55. print "<br><strong>Web server - ".$langs->trans("Version")."</strong>: ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
  56. print '<strong>'.$langs->trans("DataRootServer")."</strong>: ".DOL_DATA_ROOT."<br>\n";
  57. // Web user group by default
  58. $labeluser = dol_getwebuser('user');
  59. $labelgroup = dol_getwebuser('group');
  60. if ($labeluser && $labelgroup) {
  61. print '<strong>'.$langs->trans("WebUserGroup")." (env vars)</strong> : ".$labeluser.':'.$labelgroup;
  62. if (function_exists('posix_geteuid') && function_exists('posix_getpwuid')) {
  63. $arrayofinfoofuser = posix_getpwuid(posix_geteuid());
  64. print ' <span class="opacitymedium">(POSIX '.$arrayofinfoofuser['name'].':'.$arrayofinfoofuser['gecos'].':'.$arrayofinfoofuser['dir'].':'.$arrayofinfoofuser['shell'].')</span><br>'."\n";
  65. }
  66. }
  67. // Web user group real (detected by 'id' external command)
  68. if (function_exists('exec')) {
  69. $arrayout = array(); $varout = 0;
  70. exec('id', $arrayout, $varout);
  71. if (empty($varout)) { // Test command is ok. Work only on Linux OS.
  72. print '<strong>'.$langs->trans("WebUserGroup")." (real, 'id' command)</strong> : ".join(',', $arrayout)."<br>\n";
  73. }
  74. }
  75. print '<br>';
  76. print "<strong>PHP session.use_strict_mode</strong> = ".(ini_get('session.use_strict_mode') ? '' : 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";
  77. print "<strong>PHP session.use_only_cookies</strong> = ".(ini_get('session.use_only_cookies') ? '' : 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";
  78. print "<strong>PHP session.cookie_httponly</strong> = ".(ini_get('session.cookie_httponly') ? '' : img_warning().' ').(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
  79. print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie_samesite') ? ini_get('session.cookie_samesite') : 'None');
  80. if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') == 'Lax') {
  81. print ' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'Lax').")</span>";
  82. } elseif (ini_get('session.cookie_samesite') == 'Strict') {
  83. print ' &nbsp; '.img_warning().' <span class="opacitymedium">'.$langs->trans("WarningPaypalPaymentNotCompatibleWithStrict")."</span>";
  84. }
  85. print "<br>\n";
  86. print "<strong>PHP open_basedir</strong> = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").': '.$_SERVER["DOCUMENT_ROOT"].','.DOL_DATA_ROOT).')</span>')."<br>\n";
  87. print "<strong>PHP short_open_tag</strong> = ".((empty(ini_get('short_open_tag')) || ini_get('short_open_tag') == 'Off') ? yn(0) : img_warning().' '.yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).')</span>'."<br>\n";
  88. 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";
  89. print "<strong>PHP allow_url_include</strong> = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")</span><br>\n";
  90. //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";
  91. print "<strong>PHP disable_functions</strong> = ";
  92. $arrayoffunctionsdisabled = explode(',', ini_get('disable_functions'));
  93. $arrayoffunctionstodisable = explode(',', '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');
  94. if ($execmethod == 1) {
  95. $arrayoffunctionstodisable2 = explode(',', 'passthru,shell_exec,system,proc_open,popen');
  96. $functiontokeep = 'exec';
  97. } else {
  98. $arrayoffunctionstodisable2 = explode(',', 'exec,passthru,shell_exec,system,proc_open');
  99. $functiontokeep = 'popen';
  100. }
  101. $i = 0;
  102. foreach ($arrayoffunctionsdisabled as $functionkey) {
  103. if ($i > 0) {
  104. print ', ';
  105. }
  106. print '<span class="opacitymedium">'.$functionkey.'</span>';
  107. $i++;
  108. }
  109. print "<br>\n";
  110. $todisabletext = '';
  111. $i = 0;
  112. foreach ($arrayoffunctionstodisable as $functiontodisable) {
  113. if (! in_array($functiontodisable, $arrayoffunctionsdisabled)) {
  114. if ($i > 0) {
  115. $todisabletext .= ', ';
  116. }
  117. $todisabletext .= img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' <span class="opacitymedium">'.$functiontodisable.'</span>';
  118. $i++;
  119. }
  120. }
  121. if ($todisabletext) {
  122. print $langs->trans("YouShouldDisablePHPFunctions").': '.$todisabletext;
  123. print '<br>';
  124. }
  125. $todisabletext = '';
  126. $i = 0;
  127. foreach ($arrayoffunctionstodisable2 as $functiontodisable) {
  128. if (! in_array($functiontodisable, $arrayoffunctionsdisabled)) {
  129. if ($i > 0) {
  130. $todisabletext .= ', ';
  131. }
  132. $todisabletext .= img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' <span class="opacitymedium">'.$functiontodisable.'</span>';
  133. $i++;
  134. }
  135. }
  136. if ($todisabletext) {
  137. print $langs->trans("IfCLINotRequiredYouShouldDisablePHPFunctions").': '.$todisabletext;
  138. print '<br>';
  139. }
  140. print $langs->trans("PHPFunctionsRequiredForCLI").': ';
  141. if (in_array($functiontokeep, $arrayoffunctionsdisabled)) {
  142. print img_picto($langs->trans("PHPFunctionsRequiredForCLI"), 'warning');
  143. }
  144. print '<span class="opacitymedium">'.$functiontokeep.'</span>';
  145. print '<br>';
  146. print '<br>';
  147. // XDebug
  148. print '<strong>'.$langs->trans("XDebug").'</strong>: ';
  149. $test = !function_exists('xdebug_is_enabled') && !extension_loaded('xdebug');
  150. if ($test) {
  151. print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
  152. } else {
  153. print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
  154. print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
  155. }
  156. print '<br>';
  157. // OS Permissions
  158. print '<br>';
  159. print '<br>';
  160. print '<br>';
  161. print load_fiche_titre($langs->trans("OSSetup").' - '.$langs->trans("PermissionsOnFiles"), '', 'folder');
  162. print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
  163. $arrayoffilesinroot = dol_dir_list(DOL_DOCUMENT_ROOT, 'all', 1, '', array('\/custom'), 'name', SORT_ASC, 4, 1, '', 1);
  164. $fileswithwritepermission = array();
  165. foreach ($arrayoffilesinroot as $fileinroot) {
  166. // Test if there is at least one write permission file. If yes, add the entry into array $fileswithwritepermission
  167. if (isset($fileinroot['perm']) && ($fileinroot['perm'] & 0222)) {
  168. $fileswithwritepermission[] = $fileinroot['relativename'];
  169. }
  170. }
  171. if (empty($fileswithwritepermission)) {
  172. print img_picto('', 'tick').' '.$langs->trans("NoWritableFilesFoundIntoRootDir");
  173. } else {
  174. print img_warning().' '.$langs->trans("SomeFilesOrDirInRootAreWritable");
  175. print '<br>'.$langs->trans("Example").': ';
  176. $i = 0;
  177. foreach ($fileswithwritepermission as $filewithwritepermission) {
  178. if ($i > 0) {
  179. print ', ';
  180. }
  181. print '<span class="opacitymedium">'.$filewithwritepermission.'</span>';
  182. if ($i > 20) {
  183. print ' ...';
  184. break;
  185. }
  186. $i++;
  187. }
  188. }
  189. print '<br>';
  190. print '<br>';
  191. print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $conffile is defined into filefunc.inc.php
  192. $perms = fileperms($dolibarr_main_document_root.'/'.$conffile);
  193. if ($perms) {
  194. if (($perms & 0x0004) || ($perms & 0x0002)) {
  195. print img_warning().' '.$langs->trans("ConfFileIsReadableOrWritableByAnyUsers");
  196. // Web user group by default
  197. $labeluser = dol_getwebuser('user');
  198. $labelgroup = dol_getwebuser('group');
  199. print ' '.$langs->trans("User").': '.$labeluser.':'.$labelgroup;
  200. if (function_exists('posix_geteuid') && function_exists('posix_getpwuid')) {
  201. $arrayofinfoofuser = posix_getpwuid(posix_geteuid());
  202. print ' <span class="opacitymedium">(POSIX '.$arrayofinfoofuser['name'].':'.$arrayofinfoofuser['gecos'].':'.$arrayofinfoofuser['dir'].':'.$arrayofinfoofuser['shell'].')</span>';
  203. }
  204. } else {
  205. print img_picto('', 'tick');
  206. }
  207. } else {
  208. print img_warning().' '.$langs->trans("FailedToReadFile", $conffile);
  209. }
  210. print '<br>';
  211. print '<br>';
  212. $installlock = DOL_DATA_ROOT.'/install.lock';
  213. print '<strong>'.$langs->trans("DolibarrSetup").'</strong>: ';
  214. if (file_exists($installlock)) {
  215. print img_picto('', 'tick').' '.$langs->trans("InstallAndUpgradeLockedBy", $installlock);
  216. } else {
  217. print img_warning().' '.$langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT);
  218. }
  219. print '<br>';
  220. // File conf.php
  221. print '<br>';
  222. print '<br>';
  223. print '<br>';
  224. print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffile.')', '', 'folder');
  225. print '<strong>$dolibarr_main_prod</strong>: '.($dolibarr_main_prod ? $dolibarr_main_prod : '0');
  226. if (empty($dolibarr_main_prod)) {
  227. print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
  228. }
  229. print '<br>';
  230. print '<strong>$dolibarr_nocsrfcheck</strong>: '.(empty($dolibarr_nocsrfcheck) ? '0' : $dolibarr_nocsrfcheck);
  231. if (!empty($dolibarr_nocsrfcheck)) {
  232. print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
  233. } else {
  234. print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span>';
  235. }
  236. print '<br>';
  237. print '<strong>$dolibarr_main_restrict_ip</strong>: ';
  238. if (empty($dolibarr_main_restrict_ip)) {
  239. print $langs->trans("None");
  240. //print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
  241. } else {
  242. print $dolibarr_main_restrict_ip;
  243. }
  244. print '<br>';
  245. print '<strong>$dolibarr_main_restrict_os_commands</strong>: ';
  246. if (empty($dolibarr_main_restrict_os_commands)) {
  247. print $langs->trans("None");
  248. } else {
  249. print $dolibarr_main_restrict_os_commands;
  250. }
  251. print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'mysqldump, mysql, pg_dump, pgrestore').')</span>';
  252. print '<br>';
  253. if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) {
  254. print '<strong>$dolibarr_main_db_pass</strong>: ';
  255. if (!empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
  256. print img_picto('', 'warning').' '.$langs->trans("DatabasePasswordNotObfuscated").' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("SetOptionTo", $langs->transnoentitiesnoconv("MainDbPasswordFileConfEncrypted"), yn(1)).')</span>';
  257. //print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
  258. } else {
  259. print img_picto('', 'tick').' '.$langs->trans("DatabasePasswordObfuscated");
  260. }
  261. print '<br>';
  262. }
  263. // Menu security
  264. print '<br>';
  265. print '<br>';
  266. print '<br>';
  267. print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
  268. print '<strong>'.$langs->trans("UseCaptchaCode").'</strong>: ';
  269. print empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) ? '' : img_picto('', 'tick').' ';
  270. print yn(empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) ? 0 : 1);
  271. print '<br>';
  272. print '<br>';
  273. print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
  274. print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' ';
  275. print yn(empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? 0 : 1);
  276. if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
  277. print ' &nbsp; - '.$conf->global->MAIN_ANTIVIRUS_COMMAND;
  278. if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) {
  279. print ' - <span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
  280. }
  281. }
  282. print '<br>';
  283. print '<br>';
  284. $securityevent = new Events($db);
  285. $eventstolog = $securityevent->eventstolog;
  286. print '<strong>'.$langs->trans("AuditedSecurityEvents").'</strong>: ';
  287. $out = '';
  288. if (!empty($eventstolog) && is_array($eventstolog)) {
  289. // Loop on each event type
  290. $i = 0;
  291. foreach ($eventstolog as $key => $arr) {
  292. if ($arr['id']) {
  293. $key = 'MAIN_LOGEVENTS_'.$arr['id'];
  294. $value = empty($conf->global->$key) ? '' : $conf->global->$key;
  295. if ($value) {
  296. if ($i > 0) {
  297. $out .= ', ';
  298. }
  299. $out .= '<span class="opacitymedium">'.$key.'</span>';
  300. $i++;
  301. }
  302. }
  303. }
  304. print $out;
  305. }
  306. if (empty($out)) {
  307. print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Security").' - '.$langs->transnoentities("Audit")).'<br>';
  308. }
  309. print '<br>';
  310. // Modules/Applications
  311. print '<br>';
  312. print '<br>';
  313. print '<br>';
  314. print load_fiche_titre($langs->trans("Modules"), '', 'folder');
  315. // Module log
  316. print '<strong>'.$langs->trans("Syslog").'</strong>: ';
  317. $test = empty($conf->syslog->enabled);
  318. if ($test) {
  319. print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
  320. } else {
  321. if ($conf->global->SYSLOG_LEVEL > LOG_NOTICE) {
  322. print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog"));
  323. } else {
  324. print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), $conf->global->SYSLOG_LEVEL);
  325. }
  326. //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
  327. }
  328. print '<br>';
  329. // Module debugbar
  330. print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
  331. $test = empty($conf->debugbar->enabled);
  332. if ($test) {
  333. print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
  334. } else {
  335. print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar"));
  336. //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
  337. }
  338. print '<br>';
  339. // APIs
  340. print '<br>';
  341. print '<br>';
  342. print '<br>';
  343. print load_fiche_titre($langs->trans("API"), '', 'folder');
  344. if (empty($conf->api->enabled) && empty($conf->webservices->enabled)) {
  345. print $langs->trans("APIsAreNotEnabled");
  346. } else {
  347. if (!empty($conf->webservices->enabled)) {
  348. print $langs->trans('YouEnableDeprecatedWSAPIsUseRESTAPIsInstead')."<br>\n";
  349. print '<br>';
  350. }
  351. if (!empty($conf->api->enabled)) {
  352. print '<strong>API_ENDPOINT_RULES</strong> = '.(empty($conf->global->API_ENDPOINT_RULES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Example").': login:0,users:0,setup:1,status:1,tickets:1,...)</span>' : $conf->global->API_ENDPOINT_RULES)."<br>\n";
  353. print '<br>';
  354. }
  355. }
  356. print '<br><br>';
  357. print '<br>';
  358. print load_fiche_titre($langs->trans("OtherSetup"), '', 'folder');
  359. //print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
  360. print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_HASH_ALGO)." &nbsp; ";
  361. if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
  362. print '<span class="opacitymedium"> &nbsp; &nbsp; If unset: \'md5\'</span>';
  363. }
  364. if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
  365. print '<br><strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_SALT).'<br>';
  366. } else {
  367. print '<span class="opacitymedium">('.$langs->trans("Recommended").': password_hash)</span>';
  368. print '<br>';
  369. }
  370. if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
  371. print '<div class="info">The recommanded 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>';
  372. print 'If you really want to switch, you must:<br>';
  373. print '- Go on home - setup - other and add constant MAIN_SECURITY_HASH_ALGO to value \'password_hash\'<br>';
  374. print '- In same session, WITHOUT LOGGING OUT, go into your admin user record and set a new password<br>';
  375. print '- You can now logout and login with this new password. You must now reset password of all other users.<br>';
  376. print '</div><br>';
  377. }
  378. print '<br>';
  379. print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->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>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
  380. print '<br>';
  381. print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span><br>';
  382. print '<br>';
  383. print '<strong>MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE</strong> = '.(empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 1)</span><br>';
  384. print '<br>';
  385. print '<strong>MAIN_SECURITY_CSRF_WITH_TOKEN</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 2)</span>'."<br>";
  386. print '<br>';
  387. print '<br>';
  388. print '<br>';
  389. print load_fiche_titre($langs->trans("OtherSetup").' ('.$langs->trans("Experimental").')', '', 'folder');
  390. print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML)."<br>";
  391. print '<br>';
  392. print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."<br>";
  393. print '<br>';
  394. print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.(empty($conf->global->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>' : $conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL)."<br>";
  395. print '<br>';
  396. print '<strong>MAIN_EXEC_USE_POPEN</strong> = ';
  397. if (empty($conf->global->MAIN_EXEC_USE_POPEN)) {
  398. print '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>';
  399. } else {
  400. print $conf->global->MAIN_EXEC_USE_POPEN;
  401. }
  402. if ($execmethod == 1) {
  403. print '<span class="opacitymedium">, "exec" PHP method will be used for shell commands';
  404. print ' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
  405. print '</span>';
  406. }
  407. if ($execmethod == 2) {
  408. print '<span class="opacitymedium">, "popen" PHP method will be used for shell commands';
  409. print ' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
  410. print '</span>';
  411. }
  412. print "<br>";
  413. print '<br>';
  414. // End of page
  415. llxFooter();
  416. $db->close();