Security Group

What is Security Group?

A security group provides security control services for VM NICs. It filters the ingress or egress TCP, UDP, and ICMP packets of VM NICs based on the specified security rules.

Characteristics

Security Group and Security Rule

A security group relies on security rules to filter flows accessing or out of VM NICs. You can add one or more security rules to a security group.
  • Security rules filter flows based on the flow source or flow destination. They can be categorized into the following two types based on the direction of flows they control:
    • Ingress Rule: Ingress rules take effect on flows accessing VM NICs. They are responsible for filtering ingress flow sources.
    • Egress Rule: Egress rules take effect on flows out of VM NICs. They are responsible for filtering egress flow destinations.
  • You can set IP addresses or other security group as flow sources/destinations of security rules.
    • IP address as source: A source IP is filtered by ingress rules. The rules may allow or reject the flows from this IP address to access VM NICs.
    • Security group as source: A source security group is filtered by ingress rules. The rules may allow or reject the flows from this security group to access VM NICs.
    • IP address as destination: A destination IP is filtered by egress rules. The rules may allow or reject VM NICs to access this IP address.
    • Security group as destination:A destination security group is filtered by egress rules. The rules may allow or reject VM NICs to access this security group.
  • You can set priorities for rules on the same direction. The highest rule take effect when a conflict occurs in such a scenario as you set more than one rule, especially an allow rule and a reject rule, on the same source or destination.
  • By default, mutual communications among NICs in the same security group are allowed and the system automatically add corresponding ingress/egress rules to the security group to ensure these mutual communication. These default rules cannot be modified or deleted. If you want to cancel the mutual communications, just disable these rules.

Security Group and VM NIC

A security group provide security controls to VM NICs attached to it. A security group can be attached to one or more VM NIC, and a VM NIC can be attached to one or more security group.
  • If you attach more than one security groups to a VM NIC, you can set priorities for these groups. The NIC matches the rules of the group with the highest priority first, and then the group of lower priorities.
    Note: By default, all admin security group have higher priority than user security groups.
  • After attached to security groups, you need to set a default flow policy to process the flows that are not stipulated by security group rules. By default, all ingress rules that are not stipulated are rejected and all egress rules that are not stipulated are allowed.

Security Group and Permission

Security groups are divided into admin security groups and tenant/sub-account security groups. Generally, admin security groups are created and owned by administrators (including admin and platform managers); tenant/sub-account security groups are created and owned by tenants/sub-accounts.
  • A tenant/sub-account can view and manage security groups owned by itself.
  • The administrator can view and manage all security group. When attach security groups to NICs, note that an admin security group can be attached to any NIC, while To a tenant/sub-account security group can be attached to only NICs owned by the same tenant/sub-account.

Considerations

  • If you use a security group along with other network services, such as load balancing and route table, make sure that the security group rules required by these network services are added to the security group.
  • Public networks, flat networks, and VPC networks support the security group service. It is provided by the security group network service module, which uses iptables to implement security control.
  • A security group is a distributed firewall. Each security rule change, NIC association or disassociation will cause the security group rule to be updated on all associated VM instances.

Create a Security Group

On the main menu of ZStack Cloud, choose Resource Center > Network Service > Basic Network Service > Security Group. On the Security Group page, click Create Security Group. Then, the Create Security Group page is displayed.

On the displayed page, set the following parameters:
  • Name: Enter a name for the security group.
  • Description: Optional. Enter a description for the security group.
  • NIC: Optional. Add a NIC to the security group. You can add NICs either here or after the security group is created.
  • Ingress Rule: Optional. Add rules to filter flows accessing the security group. You can add ingress rules either here or after the security group is created.
  • Egress Rule: Optional. Add rules to filter flows out of the security group. You can add egress rules either here or after the security group is created.
