Skip to content

SecurityGroup Management Guide(KR)

ByoungSeob Kim edited this page Feb 4, 2026 · 2 revisions

Security Group Management Guide

Language: English | 한국어

1. CB-Spider Security Group 개요

  • 사용자는 Security Group을 생성하여 VM의 inbound/outbound 네트워크 트래픽을 제어할 수 있다.
  • Security Group은 특정 VPC에 소속되며, 하나 이상의 보안 규칙(Security Rules)을 포함할 수 있다.
  • CB-Spider Security Group은 허용 규칙(Allow Rule)을 정의하는 방식으로 동작한다.
  • Security Group과 VM 간의 관계는 아래 그림과 같다.
┌─────────────────────────────────────────────────────────────┐
│                  CB-Spider Security Group                   │
│                                                             │
│  VPC (10.0.0.0/16)                                          │
│  ├── SecurityGroup-1                                        │
│  │   ├── Rule: Inbound TCP 22 from 0.0.0.0/0                │
│  │   ├── Rule: Inbound TCP 80 from 0.0.0.0/0                │
│  │   └── Rule: Outbound ALL -1 to 0.0.0.0/0                 │
│  │   └── Applied to: VM-1, VM-2                             │
│  │                                                          │
│  └── SecurityGroup-2                                        │
│      ├── Rule: Inbound TCP 3306 from 10.0.0.0/16            │
│      ├── Rule: Outbound ALL -1 to 0.0.0.0/0                 │
│      └── Applied to: VM-3                                   │
└─────────────────────────────────────────────────────────────┘

1.1 Default Security Rules

Security Group 생성 시 default Rule은 다음과 같으며, CSP별로 관련 Rule이 보일 수도 있고 안보일 수도 있다:

  • inbound: 모든 트래픽 차단
  • outbound: 모든 트래픽 허용

1.2 Security Rule 속성

각 Security Rule은 다음과 같은 속성으로 정의된다:

속성 설명 예시
Direction 트래픽 방향 inbound | outbound
IPProtocol 대상 프로토콜 ALL, TCP, UDP, ICMP
FromPort 시작 포트 TCP/UDP: 1~65535
ICMP/ALL: -1
ToPort 종료 포트 TCP/UDP: 1~65535
ICMP/ALL: -1
CIDR 적용 대상 주소 범위 0.0.0.0/0, ::/0, 10.0.0.0/16

2. CB-Spider Security Group API 및 제공 정보 규격

  • 사용자는 다음과 같은 CB-Spider REST API를 이용하여 Security Group 정보를 JSON 규격으로 제공받는다.

2.1 Security Group 관리 API

# Security Group 관리
POST   /spider/securitygroup                - Create SecurityGroup
GET    /spider/securitygroup                - List SecurityGroups
GET    /spider/securitygroup/vpc/{VPCName}  - List SecurityGroups in VPC
GET    /spider/securitygroup/{Name}         - Get SecurityGroup
DELETE /spider/securitygroup/{Name}         - Delete SecurityGroup

# Security Group 등록/해제 (기존 CSP Security Group 연동)
POST   /spider/regsecuritygroup             - Register SecurityGroup
DELETE /spider/regsecuritygroup/{Name}      - Unregister SecurityGroup

# Security Group 목록 조회 (전체)
GET    /spider/allsecuritygroup             - List All SecurityGroups (CB-Spider + CSP)
GET    /spider/allsecuritygroupinfo         - List All SecurityGroups Info

# Security Group 통계
GET    /spider/countsecuritygroup           - Count All SecurityGroups
GET    /spider/countsecuritygroup/{ConnectionName} - Count SecurityGroups by Connection

# CSP Security Group 직접 삭제
DELETE /spider/cspsecuritygroup/{Id}        - Delete CSP SecurityGroup

2.2 Security Rules 관리 API

# Security Rules 추가/삭제
POST   /spider/securitygroup/{SGName}/rules - Add Rules
DELETE /spider/securitygroup/{SGName}/rules - Remove Rules

2.3 제공 정보 규격

Security Group 정보 (SecurityInfo)

필드 설명 예시
IId Security Group의 식별자 정보 (NameId, SystemId) ● {Name: "sg-01", SystemId: "sg-1234abcd"}
VpcIID 소속 VPC의 식별자 정보 (NameId, SystemId) ● {Name: "vpc-01", SystemId: "vpc-5678efgh"}
SecurityRules Security Rule 정보 리스트 ● 아래 Security Rule 정보 참조
TagList Security Group에 할당된 태그 리스트 ● [{Key: "Environment", Value: "Production"}]
KeyValueList CSP가 제공하는 추가 정보를 Key/Value List 형태로 제공 ● [{Key: "GroupId", Value: "sg-1234"}]

