-
Notifications
You must be signed in to change notification settings - Fork 50
Security Group Rules and Driver API
ByoungSeob Kim edited this page Apr 1, 2022
·
47 revisions
-
Data Structure
type SecurityRuleInfo struct { Direction string IPProtocol string FromPort string ToPort string CIDR string }
-
Rules Spec (CSP common spec)
Direction IPProtocol FromPort ToPort CIDR Block (source or destination) 비고 inbound, outbound ALL -1 -1 IPv4 ex) 0.0.0.0/0
IPv6 ex) ::/0* ALL: All traffic
* -1: 보안 측면에서 명시적인 입력을 요함inbound, outbound TCP 1~65535
ex) 4431~65535
ex) 443IPv4 ex) 0.0.0.0/8
IPv6 ex) ::/8inbound, outbound UDP 1~65535
ex) 60001~65535
ex) 8000IPv4 ex) 0.0.0.0/32
IPv6 ex) ::/32inbound, outbound ICMP -1 -1 IPv4 ex) 1.2.3.4/32
IPv6 ex) ::/64* ICMP: network layer
- Port 지정 불필요
* ICMP 세부 타입 설정 미제공
- ICMP 예시: ping, echo, tracert 등
* -1: 보안 측면에서 명시적인 입력을 요함 -
Default Rule: Security Group 생성시 사용자가 추가 설정하지 않아도 다음처럼 자동 설정
- inbound default rule: no (All traffic 차단)
- outbound default rule: ALL -1 -1 0.0.0.0/0 (All traffic 허용)
- 생성한 Security Group에 Rule 추가/삭제 기능 추가
- AddRules(), RemoveRules() API 추가
type SecurityReqInfo struct {
IId IID // {NameId, SystemId}
VpcIID IID // {NameId, SystemId}
Direction string // To be deprecated
SecurityRules *[]SecurityRuleInfo
}
type SecurityRuleInfo struct {
Direction string
IPProtocol string
FromPort string
ToPort string
CIDR string
}
type SecurityInfo struct {
IId IID // {NameId, SystemId}
VpcIID IID // {NameId, SystemId}
Direction string // To be deprecated
SecurityRules *[]SecurityRuleInfo
KeyValueList []KeyValue
}
type SecurityHandler interface {
CreateSecurity(securityReqInfo SecurityReqInfo) (SecurityInfo, error)
ListSecurity() ([]*SecurityInfo, error)
GetSecurity(securityIID IID) (SecurityInfo, error)
DeleteSecurity(securityIID IID) (bool, error)
}
type SecurityReqInfo struct {
IId IID // {NameId, SystemId}
VpcIID IID // {NameId, SystemId}
//Direction string // To be deprecated <=== Deleted
SecurityRules *[]SecurityRuleInfo
}
type SecurityRuleInfo struct {
Direction string
IPProtocol string
FromPort string
ToPort string
CIDR string
}
type SecurityInfo struct {
IId IID // {NameId, SystemId}
VpcIID IID // {NameId, SystemId}
//Direction string // To be deprecated <=== Deleted
SecurityRules *[]SecurityRuleInfo
KeyValueList []KeyValue
}
type SecurityHandler interface {
CreateSecurity(securityReqInfo SecurityReqInfo) (SecurityInfo, error)
ListSecurity() ([]*SecurityInfo, error)
GetSecurity(securityIID IID) (SecurityInfo, error)
DeleteSecurity(securityIID IID) (bool, error)
AddRules(sgIID IID, securityRules *[]SecurityRulesInfo) (SecurityInfo, error) <==== Added
RemoveRules(sgIID IID, securityRules *[]SecurityRulesInfo) (bool, error) <==== Added
}
-
SecurityReqInfo.Direction
과SecurityInfo.Direction
삭제 예정- AdminWeb, Test, Driver/Test, Tumblebug/Test 등 반영 작업 전파 필요
-
CSP와 Spider의 'ALL', '-1' 의미가 다를 경우 Spider 의미로 변환하여 입출력 필요
-
AddRules()/RemoveRules() Driver 구현시 고려 사항
- Spider Rules는 ID가 존재 하지 않음
- 대부분의 CSP Rule은 ID로 관리 되고 있음
- (1) Driver 내부에서 Rule's ID 생성 및 처리 필요 <=========== (1)
- Rule ID's Max Length 초과하지 않도록 고려 필요
- (2) AddRules() 시 Rule 중복 체크 <=========== (2)
- CSP 포맷 또는 구조체로 변환 후 CSP에 던진 후 반환 결과로 확인
- (3) RemoveRules()시 대상 Rule 찾기 <=========== (3)
- CSP 포맷 또는 구조체로 변환 후 SecurityRuleInfo의 모든 속성 값을 비교
- GCP: SG(firewall) 정의시 2개 이상의 Rule 포함시 잠재적 오류 발생 가능
- AWS: CIDR 값 검증 관련 이슈
-
시험용 Security Group으로 생성된 대상 VM을 향한 Test
-
CASE-1: default inbound test
- Test Command
nc -w 2 -zv {$VM_IP} 22
- Expected Results
Connection to {$VM_IP} port [tcp/http] succeeded!
- Test Command
-
WIP
-
이후 생성된 대상 VM에 로그인 후 Test
-
CASE-1: default outbound test
- Test Command
nc -w 2 -zv 142.250.190.99 80
- Expected Results
Connection to 142.250.190.99 80 port [tcp/http] succeeded!
- Test Command
-
CASE-2: remove default outbound test
- 설정: remove default rule (outbound TCP 80 80 0.0.0.0/0)
- Test Command
nc -w 2 -zv 142.250.190.99 80
- Expected Results
nc: connect to 142.250.190.99 port 80 (tcp) timed out: Operation now in progress
-
CASE-3: add outbound 80 port test
- 설정: add rule (outbound TCP 80 80 0.0.0.0/0)
- Test Command
nc -w 2 -zv 142.250.190.99 80
- Expected Results
Connection to 142.250.190.99 80 port [tcp/http] succeeded!
-
Install & Start Guide
-
Features & Usage
-
- AdminWeb Tool Guide
- CLI Tool Guide
- REST API Guide
- NLI Guide
-
Design
-
Developer Guide
-
Cloud Driver Developer Guide
- Cloud Driver Developer Guide-WIP
- VM SSH Key Development Guide-WIP
- VM User Development Guide
- What is the CSP SDK API Version of drivers
- Region Zone Info and Driver API
- (StartVM TerminateVM) API Call Counts and Waiting
- StartVM and TerminateVM Main Flow of drivers
- VM Root Disk Configuration Guide
- Security Group Rules and Driver API
- Network Load Balancer and Driver API
- VM Snapshot, MyImage and Disk Overview
- Kubernetes and Driver API(PMKS, K8S)
- Tag and Cloud Driver API
- AnyCall API Extension Guide
-
Test Reports
- v0.2.8-for-espresso-release
- v0.3.0-espresso-release
- Azure:Terminating VM
- cb-user@VM: ssh login, sudo run
- v0.3.14 test for SG Source
- v0.4.0-cafemocha-release
- Test via REST API Gateway
- Test Reports of v0.4.11 (IID2 initial Version)
- Test Reports of v0.4.12 (Register & Unregister existing Resources)
- Test Reports for v0.6.0 Release
- How to ...
- How to Use Alibaba ECS i1.* Instance Types
- How to provision GPU VMs
- How to Resolve the 'Failed to Connect to Database' Error
- How to test CB Spider with Mock Driver
- How to install CB Spider on WSL2 under 공유기/사설망
- How to install CB Spider on macOS
- How to run CB Spider Container on macOS
- How to install OpenStack on a VM for CB Spider Testing
- How to get Azure available Regions
- How to profile memory usage in Golang
- Deprecated:How to install protoc and plugins
- [For Cloud-Migrator]