All Products
Search
Document Center

Alibaba Cloud Service Mesh:Configure blacklists or whitelists in ASM security policies to implement access control

Last Updated:Feb 06, 2024

To implement precise control over the access permissions of users on services, you can configure a blacklist or whitelist in the corresponding security policies of Service Mesh (ASM). Blacklists and whitelists are common authorization mechanisms that prohibit or allow specified requests to access applications. ASM allows you to configure blacklists and whitelists to control east-west traffic and north-south traffic from multiple dimensions, such as IP addresses, HTTP domain names, and ports. This guarantees the security of applications in ASM. This topic describes how to configure a blacklist for east-west traffic in an ASM security policy.

Prerequisites

Procedure

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose Mesh Security Center > ASMSecurityPolicy.

  3. On the ASMSecurityPolicy page, click Create. In the Create ASMSecurityPolicy dialog box, click Black/White List, and then click OK.

  4. In the Workload and Match Rules step of the configuration wizard, configure the parameters and click Submit.

    Parameter

    Description

    ASMSecurityPolicyName

    Set the name to test.

    Workload List

    1. Click Add Workload.

    2. In the Add Workload dialog box, select Workload Scope. Set the Namespace parameter to default and the Workload Type parameter to Service.

    3. In the Select workloads section, select productpage, click the 添加 icon to add the selected workload to the selected section, and then click OK.

    Match Rule List

    Select Black List for Match Mode, turn on Port, and then set the value to 9080. This setting indicates that all requests to access port 9080 of the productpage pod are denied.

    工作负载和匹配规则

    In the Complete step of the configuration wizard, the "ASMSecurityPolicy Creation successfully" message appears, indicating that the ASM security policy is created. You can click YAML to view the created resources, or click Complete to go back to the ASMSecurityPolicy page to view the created security policy.

  5. Run the following command to check whether the blacklist configurations take effect:

    curl ${IP address of the ingress gateway}/productpage -I

    Expected output:

    HTTP/1.1 403 Forbidden
    content-length: 19
    content-type: text/plain
    date: Fri, 22 Dec 2023 03:07:26 GMT
    server: istio-envoy
    x-envoy-upstream-service-time: 10

    An HTTP 403 status code is returned, indicating that access to the productpage service is denied. This indicates that the blacklist configurations take effect.

References