apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
14.49k stars 2.52k forks source link

How does apisix integrate coraza-proxy-wasm? #10859

Closed githubxubin closed 9 months ago

githubxubin commented 9 months ago

Description

Currently, I need to use apisix's sql injection and xss capabilities, I tried to integrate coraza-proxy-wasm, but failed, here is my operation and configuration! referer link:https://docs.api7.ai/apisix/how-to-guide/security/waf/integrate-with-coraza step 1: All configurations are configured according to the document step 2: I failed to add a route on the dashboard page.

{
    "uri": "/test/*",
    "name": "coraza测试",
    "groupId": "1",
    "openId": "",
    "priority": 1,
    "methods": [
        "GET",
        "POST",
        "PUT",
        "DELETE",
        "PATCH",
        "HEAD",
        "OPTIONS"
    ],
    "plugins": {
        "coraza-filter": {
            "conf": {
                "directives_map": {
                    "default": [
                        "SecDebugLogLevel 9",
                        "SecRuleEngine On",
                        "Include @crs-setup-conf",
                        "Include @owasp_crs/*.conf"
                    ]
                },
                "default_directives": "default"
            }
        }
    },
    "upstream": {
        "nodes": [
            {
                "host": "10.210.21.105",
                "port": 1001,
                "weight": 1
            }
        ],
        "retries": 0,
        "timeout": {
            "connect": 6,
            "send": 6,
            "read": 6
        },
        "type": "roundrobin",
        "scheme": "http",
        "discovery_args": {
            "group_name": "",
            "namespace_id": ""
        },
        "pass_host": "pass",
        "keepalive_pool": {
            "idle_timeout": 60,
            "requests": 1000,
            "size": 320
        }
    },
    "status": 1
}

Save failed! the error is: image Whether it is a version problem: apisix version: 3.2/release dashboard version:3.0

Environment

githubxubin commented 9 months ago

@shreemaan-abhishek

sheharyaar commented 9 months ago

Did you setup the wasm and it's config in the yaml correctly?

githubxubin commented 9 months ago

Did you setup the wasm and it's config in the yaml correctly?

Yes the configuration is correct, here is my config configuration, and wasm in the container

config:

wasm:
  plugins:
    - name: coraza-filter
      priority: 7999
      file: /usr/local/bin/coraza-proxy-wasm.wasm

Inside the apisix container:

image

My version 3.2/release does support this feature?tks

sheharyaar commented 9 months ago

apisix is running in the same container, right ?

kayx23 commented 9 months ago

apisix version: 3.2

Might be the version. I don't recall coraza was available in 3.2. If you can afford to upgrade, try 3.6.

githubxubin commented 9 months ago

apisix version: 3.2

Might be the version. I don't recall coraza was available in 3.2. If you can afford to upgrade, try 3.6.

It costs too much to upgrade the version, could you please help confirm it?tks

kayx23 commented 9 months ago

@githubxubin >=3.6 confirmed.

githubxubin commented 9 months ago

@githubxubin >=3.6 confirmed.

okey!