To add an ingress/egress rule, set the following parameters:
  • Type: Set the direction of flows that the rule controls.
  • Priority: Optional. Set a priority to the rule. Valid values: integers from 1 to 100. A smaller number indicates a higher priority.
    Note:
    • If you do not set a priority manually, the rule is endowed with a priority lower than that of all current rules by default.
    • If the priority you set has been occupied, the rule originally occupying it will be pushed back by one automatically. For example, if you set the priority as 2 for the current rule, the rule with the priority 2 originally will be pushed to 3, the original rule 3 will be pushed to 4, and so on.
  • IP Type: Choose IPv4 or IPv6.
  • Protocol: Choose a communication protocol that the rule takes effect on. Supported protocols: ALL, TCP, UDP, and ICMP.
  • Port: Set a port that the rule takes effect on if you choose the protocol as TCP or UDP.
    Note:
    • You can enter ports or port ranges. A port range is formatted by using a hyphen (-), for example, 1-100.
    • You can enter a maximum of 15 entries, with each entry separated by a comma (,). Note that one port range counts as two entries.
    • Example: 885-886,889
  • Source: You need to set this parameter for an ingress rule to allow/reject the flows from the specified source. The source can be an IP address/CIDR or another security group.
    Note:
    • You can enter a static IP address, IP range, or CIDR block. An IP range is formatted by using a hyphen (-), for example, 192.168.0.1-192.168.0.100.
    • If you enter both CIDRs and IP addresses in other formats, make sure that CIDRs use 24-bit netmasks. If you enter CIDRs only, the netmasks are not limited. Do not use 0.0.0.0/0 or ::/0.
    • You can enter a maximum of 50 entries, with each entry separated by a comma (,).
  • Destination: You need to set this parameter for an egress rule to allow/reject VM NICs to access the specified destination. The destination can be an IP address/CIDR or another security group.
    Note:
    • You can enter a static IP address, IP range, or CIDR block. An IP range is formatted by using a hyphen (-), for example, 192.168.0.1-192.168.0.100.
    • If you enter both CIDRs and IP addresses in other formats, make sure that CIDRs use 24-bit netmasks. If you enter CIDRs only, the netmasks are not limited. Do not use 0.0.0.0/0 or ::/0.
    • You can enter a maximum of 50 entries, with each entry separated by a comma (,).
  • Enable: Choose whether to make the rule take effect after the creation. Default: true. If set to false, this rule does not take effect after the creation until you enable it manually.

Manage a Security Group

On the main menu of ZStack Cloud, choose Resource Center > Network Service > Basic Network Service > Security Group. Then, the Security Group page appears.

The following table lists the actions that you can perform on a security group.
Action Description
Create Security Group Create a security group.
Edit Security Group Edit the name and description of a security group.
Enable Security Group Enable a disabled security group.
Disable Security Group Disable an enabled security group. After a security group is disabled, the security group rules and relevant services are no longer in effect.
Delete Security Group Deleting a security group also deletes the security group rules and relevant services.
You can click the name of a security group and enter its details page to perform more actions on the security group rules.
Action Description
Add Rule Add an ingress or egress rule to the security group.
Modify Rule Modify a rule.
Note: You cannot modify the default rules used for the mutual communications within the security group.
Enable Rule Enable a rule to make it take effect.
Disable Rule Disable a rule to make it invalid.
Import Rule Import rules to the security group in batch.
Note: The imported rules are lower than all existing rules on the priority and disabled by default. You can manually enable than and modify their priorities after the import.
Export Rule Export rules of the security group.
Delete Rule Delete a rule.
Note: You cannot delete the default rules used for the mutual communications within the security group.
You can click the name of a security group to enter its details page. Then click the NIC tab. You can perform more actions on the NICs in the security group on this tab.
Action Description
Associate NIC Add a NIC to the security group.
Note:
  • As an administrator, note the following points when you perform this action:
    • You can attach a security group owned by administrators to any NIC. If the NIC is owned by administrators, the security group is endowed with a priority lower than those of all security groups that have been attached to the NIC by default. If the NIC is owned by a tenant or sub-account, the security group is endowed with a priority higher than those of all security groups that have been attached to the NIC.
    • You can attach a security group owned by a tenant/sub-account to only NICs that are also owned by this tenant/sub-account. The security group is endowed with a priority lower than those of all security groups that have been attached to the NIC by default.
  • As a tenant/sub-account, you can attach security groups to NICs owned by your self. The security group is endowed with a priority lower than those of all security groups that have been attached to the NIC by default.
  • After the attachment, you an enter the action lists of VM NICs and click Set Security Group to adjust the default priorities.
Disassociate NIC Remove a NIC from the security group.