Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tencent] Issue on creating ICMP rule in SG #487

Closed
jihoon-seo opened this issue Oct 21, 2021 · 7 comments · Fixed by #491
Closed

[Tencent] Issue on creating ICMP rule in SG #487

jihoon-seo opened this issue Oct 21, 2021 · 7 comments · Fixed by #491
Assignees
Labels
CloudDriver enhancement New feature or request

Comments

@jihoon-seo
Copy link
Member

What would you like to be enhanced
:

TB 에서 다음과 같이 SG 생성 시도하면

        curl -H "${AUTH}" -sX POST http://$TumblebugServer/tumblebug/ns/$NSID/resources/securityGroup -H 'Content-Type: application/json' -d @- <<EOF
        {
                        "name": "${CONN_CONFIG[$INDEX,$REGION]}-${POSTFIX}",
                        "connectionName": "${CONN_CONFIG[$INDEX,$REGION]}",
                        "vNetId": "${CONN_CONFIG[$INDEX,$REGION]}-${POSTFIX}",
                        "description": "test description",
                                "firewallRules": [
                                        {
                                                "FromPort": "1",
                                                "ToPort": "65535",
                                                "IPProtocol": "tcp",
                                                "Direction": "inbound",
                                                "CIDR": "0.0.0.0/0"
                                        },
                                        {
                                                "FromPort": "1",
                                                "ToPort": "65535",
                                                "IPProtocol": "udp",
                                                "Direction": "inbound",
                                                "CIDR": "0.0.0.0/0"
                                        },
                                        {
                                                "FromPort": "-1",
                                                "ToPort": "-1",
                                                "IPProtocol": "icmp",
                                                "Direction": "inbound",
                                                "CIDR": "0.0.0.0/0"
                                        }
                                ]
                        }

다음과 같은 에러가 발생합니다.

❯ ./create-securityGroup.sh -n jhseo -c tencent -r 1
####################################################################
## 4. SecurityGroup: Create
####################################################################


- Create securityGroup in tencent-ap-sing
{
  "message": "{\"message\":\"[TencentCloudSDKError] Code=InvalidParameterValue, Message=The parameter `.SecurityGroupPolicySet.Ingress.2.Port`'s value `` is invalid., RequestId=f81c3291-c8d0-497f-a677-bb15deba3139\"}\n"
}

"FromPort": "-1",, "ToPort": "-1", 이라고 되어 있는 ICMP firewallRule을 삭제하고 다시 시도하면
SG가 정상적으로 생성됩니다.

        curl -H "${AUTH}" -sX POST http://$TumblebugServer/tumblebug/ns/$NSID/resources/securityGroup -H 'Content-Type: application/json' -d @- <<EOF
        {
                        "name": "${CONN_CONFIG[$INDEX,$REGION]}-${POSTFIX}",
                        "connectionName": "${CONN_CONFIG[$INDEX,$REGION]}",
                        "vNetId": "${CONN_CONFIG[$INDEX,$REGION]}-${POSTFIX}",
                        "description": "test description",
                                "firewallRules": [
                                        {
                                                "FromPort": "1",
                                                "ToPort": "65535",
                                                "IPProtocol": "tcp",
                                                "Direction": "inbound",
                                                "CIDR": "0.0.0.0/0"
                                        },
                                        {
                                                "FromPort": "1",
                                                "ToPort": "65535",
                                                "IPProtocol": "udp",
                                                "Direction": "inbound",
                                                "CIDR": "0.0.0.0/0"
                                        }
                                ]
                        }
❯ ./create-securityGroup.sh -n jhseo -c tencent -r 1
####################################################################
## 4. SecurityGroup: Create
####################################################################


- Create securityGroup in tencent-ap-sing
{
  "id": "tencent-ap-sing-jhseo",
  "name": "tencent-ap-sing-jhseo",
  "connectionName": "tencent-ap-sing",
  "vNetId": "tencent-ap-sing-jhseo",
  "description": "test description",
  "firewallRules": [
    {
      "FromPort": "1",
      "ToPort": "65535",
      "IPProtocol": "tcp",
      "Direction": "inbound",
      "CIDR": "0.0.0.0/0"
    },
    {
      "FromPort": "1",
      "ToPort": "65535",
      "IPProtocol": "udp",
      "Direction": "inbound",
      "CIDR": "0.0.0.0/0"
    }
  ],
  "cspSecurityGroupId": "sg-eaoincbi",
  "cspSecurityGroupName": "tencent-ap-sing-jhseo",
  "keyValueList": null,
  "associatedObjectList": [],
  "isAutoGenerated": false
}

Why is this needed
:

AWS 등 다른 CSP에 대해서는

                                        {
                                                "FromPort": "-1",
                                                "ToPort": "-1",
                                                "IPProtocol": "icmp",
                                                "Direction": "inbound",
                                                "CIDR": "0.0.0.0/0"
                                        }

으로 입력하면 ICMP rule이 잘 만들어지는 것으로 알고 있습니다. 😊

Proposed solution
:

@jihoon-seo jihoon-seo added the enhancement New feature or request label Oct 21, 2021
@powerkimhub
Copy link
Member

@dev4unet

  • 확인 부탁 드립니다.

@dev4unet
Copy link
Member

@powerkimhub 현재 Tencent는 커스텀 정책으로 보안 그룹을 등록하고 있으며 다른 CSP들은 - 포트 정책(All)을 지원하는데 텐센트는 마이너스 포트가 없습니다.
https://intl.cloud.tencent.com/document/product/213/34272

범위의 경우에도 다른 벤더들은 시작과 종료에 같은 포트 번호를 적어도 되지만 텐센트는 시작과 종료에 같은 포트를 넣으면 에러가 발생하며 현재 문서를 찾아 보니 "ALL" 템플릿이 있기 때문에 포트에 "-" 대신 아마도 "ALL"을 입력하면 될 것같기는 합니다.
ALL을 "-"로 통일하고 싶다면 "-"가 들어오면 "ALL"로 치환하면 될 것같은데 시작과 종료및 다른 포트와의 중복 사용 등 다양하게 테스트는 해야할 듯싶네요.

Protocol port: enter the protocol type and port range or reference a protocol/port or protocol/port group in a parameter template. The supported protocol type includes TCP, UDP, ICMP, ICMPv6 and GRE in the following formats.
Single port: such as TCP:80.
Multiple ports: such as TCP:80,443.
Port range: such as TCP:3306-20000.
All ports: such as TCP:ALL.

@powerkimhub
Copy link
Member

@dev4unet

@dev4unet
Copy link
Member

@powerkimhub 정보 감사합니다.

변환 기준: -1 => Null, From과 To 모두 -1 => All

텐센트에서 Null 포트 지정 방법은 못 찾겠네요.
우선 "From"에 -1 또는 From&To에 -1 또는 "To"에 -1이 지정되면 모두 ALL 포트로 치환하겠습니다.

@powerkimhub
Copy link
Member

@dev4unet

  • 넵, 알겠습니다.

@powerkimhub
Copy link
Member

@dev4unet

다음 내용 확인 부탁 드립니다. (ASAP)

powerkimhub added a commit that referenced this issue Nov 11, 2021
Tencent - 보안 포트에서 All을 "-"에서 "-1"로 버그 수정 (이슈#487)
@seokho-son
Copy link
Member

fixed by #526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CloudDriver enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants