I need a little help for Authelia, how to use 2FA only for connections arriving from internet, to bypass authentication if connecting from internal network.
I am using official container image authelia/authelia and letsencrypt/nginx from LSIO.
If I understood correctly here https://github.com/authelia/authelia/blob/master/config.template.yml, this setting, under access_control should use one_factor auth for network 192.168.1.0/24:
- domain: secure.example.com policy: one_factor # Network based rule, if not provided any network matches. networks: - 192.168.1.0/24
What i want to do is opposite, allow access to web site without authentication, go directly to web site if accessing it from internal network, and use 2FA if accessing same web site from internet.
For now configuration I have is working from internal network as well as from internet, authenticating using 2FA all web sites without any problem. I just want to bypass 2FA from internal network. This is what I tried but it’s not working:
access_control: default_policy: deny rules: - domain: "*.example.com" policy: two_factor networks: - 0.0.0.0/5 - 188.8.131.52/7 - 184.108.40.206/8 - 220.127.116.11/6 - 18.104.22.168/4 - 22.214.171.124/3 - 126.96.36.199/2 - 188.8.131.52/3 - 184.108.40.206/5 - 220.127.116.11/6 - 18.104.22.168/12 - 22.214.171.124/11 - 126.96.36.199/10 - 188.8.131.52/9 - 184.108.40.206/8 - 220.127.116.11/7 - 18.104.22.168/4 - 192.0.0.0/9 - 22.214.171.124/11 - 126.96.36.199/13 - 188.8.131.52/16 - 184.108.40.206/15 - 220.127.116.11/14 - 18.104.22.168/12 - 22.214.171.124/10 - 126.96.36.199/8 - 188.8.131.52/7 - 184.108.40.206/6 - 220.127.116.11/5 - 18.104.22.168/4
I just get authenticated from internal network and from internet. Like the setting is not there.
And yes, I did restart Authelia container.
If someone already tried something or has some idea…