简体   繁体   English

我在symfony2的security.yml中需要两个防火墙吗

[英]Do i need two firewalls in security.yml in symfony2

I have this security.yml file. 我有这个security.yml文件。 I want to know do i need two firewalls or one is ok. 我想知道我需要两个防火墙还是一个可以。 I have read in docs that one firewall is ok and use ACL for further things. 我在文档中已经读到,一个防火墙是可以的,并使用ACL进行其他操作。

firewalls:


        admin:
            pattern:      /admin(.*)
            form_login:
                provider:       fos_userbundle
                login_path:     /admin/login
                use_forward:    false
                check_path:     /admin/login_check
                failure_path:   /admin/login
                use_referer:    true
                default_target_path: /admin/dashboard                
            logout:
                path:           /admin/logout
                target:         /admin/login

            anonymous:    true

        main:
            pattern:      .*
            form-login:
                provider:       fos_userbundle
                login_path:     /login
                use_forward:    false
                check_path:     /login_check
                failure_path:   null
                default_target_path: /main 
            logout:       true
            anonymous:    true

You have two entry points: /login and /admin/login . 您有两个入口点: /login/admin/login If you can make do with one, then you could merge down to one firewall. 如果可以使用一个防火墙,则可以合并到一个防火墙。

Yes, you will need two. 是的,您将需要两个。 One firewall protects secure pages, the second firewall allows anonymous access to open pages, which you need to open up at least for your login page (see the common pitfalls section of the security documentation ). 一个防火墙保护安全页面,第二个防火墙允许匿名访问打开的页面,至少您需要为登录页面打开这些页面(请参阅安全文档的常见陷阱部分)。

You will probably want to add paths to the second firewall for home, password recovery, and any other pages you want anyone to be able to access. 您可能希望将路径添加到第二个防火墙,以进行家庭,密码恢复以及您希望任何人都可以访问的任何其他页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM