diff --git a/examples/forgejo.yml b/examples/forgejo.yml index 4ad5ceb..a5d83b3 100644 --- a/examples/forgejo.yml +++ b/examples/forgejo.yml @@ -104,6 +104,15 @@ rules: - *is-bot-yandexbot action: pass + # Matches private networks and localhost. + # Uncomment this if you want to let your own tools this way + # - name: allow-private-networks + # conditions: + # # Allows localhost and private networks CIDR + # - *is-network-localhost + # - *is-network-private + # action: pass + - name: undesired-networks conditions: - 'remoteAddress.network("huawei-cloud") || remoteAddress.network("alibaba-cloud") || remoteAddress.network("zenlayer-inc")' diff --git a/examples/generic.yml b/examples/generic.yml index 5c894ac..e0b4749 100644 --- a/examples/generic.yml +++ b/examples/generic.yml @@ -60,6 +60,15 @@ rules: - *is-bot-yandexbot action: pass + # Matches private networks and localhost. + # Uncomment this if you want to let your own tools this way + # - name: allow-private-networks + # conditions: + # # Allows localhost and private networks CIDR + # - *is-network-localhost + # - *is-network-private + # action: pass + - name: undesired-crawlers conditions: - '($is-headless-chromium)' diff --git a/examples/snippets/networks-private.yml b/examples/snippets/networks-private.yml new file mode 100644 index 0000000..ed137a3 --- /dev/null +++ b/examples/snippets/networks-private.yml @@ -0,0 +1,20 @@ +networks: + localhost: + # localhost and loopback addresses + - prefixes: + - "127.0.0.0/8" + - "::1/128" + private: + # Private network CIDR blocks + - prefixes: + # private networks + - "10.0.0.0/8" + - "172.16.0.0/12" + - "192.168.0.0/16" + - "fc00::/7" + +conditions: + is-network-localhost: + - &is-network-localhost 'remoteAddress.network("localhost")' + is-network-private: + - &is-network-private 'remoteAddress.network("private")' \ No newline at end of file