Security Rule 정보 (SecurityRuleInfo)

필드 설명 예시
Direction 트래픽 방향 ● "inbound", "outbound"
IPProtocol 프로토콜 유형 ● "TCP", "UDP", "ICMP", "ALL"
FromPort 시작 포트 번호 ● "22", "80", "1", "-1"(ALL/ICMP)
ToPort 종료 포트 번호 ● "22", "80", "65535", "-1"(ALL/ICMP)
CIDR 적용 대상 IP 주소 범위 (CIDR 표기) ● "0.0.0.0/0", "10.0.0.0/16", "::/0"

프로토콜별 Security Rule 세부 규칙

Direction IPProtocol FromPort ToPort CIDR 비고
inbound, outbound ALL -1 -1 0.0.0.0/0, ::/0 등 모든 트래픽 허용
inbound, outbound TCP 1~65535 1~65535 0.0.0.0/0 등 예: SSH(22), HTTP(80), HTTPS(443)
inbound, outbound UDP 1~65535 1~65535 0.0.0.0/0 등 예: DNS(53), NTP(123)
inbound, outbound ICMP -1 -1 0.0.0.0/0 등 네트워크 계층, 포트 불필요
예: ping, traceroute

3. CB-Spider Security Group API 및 제공 정보 예시

3.1 Security Group 생성 예시

  • AWS에서 SSH와 HTTP 접근을 허용하는 sg-web Security Group을 생성하는 API 호출 및 결과 예시가 다음과 같다.
curl -sX 'POST' 'http://localhost:1024/spider/securitygroup' \
  -H 'Content-Type: application/json' \
  -d '{
    "ConnectionName": "aws-config01",
    "ReqInfo": {
      "Name": "sg-web",
      "VPCName": "vpc-01",
      "SecurityRules": [
        {
          "Direction": "inbound",
          "IPProtocol": "TCP",
          "FromPort": "22",
          "ToPort": "22",
          "CIDR": "0.0.0.0/0"
        },
        {
          "Direction": "inbound",
          "IPProtocol": "TCP",
          "FromPort": "80",
          "ToPort": "80",
          "CIDR": "0.0.0.0/0"
        },
        {
          "Direction": "inbound",
          "IPProtocol": "TCP",
          "FromPort": "443",
          "ToPort": "443",
          "CIDR": "0.0.0.0/0"
        },
        {
          "Direction": "outbound",
          "IPProtocol": "ALL",
          "FromPort": "-1",
          "ToPort": "-1",
          "CIDR": "0.0.0.0/0"
        }
      ]
    }
  }' | jq

응답 예시:

{
  "IId": {
    "NameId": "sg-web",
    "SystemId": "sg-0a1b2c3d4e5f67890"
  },
  "VpcIID": {
    "NameId": "vpc-01",
    "SystemId": "vpc-1a2b3c4d"
  },
  "SecurityRules": [
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "22",
      "ToPort": "22",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "80",
      "ToPort": "80",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "443",
      "ToPort": "443",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "outbound",
      "IPProtocol": "ALL",
      "FromPort": "-1",
      "ToPort": "-1",
      "CIDR": "0.0.0.0/0"
    }
  ],
  "KeyValueList": [
    {
      "Key": "GroupId",
      "Value": "sg-0a1b2c3d4e5f67890"
    },
    {
      "Key": "GroupName",
      "Value": "sg-web"
    }
  ]
}

3.2 Security Group 조회 예시

  • AWS sg-web Security Group 정보 호출 API 및 제공 정보 예시가 다음과 같다.
curl -sX 'GET' 'http://localhost:1024/spider/securitygroup/sg-web?ConnectionName=aws-config01' | jq

응답 예시:

{
  "IId": {
    "NameId": "sg-web",
    "SystemId": "sg-0a1b2c3d4e5f67890"
  },
  "VpcIID": {
    "NameId": "vpc-01",
    "SystemId": "vpc-1a2b3c4d"
  },
  "SecurityRules": [
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "22",
      "ToPort": "22",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "80",
      "ToPort": "80",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "443",
      "ToPort": "443",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "outbound",
      "IPProtocol": "ALL",
      "FromPort": "-1",
      "ToPort": "-1",
      "CIDR": "0.0.0.0/0"
    }
  ]
}

3.3 Security Group 목록 조회 예시

curl -sX 'GET' 'http://localhost:1024/spider/securitygroup?ConnectionName=aws-config01' | jq

응답 예시:

