Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
justinfreeman (Agileware)
Core
Commits
fea6131e
Commit
fea6131e
authored
11 years ago
by
totten
Browse files
Options
Downloads
Patches
Plain Diff
More consistently restrict access to template, config/log, and upload dirs.
parent
e7d3e318
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Core/Config.php
+11
-1
11 additions, 1 deletion
CRM/Core/Config.php
CRM/Utils/Check/Security.php
+5
-1
5 additions, 1 deletion
CRM/Utils/Check/Security.php
with
16 additions
and
2 deletions
CRM/Core/Config.php
+
11
−
1
View file @
fea6131e
...
...
@@ -335,6 +335,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
CRM_Utils_File
::
baseFilePath
(
$this
->
templateCompileDir
)
.
'ConfigAndLog'
.
DIRECTORY_SEPARATOR
;
CRM_Utils_File
::
createDir
(
$this
->
configAndLogDir
);
CRM_Utils_File
::
restrictAccess
(
$this
->
configAndLogDir
);
// we're automatically prefixing compiled templates directories with country/language code
global
$tsLocale
;
...
...
@@ -346,6 +347,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
}
CRM_Utils_File
::
createDir
(
$this
->
templateCompileDir
);
CRM_Utils_File
::
restrictAccess
(
$this
->
templateCompileDir
);
}
elseif
(
$loadFromDB
)
{
echo
'You need to define CIVICRM_TEMPLATE_COMPILEDIR in civicrm.settings.php'
;
...
...
@@ -466,6 +468,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
if
(
substr
(
$this
->
templateCompileDir
,
-
1
*
strlen
(
$value
)
-
1
,
-
1
)
!=
$value
)
{
$this
->
templateCompileDir
.
=
CRM_Utils_File
::
addTrailingSlash
(
$value
);
CRM_Utils_File
::
createDir
(
$this
->
templateCompileDir
);
CRM_Utils_File
::
restrictAccess
(
$this
->
templateCompileDir
);
}
}
...
...
@@ -623,7 +626,14 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
// clean upload dir
CRM_Utils_File
::
cleanDir
(
$this
->
uploadDir
);
CRM_Utils_File
::
createDir
(
$this
->
uploadDir
);
CRM_Utils_File
::
restrictAccess
(
$this
->
uploadDir
);
}
// Whether we delete/create or simply preserve directories, we should
// certainly make sure the restrictions are enforced.
foreach
(
array
(
$this
->
templateCompileDir
,
$this
->
uploadDir
,
$this
->
configAndLogDir
)
as
$dir
)
{
if
(
$dir
&&
is_dir
(
$dir
))
{
CRM_Utils_File
::
restrictAccess
(
$dir
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
CRM/Utils/Check/Security.php
+
5
−
1
View file @
fea6131e
...
...
@@ -82,6 +82,11 @@ class CRM_Utils_Check_Security {
if
(
CRM_Core_Permission
::
check
(
'administer CiviCRM'
))
{
$session
=
CRM_Core_Session
::
singleton
();
if
(
$session
->
timer
(
'check_'
.
__CLASS__
,
self
::
CHECK_TIMER
))
{
// Best attempt at re-securing folders
$config
=
CRM_Core_Config
::
singleton
();
$config
->
cleanup
(
0
,
FALSE
);
foreach
(
$this
->
checkAll
()
as
$message
)
{
CRM_Core_Session
::
setStatus
(
$message
,
ts
(
'Security Warning'
));
}
...
...
@@ -138,7 +143,6 @@ class CRM_Utils_Check_Security {
$log
=
CRM_Core_Error
::
createDebugLogger
();
$log_filename
=
$log
->
_filename
;
$config
=
CRM_Core_Config
::
singleton
();
$filePathMarker
=
$this
->
getFilePathMarker
();
// Hazard a guess at the URL of the logfile, based on common
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment