tencent cloud

Feedback

Application Cases of Security Groups

Last updated: 2024-01-24 17:30:13
    Security groups are used to manage whether a Cloud Virtual Machine (CVM) is accessible. You can configure inbound and outbound rules for security groups to specify whether your server can be accessed by or can access other network resources. Default inbound and outbound rules for security groups are as follows:
    To ensure data security, the inbound rule for a security group is a rejection policy that denies remote access from external networks. To make your CVM accessible to external resources, you need to allow the inbound rule for the corresponding port.
    The outbound rule for a security group specifies whether your CVM can access external network resources. If you select Open All Ports or Open Ports 22, 80, 443, and 3389 and ICMP, the outbound rule for the security group opens the ports to the Internet. If you select a custom security group rule, the outbound rule blocks all ports by default, and you need to set the outbound rule to allow the corresponding port to access external network resources.

    Common Use Cases

    This document describes several common use cases for security groups. If any of the following cases meet your requirements, you can set your security groups according to the configuration recommended for the corresponding use case.

    Scenario 1: remotely connecting to a Linux CVM through SSH

    Case: you have created a Linux CVM and want to remotely connect to the CVM through SSH. Solution: when adding an inbound rule, set Type to Linux Login and open TCP port 22 to the Internet to allow Linux login through SSH. You can open all IP addresses or a specified IP address (or IP address range) to the Internet as required. This allows you to configure the source IP addresses that can remotely access the CVMs through SSH.
    Direction
    Type
    Source
    Protocol Port
    Policy
    Inbound
    Linux login
    All IP addresses: 0.0.0.0/0
    Specified IP address: a specified IP address or IP address range
    TCP: 22
    Allow

    Scenario 2: remotely connecting to a Windows CVM through RDP

    Case: you have created a Windows CVM and want to remotely connect to the CVM through Remote Desktop Connection (RDP). Solution: when adding an inbound rule, set Type to Windows Login and open TCP port 3389 to the Internet to enable remote login to Windows. You can open all IP addresses or a specified IP address (or IP address range) to the Internet as required. This enables you to configure the source IP addresses that can remotely access the CVMs through RDP.
    Direction
    Type
    Source
    Protocol Port
    Policy
    Inbound
    Windows login
    All IP addresses: 0.0.0.0/0
    Specified IP address: a specified IP address or IP address range
    TCP: 3389
    Allow

    Scenario 3: pinging a CVM from the Internet

    Case: you have created a CVM and want to check whether the communication between the CVM and other CVMs is normal. Solution: test the connection by using the ping program. Specifically, when adding an inbound rule, set Type to Ping and open Internet Control Message Protocol (ICMP) ports to the Internet to enable other CVMs to gain access to this CVM through ICMP. You can open all IP addresses or a specified IP address (or IP address range) to the Internet as required. This allows you to configure the source IP addresses that can access this CVM through ICMP.
    Direction
    Type
    Source
    Protocol Port
    Policy
    Inbound
    Ping
    All IP addresses: 0.0.0.0/0
    Specified IP address: a specified IP address or IP address range
    ICMP
    Allow

    Scenario 4: remotely logging in to a CVM through Telnet

    Case: you want to remotely log in to a CVM through Telnet. Solution: when adding an inbound rule, configure the following security group rule:
    Direction
    Type
    Source
    Protocol Port
    Policy
    Inbound
    Custom
    All IP addresses: 0.0.0.0/0
    Specified IP address: a specified IP address or IP address range
    TCP: 23
    Allow

    Scenario 5: authorizing access to a web service through HTTP or HTTPS

    Case: you have built a website and want to allow users to access your website through HTTP or HTTPS. Solution: when adding an inbound rule, configure the following security group rules as required:
    Allow all IP addresses on the Internet to access this website
    Direction
    Type
    Source
    Protocol Port
    Policy
    Inbound
    HTTP (80)
    0.0.0.0/0
    TCP: 80
    Allow
    Inbound
    HTTPS (443)
    0.0.0.0/0
    TCP: 443
    Allow
    Allow some IP addresses on the Internet to access this website
    Direction
    Type
    Source
    Protocol Port
    Policy
    Inbound
    HTTP (80)
    The IP address or IP address range that is allowed to access your website
    TCP: 80
    Allow
    Inbound
    HTTPS (443)
    The IP address or IP address range that is allowed to access your website
    TCP: 443
    Allow

    Scenario 6: allowing an external IP address to access a specified port

    Case: you have deployed a service and want the specified service port (such as port 1101) to be accessible externally. Solution: when adding an inbound rule, set Type to Custom and open TCP port 1101 to the Internet to allow external resources to access the specified service port. You can open all IP addresses or a specified IP address (or IP address range) to the Internet as required. This allows the source IP address to access the specified service port.
    Direction
    Type
    Source
    Protocol Port
    Policy
    Inbound
    Custom
    All IP addresses: 0.0.0.0/0
    Specified IP address: a specified IP address or IP address range
    TCP: 1101
    Allow

    Scenario 7: denying access to a specified port from external IP addresses

    Case: you have deployed a service and want to block external access to a specified service port (such as port 1102). Solution: when adding an inbound rule, set Type to Custom, configure TCP port 1102, and set Policy to Reject to deny external access to the specified service port.
    Direction
    Type
    Source
    Protocol Port
    Policy
    Inbound
    Custom
    All IP addresses: 0.0.0.0/0
    Specified IP address: a specified IP address or IP address range
    TCP: 1102
    Reject

    Scenario 8: allowing a CVM to access only a specified external IP address

    Case: you want your CVM to access only a specified external IP address. Solution: add two outbound security group rules by referring to the following configurations:
    Allow the CVM instance to access a specified public IP address
    Disallow the CVM instance to access any public IP addresses through any protocol
    Note:
    The rule that permits access should have a higher priority than the rule that denies access.
    Direction
    Type
    Source
    Protocol Port
    Policy
    Outbound
    Custom
    The specified public IP address that can be accessed by the CVM
    The required protocol and port
    Allow
    Outbound
    Custom
    0.0.0.0/0
    All
    Reject

    Scenario 9: denying a CVM from accessing a specified external IP address

    Case: you do not want your CVM to access a specified external IP address. Solution: add a security group rule by referring to the following configuration:
    Direction
    Type
    Source
    Protocol Port
    Policy
    Outbound
    Custom
    The specified public IP address that you do not want to be accessed by the CVM
    All
    Reject

    Scenario 10: uploading a file to or downloading a file from a CVM through FTP

    Case: you want to upload a file to or download a file from a CVM by using an FTP program. Solution: add a security group rule by referring to the following configuration:
    Direction
    Type
    Source
    Protocol Port
    Policy
    Inbound
    Custom
    0.0.0.0/0
    TCP: 20-21
    Allow

    Combination of Multiple Scenarios

    In an actual scenario, you may want to configure multiple security group rules based on service requirements, for example, configuring inbound or outbound rules at the same time. One CVM may be bound to one or more security groups. When a CVM is bound to multiple security groups, these security groups are matched and executed in descending order of priorities. You can adjust the priorities of these security groups whenever needed.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support