{
  "securitygroup": [
    {
      "IId": {
        "NameId": "sg-web",
        "SystemId": "sg-0a1b2c3d4e5f67890"
      },
      "VpcIID": {
        "NameId": "vpc-01",
        "SystemId": "vpc-1a2b3c4d"
      },
      "SecurityRules": [...]
    },
    {
      "IId": {
        "NameId": "sg-db",
        "SystemId": "sg-1b2c3d4e5f678901"
      },
      "VpcIID": {
        "NameId": "vpc-01",
        "SystemId": "vpc-1a2b3c4d"
      },
      "SecurityRules": [...]
    }
  ]
}

3.4 VPC별 Security Group 목록 조회 예시

curl -sX 'GET' 'http://localhost:1024/spider/securitygroup/vpc/vpc-01?ConnectionName=aws-config01' | jq

응답 예시:

{
  "securitygroup": [
    {
      "IId": {
        "NameId": "sg-web",
        "SystemId": "sg-0a1b2c3d4e5f67890"
      },
      "VpcIID": {
        "NameId": "vpc-01",
        "SystemId": "vpc-1a2b3c4d"
      },
      "SecurityRules": [...]
    }
  ]
}

3.5 Security Rules 추가 예시

  • 기존 Security Group에 새로운 Rule을 추가하는 API 호출 예시가 다음과 같다.
curl -sX 'POST' 'http://localhost:1024/spider/securitygroup/sg-web/rules' \
  -H 'Content-Type: application/json' \
  -d '{
    "ConnectionName": "aws-config01",
    "ReqInfo": {
      "RuleInfoList": [
        {
          "Direction": "inbound",
          "IPProtocol": "TCP",
          "FromPort": "3306",
          "ToPort": "3306",
          "CIDR": "10.0.0.0/16"
        },
        {
          "Direction": "inbound",
          "IPProtocol": "ICMP",
          "FromPort": "-1",
          "ToPort": "-1",
          "CIDR": "0.0.0.0/0"
        }
      ]
    }
  }' | jq

응답 예시:

{
  "IId": {
    "NameId": "sg-web",
    "SystemId": "sg-0a1b2c3d4e5f67890"
  },
  "VpcIID": {
    "NameId": "vpc-01",
    "SystemId": "vpc-1a2b3c4d"
  },
  "SecurityRules": [
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "22",
      "ToPort": "22",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "80",
      "ToPort": "80",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "443",
      "ToPort": "443",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "inbound",
      "IPProtocol": "TCP",
      "FromPort": "3306",
      "ToPort": "3306",
      "CIDR": "10.0.0.0/16"
    },
    {
      "Direction": "inbound",
      "IPProtocol": "ICMP",
      "FromPort": "-1",
      "ToPort": "-1",
      "CIDR": "0.0.0.0/0"
    },
    {
      "Direction": "outbound",
      "IPProtocol": "ALL",
      "FromPort": "-1",
      "ToPort": "-1",
      "CIDR": "0.0.0.0/0"
    }
  ]
}

3.6 Security Rules 삭제 예시

curl -sX 'DELETE' 'http://localhost:1024/spider/securitygroup/sg-web/rules' \
  -H 'Content-Type: application/json' \
  -d '{
    "ConnectionName": "aws-config01",
    "ReqInfo": {
      "RuleInfoList": [
        {
          "Direction": "inbound",
          "IPProtocol": "TCP",
          "FromPort": "3306",
          "ToPort": "3306",
          "CIDR": "10.0.0.0/16"
        }
      ]
    }
  }' | jq

응답 예시:

{
  "Result": "true"
}

3.7 Security Group 삭제 예시

curl -sX 'DELETE' 'http://localhost:1024/spider/securitygroup/sg-web' \
  -H 'Content-Type: application/json' \
  -d '{
    "ConnectionName": "aws-config01"
  }' | jq

응답 예시:

{
  "Result": "true"
}

3.8 강제 삭제 (force) 예시

  • VM 등이 연결된 Security Group을 강제 삭제할 경우 force=true 옵션을 사용한다.
curl -sX 'DELETE' 'http://localhost:1024/spider/securitygroup/sg-web?force=true' \
  -H 'Content-Type: application/json' \
  -d '{
    "ConnectionName": "aws-config01"
  }' | jq

4. CB-Spider Security Group AdminWeb 제공 예시

  • 다음 순서로 대상 CSP 선택 및 Security Group 정보를 관리한다.

    1. Connection 선택: AdminWeb 상단에서 대상 CSP Connection 선택
    2. Security Group 메뉴 접근: 좌측 메뉴에서 "Security Group" 선택
    3. Security Group 생성: "Create SecurityGroup" 버튼 클릭 후 필요한 정보 입력
    4. Security Rules 관리: Security Group 상세 화면에서 Rules 추가/삭제 가능

4.1 Security Group 목록 화면 예시

