NOVA (Reverse Tunnel) Setup Guide for AWS

NOVA (Reverse Tunnel) Setup Guide for AWS

image-20250617-142040.png

Overview

이 문서는 AWS Cloud 의 논리적 망분리 환경 (e.g. AWS Account, VPC 네트워크의 세분화) 에서 보안이 강화된 접근 제어를 제공하기 위한 Reverse Tunnel 구현 방식에 대해 설명합니다.

기능 구현을 위해 AWS와 QueryPie 로 부터 각각 아래의 서비스를 활용합니다.

  • AWS PrivateLink:

    • QueryPie 와 같은 내부 서비스에 대해 인터넷 연결 없이 AWS 네트워크 내부에서 비공개 액세스를 제공하는 기술입니다.

    • VPC에서 인터넷 게이트웨이를 제거하여 외부와의 직접적인 연결을 차단합니다.

  • QueryPie NOVAC, NOVAS:

    • NOVAC (NOVA Client): 접속 대상 리소스들이 존재하는 VPC 내에 설치 되는 Agent Instance 입니다. 접속 대상 리소스들을 외부에서 직접 접근하지 않고, NOVAC → NOVAS 단방향 통신으로 생성한 터널을 통해서만 접근합니다.

    • NOVAS (NOVA Server): NOVAC가 PrivateLink 를 단방향 통신으로 경유하여 세션을 맺는 QueryPie Server 입니다. 사용자는 해당 세션을 통해 QueryPie NOVAS → NOVAC 구간으로 대상 리소스들에 접근합니다.

이하 절차는 QueryPie instance 가 설치된 계정 (이하 Security Account) 에서 동기화 대상 리소스가 존재하는 계정 (이하 Workloads Account) 으로 접근하기 위한 구성 절차를 안내합니다.

이 문서에서는 VPC간 연결을 위해 PrivateLink를 구성하였으나, 핵심은 NOVAS ↔ NOVAC 가 서로 통신할 수 있는 구성이어야 한다는 것 입니다.

따라서 고객사 환경이 PrivateLink가 아닌 VPN, VPC Peering, Transit Gateway 와 같이 서로 다른 Zone 을 연결하는 구성의 경우, 아래 1, 2, 3.1 항목은 생략하십시오.


1. Security Account: QueryPie instance를 보유한 계정에서의 수행 작업

Endpoint services 생성

  • VPC → PrivateLink and Lattice → Endpoint services → Create endpoint service

  • Endpoint service settings

    • Name tag - optional : On-demand

    • Load balancer type : Network

  • Available load balancers

    • Security Account 의 Network Load balancer 선택

  • Details of selected load balancers : Default

  • Additional settings

    • Require acceptance for endpoint : On-demand

2. Workloads Account: 리소스를 보유한 계정에서의 수행 작업

Interface Endpoint (PrivateLink) 생성

  • VPC → PrivateLink and Lattice → Endpoints → Create endpoint

  • Endpoint settings

    • Name tag - optional : On-demand

    • Type : Endpoint services that use NLBs and GWLBs

  • Service settings

    • Service Name = Security Account 에서 생성한 Endpoint service 의 식별자 (e.g. com.amazonaws.vpce.us-east-1.vpce-svc-0e123abc123198abc)

  • Network settings

    • VPC : 리소스를 보유한 VPC 선택

    • Additional settings

      • DNS name : Enable DNS name

      • DNS record IP type : IPv4

  • Subnets

    • 리소스를 보유한 (Private) Subnets 선택

    • IP address type : IPv4

  • Security groups : Interface Endpoint 접근을 위한 Workloads Account 의 주소 대역이 포함된 SG를 선택

  • Tags : On-demand

인터페이스 엔드포인트는 ping 요청에 응답하지 않습니다. 대신 nc 또는 nmap 명령을 사용할 수 있습니다.

3. Security Account: QueryPie instance를 보유한 계정에서의 추가 수행 작업

3.1. (Optional) 요청받은 Endpoint connection 에 대한 수락 진행

  • VPC → PrivateLink and Lattice → Endpoint services → 1. 에서 생성한 Endpoint service 선택

  • Endpoint connections → Actions → Accept endpoint connection request

3.2. QueryPie instance 에서 NOVAS Listening Port 활성화

NOVAS 로 운용될 QueryPie instances의 Listening Port를 활성화 합니다.

아래 추가되는 환경변수 및 설정 절차 대해 설명합니다.

NOVAS_AGENT_PORT: NOVAC → NOVAS Reverse Tunnel 에 사용되는 Port (default: 9022)

NOVAS_AGENT_TOKEN: NOVAC → NOVAS 간 인증에 사용되는 TOKEN

  • 아래와 같이 docker-compose.yml 내 querypie(app) 내 NOVA 전용 ports, environment 를 추가.

    ... (생략) ... app: profiles: - querypie image: harbor.chequer.io/querypie/querypie:${VERSION:?ex. 10.2.1} ... (생략) ... ports: - ${NOVAS_AGENT_PORT}:${NOVAS_AGENT_PORT} environment: # NOVA Server - NOVAS_AGENT_PORT=${NOVAS_AGENT_PORT:-9022} - NOVAS_AGENT_TOKEN=${NOVAS_AGENT_TOKEN:?ex. e1134c60-d28f-4773-ade8-5001b412f778}
  • compose-env 내 환경 변수 및 아래 예시의 값을 추가

    # NOVAS NOVAS_AGENT_PORT=9022 NOVAS_AGENT_TOKEN=e1134c60-d28f-4773-ade8-5001b412f778

