-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
document how to restrict a firewall to a specific host #2986
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
Closed
Closed
Changes from all commits
Commits
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,62 @@ | ||
.. index:: | ||
single: Security; Restrict Security Firewalls to a Host | ||
|
||
How to restrict Firewalls to a Specific Host | ||
============================================ | ||
|
||
.. versionadded:: 2.4 | ||
Support for restricting security firewalls to a specific host was added in | ||
Symfony 2.4. | ||
|
||
When using the Security component, you can create firewalls that match certain | ||
url patterns and thereby restrict access to all urls matching these patterns. | ||
Additionally, you can restrict a firewall to a host using the ``host`` key: | ||
|
||
.. configuration-block:: | ||
|
||
.. code-block:: yaml | ||
# app/config/security.yml | ||
# ... | ||
security: | ||
firewalls: | ||
secured_area: | ||
pattern: ^/ | ||
host: admin\.example\.com | ||
http_basic: true | ||
.. code-block:: xml | ||
<!-- app/config/security.xml --> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<srv:container xmlns="http://symfony.com/schema/dic/security" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:srv="http://symfony.com/schema/dic/services" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services | ||
http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
<config> | ||
<!-- ... --> | ||
<firewall name="secured_area" pattern="^/" host="admin.example.com"> | ||
<http-basic /> | ||
</firewall> | ||
</config> | ||
</srv:container> | ||
.. code-block:: php | ||
// app/config/security.php | ||
// ... | ||
$container->loadFromExtension('security', array( | ||
'firewalls' => array( | ||
'secured_area' => array( | ||
'pattern' => '^/', | ||
'host' => 'admin.example.com', | ||
'http_basic' => true, | ||
), | ||
), | ||
)); |
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ Security | |
acl | ||
acl_advanced | ||
force_https | ||
host_restriction | ||
form_login | ||
securing_services | ||
custom_provider | ||
|
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.
the documentation is using an example
admin.example.com
so maybe at least mentioning that the firewall will be only active on that domainadmin.example.com
illutstrates it very explicitly. Also what happens on other domains? the firewall does not apply? does the user need to take care about some security issues?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.
What security issues do you mean?