AdminWeb에서 Security Group 목록을 조회하면 다음과 같은 정보가 표시된다:

  • Security Group Name
  • Security Group SystemId (CSP ID)
  • VPC Name
  • Rules 개수
  • 생성 시간
  • 작업 버튼 (상세보기, 삭제 등)

4.2 Security Group 생성 화면 예시

AdminWeb에서 Security Group 생성 시 다음 정보를 입력한다:

  • Security Group Name: CB-Spider에서 관리할 Security Group 이름
  • VPC Name: Security Group이 소속될 VPC
  • Security Rules (1개 이상 권장):
    • Direction (inbound/outbound)
    • Protocol (ALL/TCP/UDP/ICMP)
    • Port Range (FromPort ~ ToPort)
    • CIDR (IP 주소 범위)
    • Tags (선택)

4.3 Security Group 상세 화면 예시

Security Group 상세 화면에서는 다음 정보와 작업이 가능하다:

기본 정보:

  • Security Group IId (NameId, SystemId)
  • VPC IId (NameId, SystemId)
  • KeyValueList (CSP 추가 정보)

Security Rules 관리:

  • Security Rules 목록 표시
  • Add Rules 버튼: 새 Rule 추가
  • Remove Rules 버튼: 개별 Rule 삭제
  • Rule 상세 정보 보기 (Direction, Protocol, Port, CIDR)

작업 버튼:

  • Delete SecurityGroup: Security Group 삭제
  • Refresh: 정보 갱신

5. 주요 사용 시나리오

5.1 웹 서버용 Security Group 구성

  1. Security Group 생성 (Create SecurityGroup)
  2. Inbound Rules 추가:
    • SSH: TCP 22 from 관리자 IP
    • HTTP: TCP 80 from 0.0.0.0/0
    • HTTPS: TCP 443 from 0.0.0.0/0
  3. Outbound Rules: ALL -1 to 0.0.0.0/0 (기본)
  4. VM 생성 시 해당 Security Group 지정

5.2 데이터베이스 서버용 Security Group 구성

  1. Security Group 생성
  2. Inbound Rules 추가:
    • MySQL: TCP 3306 from 애플리케이션 서버 CIDR (예: 10.0.1.0/24)
    • SSH: TCP 22 from 관리자 IP
  3. Outbound Rules: 필요 시 제한적으로 설정
  4. DB 서버 VM에 해당 Security Group 적용

5.3 기존 CSP Security Group 연동

  1. CSP에 이미 존재하는 Security Group의 정보 확인 (SystemId)
  2. Register SecurityGroup API를 통해 CB-Spider에 등록
  3. CB-Spider에서 해당 Security Group 관리 및 Rules 추가/삭제 가능

5.4 Multi-Tier 아키텍처 구성

  1. Web Tier Security Group:

    • Inbound: TCP 80, 443 from Internet
    • Outbound: TCP 3000 to App Tier CIDR
  2. App Tier Security Group:

    • Inbound: TCP 3000 from Web Tier CIDR
    • Outbound: TCP 3306 to DB Tier CIDR
  3. DB Tier Security Group:

    • Inbound: TCP 3306 from App Tier CIDR
    • Outbound: 최소 권한

6. 주의사항 및 제약사항

6.1 Security Rules 설정 주의사항

  • CIDR 설정: 0.0.0.0/0은 모든 IP를 허용하므로 보안상 주의 필요
  • 포트 범위: FromPort ≤ ToPort 관계 유지 필요
  • 프로토콜별 포트 설정:
    • TCP/UDP: 1~65535 범위 사용
    • ICMP/ALL: -1 사용 (포트 개념 없음)
  • 중복 규칙: 동일한 규칙 중복 추가 시 CSP별로 동작이 다를 수 있음

6.2 Security Group 삭제

  • VM이 연결된 Security Group은 삭제 불가
  • 강제 삭제(force=true) 시 연결된 VM의 Security Group 설정이 변경될 수 있음 (주의!)
  • Default Security Group은 삭제 불가 (CSP 정책)

6.3 Security Rules 변경 효과 시간

  • AddRules()/RemoveRules() 호출 후 실제 효과가 나타나는 시간:
    • 일반적: 7~10초
    • Azure: 60~80초 (긴 대기 시간 필요)
  • 규칙 변경 후 즉시 테스트하면 이전 규칙이 적용될 수 있으므로 충분한 대기 필요

6.4 프로토콜 및 포트 관련

  • ALL 프로토콜: 모든 트래픽을 의미하며, 포트는 -1로 설정
  • ICMP 프로토콜: 네트워크 계층 프로토콜로 포트 개념이 없음, -1로 설정

7. 참고 자료

Table of contents




Clone this wiki locally