Monviech / os-caddy-plugin

Caddy Plugin with GUI for OPNsense
Other
38 stars 0 forks source link

Enable client_ip (ACL) support for Handles #60

Closed Monviech closed 8 months ago

Monviech commented 8 months ago

Example Usecase:

Then if enabled, they will create something like this:

Example configurations for exact domains:

example.com {
        @29978007-445d-4bcc-a894-23241asd1cfc {
                client_ip 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 127.0.0.1/8
        }
        handle @29978007-445d-4bcc-a894-23241asd1cfc {
                handle {
                        reverse_proxy 172.16.0.173 {
                        }
                }
        }
}

Example configuration for subdomains with TLS:

*.example.com {
        @cdd470d0-525d-4c93-b2a8-5fa4f476942f {
                host foo.example.com
        }
        handle @cdd470d0-525d-4c93-b2a8-5fa4f476942f {
                @29978007-445d-4bcc-a894-23241asd1cfc {
                        client_ip 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 127.0.0.1/8
                }
                handle @29978007-445d-4bcc-a894-23241asd1cfc {
                        handle {
                                reverse_proxy 172.16.0.173 {
                                        transport http {
                                                tls
                                        }
                                }
                        }
                }
        }
}

Example with not matcher:

example.com {
        @29978007-445d-4bcc-a894-23241asd1cfc {
                not client_ip 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 127.0.0.1/8
        }
        handle @29978007-445d-4bcc-a894-23241asd1cfc {
                handle {
                        reverse_proxy 172.16.0.173 {
                        }
                }
        }
}