-
Notifications
You must be signed in to change notification settings - Fork 38
securing apache/dolibarr installation by letting apache deny access #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JonBendtsen
wants to merge
4
commits into
Dolibarr:main
Choose a base branch
from
JonBendtsen:apache_deny_some_files_and_dirs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Denying different certificate files | ||
| <FilesMatch "/\.cer"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.crt"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.cert"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.pem"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.der"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.key"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.keystore"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.jks"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p12"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.pcks"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.ca-bundle"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p7b"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p7c"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p7s"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.pfx"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p8"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Deny various compression files | ||
| <FilesMatch "/\.gz"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.tgz"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.tar"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.zip"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.bz2"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.rar"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Denying Spreadsheet files | ||
| <FilesMatch "/\.csv"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.xls"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Denying MS Office, Libre Office, or even CSV might be a bad idea, as most companies rely on those types of documents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Denying word files | ||
| <FilesMatch "/\.doc"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Deny dolibarr configuration file | ||
| <DirectoryMatch "/conf/"> | ||
| Require all denied | ||
| </DirectoryMatch> | ||
|
|
||
| <FilesMatch "/conf\.php"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Deny Dolibarr language files | ||
| <DirectoryMatch "/langs/"> | ||
| Require all denied | ||
| </DirectoryMatch> | ||
|
|
||
| <FilesMatch "/\.lang"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Denying . files | ||
| <FilesMatch "/^\."> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Deny git repositories and files | ||
| <DirectoryMatch "/\.git"> | ||
| Require all denied | ||
| </DirectoryMatch> | ||
|
|
||
| <FilesMatch "/^\.git"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Deny JSON files | ||
| <FilesMatch "/\.json"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Denying Database files | ||
| <FilesMatch "/\.sql"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Denying subversion because it was mentioned in the security.conf file that came with the container image | ||
| <DirectoryMatch "/\.svn"> | ||
| Require all denied | ||
| </DirectoryMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Denying XML files | ||
| <FilesMatch "/\.xml"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Denying Yaml files | ||
| <FilesMatch "/\.yml"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| # Denying different certificate files | ||
| <FilesMatch "/\.cer"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.crt"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.cert"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.pem"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.der"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.key"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.keystore"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.jks"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p12"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.pcks"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.ca-bundle"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p7b"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p7c"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p7s"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.pfx"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.p8"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Deny various compression files | ||
| <FilesMatch "/\.gz"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.tgz"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.tar"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.zip"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.bz2"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.rar"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Denying Spreadsheet files | ||
| <FilesMatch "/\.csv"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| <FilesMatch "/\.xls"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Denying word files | ||
| <FilesMatch "/\.doc"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Deny dolibarr configuration file | ||
| <DirectoryMatch "/conf/"> | ||
| Require all denied | ||
| </DirectoryMatch> | ||
|
|
||
| <FilesMatch "/conf\.php"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Deny Dolibarr language files | ||
| <DirectoryMatch "/langs/"> | ||
| Require all denied | ||
| </DirectoryMatch> | ||
|
|
||
| <FilesMatch "/\.lang"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Denying . files | ||
| <FilesMatch "/^\."> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Deny git repositories and files | ||
| <DirectoryMatch "/\.git"> | ||
| Require all denied | ||
| </DirectoryMatch> | ||
|
|
||
| <FilesMatch "/^\.git"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Deny JSON files | ||
| <FilesMatch "/\.json"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Denying Database files | ||
| <FilesMatch "/\.sql"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Denying subversion because it was mentioned in the security.conf file that came with the container image | ||
| <DirectoryMatch "/\.svn"> | ||
| Require all denied | ||
| </DirectoryMatch> | ||
|
|
||
| # Denying XML files | ||
| <FilesMatch "/\.xml"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
||
| # Denying Yaml files | ||
| <FilesMatch "/\.yml"> | ||
| Require all denied | ||
| </FilesMatch> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Denying MS Office, Libre Office, or even CSV might be a bad idea, as most companies rely on those types of documents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cibero42
yes, but I do no think these files are served directly through Apache as static files, I think they are served as files through PHP - because else you can not have Dolibarr access control to these files.
How do we figure out? Well, we test it, and we test it all the places that we download files in Dolibarr.
Examples
Claim all files in Dolibarr are downloaded through document.php not through apache, and thus we can easily without issues ban any other file than .php and .html files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Jon,
Thanks for the explanation! If that's the case, it's better to include other MS Office and LibreOffice formats, no?
If you prefer, I can try to find a comprehensive list for you and post here...