From a0dda0ed7794dc1ed6ad9b1dd7e421e7ca56457a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2022 12:35:40 +0200 Subject: [PATCH] NEW Add more advices into the Setup security page --- htdocs/admin/security.php | 2 +- htdocs/admin/system/security.php | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index de404916fb4..02cddbd5d70 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -229,7 +229,7 @@ foreach ($arrayhandler as $key => $module) { if ($module->isEnabled()) { print ''; - print img_picto('', $module->picto, 'class="width25 size15x opacitymedium"').' '; + print img_picto('', $module->picto, 'class="width25 size15x"').' '; print ucfirst($key); print "\n"; print $module->getDescription().'
'; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 7ee7c93a97d..c2e486fc940 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -297,7 +297,7 @@ if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) { -// Menu security +// Menu Home - Setup - Security print '
'; print '
'; @@ -338,6 +338,11 @@ print '
'; print '
'; */ +/* Password length + +// Stored into $tabconf[0] if module generator is "Perso" or specific to the module generator. +$tabConf = explode(";", getDolGlobalString('USER_PASSWORD_PATTERN')); + print ''.$langs->trans("PasswordLength").': '; print empty($conf->global->DATABASE_PWD_ENCRYPTED) ? '' : img_picto('', 'tick').' '; print yn(empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1); @@ -346,7 +351,7 @@ if (empty($conf->global->DATABASE_PWD_ENCRYPTED)) { } print '
'; print '
'; - +*/ print ''.$langs->trans("AntivirusEnabledOnUpload").': '; print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? img_warning().' ' : img_picto('', 'tick').' '; @@ -362,6 +367,19 @@ if (empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { print '
'; print '
'; +$umask = getDolGlobalString('MAIN_UMASK'); + +print ''.$langs->trans("UMask").': '; +if (! in_array($umask, array('600', '660', '0600', '0660'))) { + print img_warning().' '; +} +print $umask; +if (! in_array($umask, array('600', '660', '0600', '0660'))) { + print '   ('.$langs->trans("Recommended").': 0600 | 0660'.')'; +} +print '
'; +print '
'; + $securityevent = new Events($db); $eventstolog = $securityevent->eventstolog; @@ -527,10 +545,10 @@ print '
'; print 'MAIN_SECURITY_FORCECSP = '.(empty($conf->global->MAIN_SECURITY_FORCECSP) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCECSP).'   ('.$langs->trans("Example").": \"default-src 'self'; img-src *;\")
"; print '
'; -print 'WEBSITE_MAIN_SECURITY_FORCECSP = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCECSP) ? ''.$langs->trans("Undefined").'' : $conf->global->WEBSITE_MAIN_SECURITY_FORCECSP).'   ('.$langs->trans("Example").": \"default-src 'self'; style-src: https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src: https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src: *;\")
"; +print 'MAIN_SECURITY_FORCERP = '.(empty($conf->global->MAIN_SECURITY_FORCERP) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCERP).'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\")
"; print '
'; -print 'MAIN_SECURITY_FORCERP = '.(empty($conf->global->MAIN_SECURITY_FORCERP) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCERP).'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\")
"; +print 'WEBSITE_MAIN_SECURITY_FORCECSP = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCECSP) ? ''.$langs->trans("Undefined").'' : $conf->global->WEBSITE_MAIN_SECURITY_FORCECSP).'   ('.$langs->trans("Example").": \"default-src 'self'; style-src: https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src: https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src: *;\")
"; print '
'; print 'WEBSITE_MAIN_SECURITY_FORCERP = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCERP) ? ''.$langs->trans("Undefined").'' : $conf->global->WEBSITE_MAIN_SECURITY_FORCERP).'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\")
";