4. Workloads Account: NOVAC 설치 대상 instance 에서의 수행 작업

아래 추가되는 환경변수 및 NOVAC 배포 환경에 따른 설정 절차 대해 설명합니다.

NOVAC_SERVER:

  • NOVAC → NOVAS 접속에 사용되는 HOST:PORT 주소

  • 복수의 NOVAS 로의 접속이 필요한 경우, 필요한 수 만큼 “,” 로 구분하여 입력

NOVAC_TOKEN: NOVAC → NOVAS 간 인증에 사용되는 TOKEN

NOVAC_NAME: 생성되는 NOVAC 리소스 이름 입력

NOVAC_TAGS: Reverse Tunnel 통신에 사용될 리소스의 Tag 정보 입력

4.1. (Case 1) EC2 Instances

  • novac-compose.yml 생성

    version: '3.8' name: querypie-novac services: novac: container_name: querypie-novac profiles: - novac image: harbor.chequer.io/querypie/novac:11.0.0 # <- 버전 업그레이드 시 변경 필요 restart: always environment: - NOVAC_SERVER=example-novac-1.querypie.com:9022,example-novac-2.querypie.com:9022 # 수정이 필요합니다. - NOVAC_TOKEN=e1134c60-d28f-4773-ade8-5001b412f778 # 수정이 필요합니다. - NOVAC_NAME=example_novac1 # 수정이 필요합니다. - NOVAC_TAGS=VPC=dev_infra;Env=Production # 수정이 필요합니다.
  • NOVAC Container 배포

    docker-compose -f novac-compose.yml --profile novac up -d

4.2. (Case 2) kubernetes

  • novac-deployment.yaml 생성

    apiVersion: apps/v1 kind: Deployment metadata: name: querypie-novac spec: selector: matchLabels: app: querypie-novac replicas: 1 # 단일로 고정 template: metadata: labels: app: querypie-novac imagePullSecrets: - name: querypie-regcred # <- 버전 업그레이드 시 적용 필요 spec: containers: - name: novac image: harbor.chequer.io/querypie/novac:11.0.0 # <- 버전 업그레이드 시 변경 필요 resources: limits: memory: "512Mi" cpu: "500m" env: - name: NOVAC_SERVER value: example-novac-1.querypie.com:9022,example-novac-2.querypie.com:9022 # 수정이 필요합니다. - name: NOVAC_NAME value: example_novac # 수정이 필요합니다. - name: NOVAC_TAGS value: VPC=dev_infra;Env=Production # 수정이 필요합니다. - name: NOVAC_TOKEN value: e1134c60-d28f-4773-ade8-5001b412f778 # 수정이 필요합니다.
  • NOVAC Deployment 배포

    kubectl apply -f novac-deployment.yaml

4.3. (Case 3) kubernetes NOVAC HA 구성

  • (Case 2) 와 다르게 NOVAC 의 replica 가 NOVAS 에 등록될 때 서로 다른 이름을 가지게 합니다. 현재 NOVAC 의 이름은 pod 이름과 동일하게 제공하고 있습니다. 따라서 여러 클러스터를 운영하는 경우 각 클러스터 별로 deployment 이름을 변경하시길 안내 드립니다.

  • novac-deployment.yaml 생성

    apiVersion: apps/v1 kind: Deployment metadata: name: querypie-novac # 해당 이름을 prefix 로 pod 이름이 만들어지며, NOVAC_NAME 으로 사용됩니다. spec: selector: matchLabels: app: querypie-novac replicas: 2 # 이중화가 필요한 만큼 설정. 최소 2로 설정이 필요함. template: metadata: labels: app: querypie-novac imagePullSecrets: - name: querypie-regcred # <- 버전 업그레이드 시 적용 필요 spec: containers: - name: novac image: harbor.chequer.io/querypie/novac:11.0.0 # <- 버전 업그레이드 시 변경 필요 resources: limits: memory: "512Mi" cpu: "500m" env: - name: NOVAC_SERVER value: example-novac-1.querypie.com:9022,example-novac-2.querypie.com:9022 # 접속이 필요한 서버 목록 - name: NOVAC_NAME # Pod 의 Name 으로 설정합니다. valueFrom: fieldRef: fieldPath: metadata.name - name: NOVAC_TAGS value: VPC=dev_infra;Env=Production # 수정이 필요합니다. - name: NOVAC_TOKEN value: e1134c60-d28f-4773-ade8-5001b412f778 # 수정이 필요합니다. topologySpreadConstraints: # 각 NOVAC 를 서로 다른 Node 에서 실행할 수 있도록 설정합니다. - maxSkew: 1 # 각 토폴로지 도메인(hostname) 간 Pod 수의 최대 편차. 1은 가장 균등하게 분산 topologyKey: "kubernetes.io/hostname" # 이 호스트네임을 기준으로 분산 whenUnsatisfiable: DoNotSchedule # 제약을 만족할 수 없으면 스케줄링하지 않음 (하드 제약) # whenUnsatisfiable: ScheduleAnyway # 제약을 만족하지 못해도 스케줄링함 (소프트 제약) labelSelector: matchLabels: app: querypie-novac # 이 레이블을 가진 Pod들을 분산
  • NOVAC Deployment 배포

    kubectl apply -f novac-deployment.yaml

5. Security Account: Reverse Tunnels 등록 확인

  • QueryPie → Admin Pages → Audit → General → Reverse Tunnels

image-20250617-142018.png