You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "panhow (via GitHub)" <gi...@apache.org> on 2023/08/16 07:25:03 UTC

[GitHub] [apisix] panhow opened a new issue, #10031: bug: global_rules not working in stream proxy

panhow opened a new issue, #10031:
URL: https://github.com/apache/apisix/issues/10031

   ### Current Behavior
   
   global_rules not working in stream proxy.
   i set a ip-restriction global-rule, not working. 
   
   ### Expected Behavior
   
   return 403 when ip access by ip not included in whitelist
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   1. Enable stream mode
   
   ```yaml
   apisix:
       stream_proxy:
           tcp:
               - addr: "80"
   ```
   
   2. start a http server 
   
   ```yaml
   python2 -m SimpleHTTPServer 8080
   ```
   
   3. set up a stream_route
   
   ```bash
   curl 127.0.0.1:9080/apisix/admin/stream_routes/test-routes -XPUT -d '{
       "server_port": 80,
           "upstream": {
               "type": "roundrobin",
               "pass_host": "pass",
               "scheme": "http",
               "nodes": [{
                         "port": 80,
                         "host": "127.0.0.1:8080",
                         "weight": 20
                    }]
            }
   }'
   ```
   
   4. set up a global-rules 
   
   ```bash
   curl 127.0.0.1:9080/apisix/admin/global_rules/whitelist -XPUT -d '{
        "plugins": {
               "ip-restriction": {
                      "whitelist": ["127.0.0.1"]
               }
        }
   }'
   ```
   
   5. test by curl
   
   ```bash
   curl 127.0.0.1
   < HTTP/1.1 200 ok
   ```
   
   ### Environment
   
   - APISIX version (run `apisix version`): 2.15.1


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] shreemaan-abhishek commented on issue #10031: bug: global_rules not working in stream proxy

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #10031:
URL: https://github.com/apache/apisix/issues/10031#issuecomment-1680911615

   @panhow, stream routes do not support global rules.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] shreemaan-abhishek commented on issue #10031: bug: global_rules not working in stream proxy

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #10031:
URL: https://github.com/apache/apisix/issues/10031#issuecomment-1694648604

   @kayx23, great points 🧠💡. Maybe we should support it instead.
   
   WDYT @monkeyDluffy6017 ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Revolyssup commented on issue #10031: bug: global_rules not working in stream proxy

Posted by "Revolyssup (via GitHub)" <gi...@apache.org>.
Revolyssup commented on issue #10031:
URL: https://github.com/apache/apisix/issues/10031#issuecomment-1680591309

   @panhow 
   Q1. Is ip blocking working otherwise on other endpoints other than the stream proxy?
   Q2. Can you use tcpdump or wireshark to confirm that when traffic reaches APISIX, the source IP is indeed `172.16.0.1`. Or even better if you are working in dev environment, you can use an existing plugin's phase to log and check `ctx.var.remote_addr` to confirm that its `172.16.0.1`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] panhow commented on issue #10031: bug: global_rules not working in stream proxy

Posted by "panhow (via GitHub)" <gi...@apache.org>.
panhow commented on issue #10031:
URL: https://github.com/apache/apisix/issues/10031#issuecomment-1680105438

   @shreemaan-abhishek PTAL


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on issue #10031: bug: global_rules not working in stream proxy

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on issue #10031:
URL: https://github.com/apache/apisix/issues/10031#issuecomment-1734126833

   @kayx23 @shreemaan-abhishek We could support this feature


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: global_rules not working in stream proxy [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop closed issue #10031: bug: global_rules not working in stream proxy
URL: https://github.com/apache/apisix/issues/10031


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Revolyssup closed issue #10031: bug: global_rules not working in stream proxy

Posted by "Revolyssup (via GitHub)" <gi...@apache.org>.
Revolyssup closed issue #10031: bug: global_rules not working in stream proxy
URL: https://github.com/apache/apisix/issues/10031


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] kayx23 commented on issue #10031: bug: global_rules not working in stream proxy

Posted by "kayx23 (via GitHub)" <gi...@apache.org>.
kayx23 commented on issue #10031:
URL: https://github.com/apache/apisix/issues/10031#issuecomment-1694164935

   I challenge if this is the intended behaviour.
   
   1. Why should `ip-restriction` not work as a global plugin by design? It is available as a non-global plugin and it makes sense as IP is well available on L4:
   
   ![image](https://github.com/apache/apisix/assets/39619599/3fee52a1-5311-4b3a-96d6-8f3731a8df85)
   
   2. Even if it is designed to not work with global plugin, for whatever reason, the program should throw an error for the user. This is not something that should be handled by the documentation: https://github.com/apache/apisix/pull/9999#discussion_r1303779702
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: global_rules not working in stream proxy [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #10031:
URL: https://github.com/apache/apisix/issues/10031#issuecomment-4021428807

   Closing this due to inactivity. If there’s still interest in this feature, please let us know!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Revolyssup commented on issue #10031: bug: global_rules not working in stream proxy

Posted by "Revolyssup (via GitHub)" <gi...@apache.org>.
Revolyssup commented on issue #10031:
URL: https://github.com/apache/apisix/issues/10031#issuecomment-1680603420

   @panhow Instead of using ip-restriction plugin, you can add the field
   ``` bash
   "remote_addr": "172.16.0.1",
   ```
   to your test-routes configuration and this will allow traffic on this only from this IP


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] panhow commented on issue #10031: bug: global_rules not working in stream proxy

Posted by "panhow (via GitHub)" <gi...@apache.org>.
panhow commented on issue #10031:
URL: https://github.com/apache/apisix/issues/10031#issuecomment-1681482528

   > @panhow, stream routes do not support global rules.
   
   alright..


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org