목차/11. CLI·스크립트·API 참조

11CLI·스크립트·API 참조CLI·스크립트·API 참조

ClusterXL을 명령줄(CLI)·셸 스크립트·관리 API로 다루는 방법을 한곳에 모았습니다. 이 장은 클러스터를 구성·진단·자동화할 때 쓰는 모든 명령과 파라미터, 그리고 실제로 동작하는 스크립트의 본문과 API 요청 예제까지 빠짐없이 풀어 둡니다. 앞 장에서 개념으로만 만났던 cphaprob·cphaconf·clusterXL_admin 같은 도구가 정확히 어떤 옵션을 받고 무엇을 하는지를 여기서 끝까지 확인할 수 있습니다.

읽기 전에 구문 표기 약속 을 먼저 익혀 두면 표를 정확히 읽을 수 있습니다. Check Point 문서 전체가 이 규칙을 따릅니다.

표기
중괄호 { }세로줄 `\`로 구분된 후보 목록입니다. 이 중 하나만 고를 수 있습니다.
꺾쇠 < >변수입니다. 사용자가 지원되는 실제 값을 직접 지정 해야 합니다.
대괄호 [ ]선택적(optional) 명령·파라미터입니다. 넣어도 되고 안 넣어도 됩니다.

명령줄 참조 (CLI)

ClusterXL 명령은 크게 구성(Configuration) 명령모니터링(Monitoring) 명령 으로 나뉩니다. 둘 다 Gaia Clish에서 쓰는 형태와 Expert mode에서 쓰는 형태가 짝을 이루며, 대개 같은 일을 합니다.

ClusterXL 구성 명령

구성 명령은 클러스터링 메커니즘의 내부 동작을 바꾸는 명령들입니다.

사용 가능한 명령을 직접 둘러보는 방법은 환경에 따라 다릅니다.

  • Gaia Clish 에서는 set cluster<ESC><ESC> 를 입력하면 가능한 명령이 모두 펼쳐집니다.
  • Expert mode 에서는 cphaconf 를 실행하면 전체 명령이 보입니다. cphaconf 명령은 Expert mode에서만 실행할 수 있습니다.

아래 표는 Gaia Clish 명령과 그에 대응하는 Expert mode cphaconf 명령을 나란히 정리한 것입니다.

하는 일Gaia Clish 명령Expert mode 명령
로컬 ClusterXL 로그에 멤버를 ID로 표시할지 이름으로 표시할지 설정`set cluster member idmode {id \name}``cphaconf mem_id_mode {id \name}`
멤버에 Critical Device(Pnote) 하나를 등록N / A`cphaconf set_pnote -d <Name of Device> -t <Timeout in Sec> -s {ok\init\problem} [-p] [-g] register`
멤버에서 Critical Device 하나를 등록 해제N / Acphaconf set_pnote -d <Name of Device> [-p] [-g] unregister
Critical Device 하나의 상태를 보고(변경)N / A`cphaconf set_pnote -d <Name of Device> -s {ok\init\problem} [-g] report`
파일에 적힌 여러 Critical Device를 한 번에 등록N / Acphaconf set_pnote -f <Name of File> [-g] register
모든 Critical Device를 등록 해제N / Acphaconf set_pnote -a [-g] unregister
CCP(Cluster Control Protocol) 암호화 설정`set cluster member ccpenc {off \on}``cphaconf ccp_encrypt {off \on} / cphaconf ccp_encrypt_key <Key String>`
Cluster Forwarding Layer 설정(멤버 간 트래픽 전달 제어)`set cluster member forwarding {off \on}``cphaconf forward {off \on}`
커널에 적재된 현재 클러스터 구성 출력 (sk93306)N / Acphaconf debug_data
Bond 인터페이스 하위(subordinate) 인터페이스 간 내부 페일오버 시작 — Bond High Availability 모드에서만 (sk93306)N / Acphaconf failover_bond <bond_name>
Bond가 내부 페일오버한 뒤의 동작을 설정 (sk93306)N / Acphaconf enable_bond_failover <bond_name>
수동 클러스터 페일오버 시작`set cluster member admin {down \up}``clusterXL_admin {down \up}`
Bond Load Sharing에 필요한 최소 하위 인터페이스 수 설정set interface <Bond Name> links <Value>`cphaconf bond_ls {set <Bond Name> <Value> \remove <Bond Name>}`
Multi-Version Cluster(MVC) 메커니즘 설정N / A`cphaconf mvc {off \on}`

`set cluster member` 명령 모음

Gaia Clish에서 멤버 단위로 쓰는 set cluster member 명령은 다음과 같이 정리됩니다. admin 명령에는 [permanent] 를 붙일 수 있어, 재부팅 후에도 down/up 상태가 유지되도록 만들 수 있습니다.

set cluster member admin {down | up} [permanent]
set cluster member ccpenc {off | on}
set cluster member forwarding {off | on}
set cluster member idmode {id | name}
set cluster member mvc {off | on}

Expert mode `cphaconf` 명령 모음

cphaconf [-D] <options> start
cphaconf stop
cphaconf [-t <Sync IF 1>...] [-d <Non-Monitored IF 1>...] add
cphaconf clear-secured
cphaconf clear-non-monitored
cphaconf debug_data
cphaconf delete_link_local [-vs <VSID>] <IF name>
cphaconf set_link_local [-vs <VSID>] <IF name> <Cluster IP>
cphaconf mem_id_mode {id | name}
cphaconf failover_bond <bond_name>
cphaconf [-s] {set | unset | get} var <Kernel Parameter Name> [<Value>]
cphaconf bond_ls {set <Bond Name> <Value> | remove <Bond Name>}
cphaconf set_pnote -d <Device> -t <Timeout in sec> -s {ok | init | problem} [-p] [-g] register
cphaconf set_pnote -f <File> [-g] register
cphaconf set_pnote -d <Device> [-p] [-g] unregister
cphaconf set_pnote -a [-g] unregister
cphaconf set_pnote -d <Device> -s {ok | init | problem} [-g] report
cphaconf ccp_encrypt {off | on}
cphaconf ccp_encrypt_key <Key String>

여기서 자주 등장하는 set_pnote의 파라미터 의미를 짚어 두면 스크립트를 읽을 때 도움이 됩니다.

파라미터
-d <Device>대상 Critical Device(Pnote)의 이름 을 지정합니다.
-f <File>Critical Device 목록이 담긴 파일 을 지정합니다.
-t <Timeout in sec>상태 보고 타임아웃(초) 입니다. 0이면 타임아웃 없음(영구 등록)에 가깝게 동작합니다.
`-s {ok \init \problem}`보고할 상태 입니다. problem이면 멤버가 DOWN으로 내려갑니다.
-p재부팅 후에도 유지(persistent) 되도록 합니다.
-g전역(global) 적용 관련 플래그입니다.
-a모든 Critical Device를 대상으로 합니다(주로 unregister와 함께).
register / unregister / report각각 등록 / 등록 해제 / 상태 보고 동작입니다.

ClusterXL 모니터링 명령

모니터링 명령은 클러스터와 각 멤버가 제대로 동작하는지 확인하고, Critical Device를 정의 하는 데 씁니다. 여기서 Critical Device(= Problem Notification, 줄여서 pnote) 는 각 멤버에 있는 특수 소프트웨어 장치로, 클러스터 운영에 중요한 요소를 감시 합니다. 감시 대상이 제때 상태를 보고하지 못하거나 상태가 problem으로 보고되면, 그 멤버의 상태는 즉시 'Down'으로 바뀝니다.

사용 가능한 명령을 둘러보는 방법은 이렇습니다.

  • Gaia Clish 에서는 show cluster<ESC><ESC> 를 입력합니다.
  • Expert mode 에서는 cphaprob 를 실행합니다. cphaprob 명령은 Gaia Clish에서도 그대로 쓸 수 있습니다.
하는 일Gaia Clish 명령Expert mode 명령
멤버들의 상태와 이름 보기show cluster statecphaprob [-vs <VSID>] state
멤버의 Critical Device(Pnote)와 상태 보기`show cluster members pnotes {all \problem}`cphaprob [-l] [-ia] [-e] list
멤버의 클러스터 인터페이스 보기`show cluster members interfaces {all \secured \virtual \vlans}`cphaprob [-vs all] [-a] [-m] if
멤버의 Bond 구성 보기`show cluster bond {all \name <bond_name>}`cphaprob show_bond [<bond_name>]
멤버의 Bond 그룹 보기N / Acphaprob show_bond_groups
페일오버 통계 보기(및 초기화)`show cluster failover [reset {count \history}]``cphaprob [-reset {-c \-h}] [-l <count>] show_failover`
소프트웨어 버전(핫픽스 포함) 과 다른 멤버와의 일치/불일치 보기show cluster releasecphaprob release
Delta Sync 통계 보기show cluster statistics sync [reset]cphaprob [-reset] syncstat
Connections 테이블의 Delta Sync 통계 보기show cluster statistics transport [reset]cphaprob [-reset] ldstat
CCP 모드 보기show cluster members interfaces virtualcphaprob [-vs all] -a if
멤버의 IGMP 멤버십 보기show cluster members igmpcphaprob igmp
클러스터 고유 IP 테이블 보기show cluster members ips / show cluster members monitoredcphaprob tablestat / cphaprob -m tablestat
멤버 ID 모드(ID 기본 또는 이름) 보기show cluster members idmodecphaprob names
OSPF 구성 시 RouteD가 감시하는 인터페이스 보기show ospf interfaces [detailed]cphaprob routedifcs
멤버의 RouteD 데몬 역할(role) 보기show cluster rolescphaprob roles
Cluster Correction 통계 보기N / A`cphaprob [{-d \-f \-s}] corr`
CCP 모드 보기(CCP 설정)show cluster members interfaces virtualcphaprob -a if
CCP 암호화 설정 보기show cluster members ccpenccphaprob ccp_encrypt
Multi-Version Cluster 상태 보기show cluster members mvcN / A
Full Connectivity Upgrade 통계 보기N / Acphaprob fcustat

`show cluster` 명령 트리 (Gaia Clish)

Gaia Clish의 show cluster 명령은 다음과 같은 계층으로 펼쳐집니다. 들여쓰기는 하위 명령을 뜻합니다.

show cluster
      bond
            all
            name <Name of Bond>
      failover
      members
            ccpenc
            idmode
            igmp
            interfaces
                  all
                  secured
                  virtual
                  vlans
            ips
            monitored
            mvc
            pnotes
                  all
                  problem
      release
      roles
      state
      statistics
            sync [reset]
            transport [reset]

Expert mode `cphaprob` 명령 모음

cphaprob [-vs <VSID>] state
cphaprob [-reset {-c | -h}] [-l <count>] show_failover
cphaprob names
cphaprob [-reset] [-a] syncstat
cphaprob [-reset] ldstat
cphaprob [-l] [-i[a]] [-e] list
cphaprob [-vs all] [-a] [-m] if
cphaprob show_bond [<bond_name>]
cphaprob show_bond_groups
cphaprob igmp
cphaprob fcustat
cphaprob [-m] tablestat
cphaprob routedifcs
cphaprob roles
cphaprob release
cphaprob ccp_encrypt
cphaprob [{-d | -f | -s}] corr

cpconfig — Check Point 구성 도구

cpconfigCheck Point Configuration Tool 을 시작하는 명령으로, 설치된 Check Point 제품의 세부 설정을 다룹니다.

문법은 환경과 무관하게 단순합니다. Security Gateway / Cluster Member에서는 Gaia Clish나 Expert mode에서, Scalable Platform Security Group에서는 Gaia gClish나 Expert mode에서 다음을 실행합니다.

cpconfig

메뉴 옵션은 구성과 설치된 제품에 따라 달라집니다. 주요 항목은 다음과 같습니다.

메뉴 옵션설명
Licenses and contracts이 게이트웨이/멤버의 Check Point 라이선스와 계약을 관리합니다.
SNMP Extension더 이상 사용하지 않는(obsolete) 옵션 입니다. SNMP는 R82 Gaia Administration Guide의 SNMP 절을 보세요.
PKCS#11 TokenGaia OS가 쓸 암호화 토큰을 등록하고, 토큰 정보를 보고 기능을 테스트합니다.
Random PoolGaia OS가 쓸 RSA 키를 구성합니다.
Secure Internal Communication게이트웨이/멤버의 SIC를 관리합니다. Check Point 서비스 재시작이 필요 합니다(sk65764: SIC 재설정 방법).
Enable cluster membership for this gateway게이트웨이의 클러스터 멤버십을 활성화 합니다. 재부팅 필요. Scalable Platform(ElasticXL, Maestro, Chassis)에는 해당하지 않습니다.
Disable cluster membership for this gateway클러스터 멤버십을 비활성화 합니다. 재부팅 필요. Scalable Platform에는 해당하지 않습니다.
Enable Check Point Per Virtual System StateVSX Cluster Member에서 Virtual System Load Sharing을 활성화 합니다(R82 VSX Administration Guide). Scalable Platform 제외.
Disable Check Point Per Virtual System StateVirtual System Load Sharing을 비활성화 합니다. Scalable Platform 제외.
Enable Check Point ClusterXL for Bridge Active/StandbyBridge 모드용 ClusterXL을 활성화 합니다. 멤버 재부팅 필요. Scalable Platform 제외.
Disable Check Point ClusterXL for Bridge Active/StandbyBridge 모드용 ClusterXL을 비활성화 합니다. 멤버 재부팅 필요. Scalable Platform 제외.
Check Point CoreXLCoreXL과 Firewall 모드를 관리합니다. 변경 후 반드시 재부팅 해야 합니다(R82 Performance Tuning Administration Guide).
Automatic start of Check Point Products부팅 시 자동 시작할 제품을 보여 주고 제어합니다.
Exit구성 도구를 빠져나갑니다.

메뉴는 단독 게이트웨이냐 멤버냐에 따라 항목 구성이 달라집니다. 단독 게이트웨이에서는 멤버십을 켤 수 있는 옵션이 보이고, 이미 멤버인 장비에서는 멤버십을 끄는 옵션과 VSX·Bridge 관련 옵션이 추가로 나타납니다.

[Expert@MySingleGW:0]# cpconfig
This program will let you re-configure
your Check Point products configuration.
Configuration Options:
----------------------
(1) Licenses and contracts
(2) SNMP Extension
(3) PKCS#11 Token
(4) Random Pool
(5) Secure Internal Communication
(6) Enable cluster membership for this gateway
(7) Check Point CoreXL
(8) Automatic start of Check Point Products
(9) Exit
Enter your choice (1-9) :
[Expert@MyClusterMember:0]# cpconfig
This program will let you re-configure
your Check Point products configuration.
Configuration Options:
----------------------
(1) Licenses and contracts
(2) SNMP Extension
(3) PKCS#11 Token
(4) Random Pool
(5) Secure Internal Communication
(6) Disable cluster membership for this gateway
(7) Enable Check Point Per Virtual System State
(8) Enable Check Point ClusterXL for Bridge Active/Standby
(9) Check Point CoreXL
(10) Automatic start of Check Point Products
(11) Exit
Enter your choice (1-11) :

cphastart / cphastop — 클러스터 소프트웨어 시작·중지

cphastartcphastop으로 멈춰 둔 클러스터 구성을 다시 시작 하는 명령입니다.

[-h]
[-d]
파라미터설명
-h내장된 사용법(usage)을 보여 줍니다.
-d디버그 모드 로 실행합니다. 명령 자체의 문제를 해결할 때만 쓰세요.

cphastop멤버의 클러스터 소프트웨어를 멈추는 명령으로, 문법은 인자 없이 실행합니다.

cphastop

이 명령을 실행하면 그 멤버는 트래픽 통과를 멈추고, 다른 멤버와의 State Synchronization도 중단 됩니다. 다만 실행 이후에도 그 멤버로 직접 연결을 여는 것은 여전히 가능 합니다. 다시 시작하려면 cphastart를 실행합니다.

cp_conf fullha — Full High Availability 클러스터 관리

cp_conf fullhaFull High Availability 클러스터의 상태를 관리 합니다(활성화·비활성화·피어 삭제·상태 표시).

cp_conf fullha
      enable
      del_peer
      disable
      state
파라미터설명
enable이 장비에서 Full High Availability를 활성화 합니다.
del_peer구성에서 Full High Availability 피어를 삭제 합니다.
disable이 장비에서 Full High Availability를 비활성화 합니다.
state이 장비의 Full High Availability 상태를 표시 합니다.
[Expert@Cluster_Member:0]# cp_conf fullha state
FullHA is currently enabled
[Expert@Cluster_Member:0]#

cp_conf ha — 클러스터 멤버십 켜고 끄기

cp_conf ha 는 이 게이트웨이의 클러스터 멤버십을 활성화/비활성화 합니다.

cp_conf ha {enable | disable} [norestart]
파라미터설명
enable멤버십을 활성화 합니다(cpconfig 메뉴의 "Enable cluster membership for this gateway"와 동일).
disable멤버십을 비활성화 합니다(cpconfig 메뉴의 "Disable..."과 동일).
norestart선택. Check Point 서비스 재시작 없이 변경을 적용합니다. 새 구성은 재부팅 후에야 적용 됩니다.
[Expert@MyGW:0]# cp_conf ha enable norestart
Cluster membership for this gateway was enabled successfully
Important: This change will take effect after reboot.
[Expert@MyGW:0]#
[Expert@MyGW:0]# cp_conf ha disable norestart
cpwd_admin:
Process CPHAMCSET process has been already terminated
Cluster membership for this gateway was disabled successfully
Important: This change will take effect after reboot.
[Expert@MyGW:0]#

fw hastat — 구형 상태 확인 명령

fw hastat 는 High Availability 구성의 Check Point 장비들과 그 상태를 보여 줍니다.

fw hastat [<Target1>] [<Target2>] ... [<TargetN>]
파라미터설명
<Target1> ... <TargetN>조회할 Check Point 장비들입니다. 관리 서버에서 실행하면 관리 대상 게이트웨이/멤버의 IP 주소나 해석 가능한 HostName 을 넣습니다. 지정하지 않으면 로컬 장비 를 조회합니다.
[Expert@Member1:0]# fw hastat
HOST NUMBER HIGH AVAILABILITY STATE MACHINE STATUS
192.168.3.52 1 active OK
[Expert@Member1:0]#

fwboot ha_conf — 부팅 시 클러스터 메커니즘 구성

fwboot ha_conf부팅 과정에서 클러스터 메커니즘을 구성 합니다.

[Expert@HostName:0]# $FWDIR/boot/fwboot ha_conf

ClusterXL 스크립트

멤버의 상태를 바꾸는 특수 셸 스크립트 가 세 가지 있습니다. 모두 멤버에 기본 설치되어 있으며, 페일오버를 수동으로 일으키거나 특정 조건(호스트 응답·프로세스 생존)을 감시해 자동으로 페일오버를 유도하는 데 씁니다. 공통 원리는 Critical Device(pnote)를 등록해 그 상태를 problem/ok로 보고 함으로써 멤버를 DOWN/UP으로 만드는 것입니다.

clusterXL_admin 스크립트 — 수동 페일오버

clusterXL_admin멤버에서 수동 페일오버를 일으키는 스크립트입니다. 위치는 다음과 같습니다.

$FWDIR/bin/clusterXL_admin

동작 방식은 둘 중 하나입니다.

  • admin_down이라는 Critical Device를 등록하고 그 상태를 problem으로 보고 → 멤버 상태가 부드럽게(gracefully) DOWN 으로 바뀝니다.
  • 등록된 admin_down의 상태를 ok로 보고 → 멤버 상태가 부드럽게 UP 으로 바뀐 뒤, 스크립트가 admin_down등록 해제 합니다.

자세한 내용은 sk55081을 참고하세요. 사용법은 clusterXL_admin <up|down> [-p] 이며, -p를 붙이면 재부팅 후에도 상태가 유지(persistent) 됩니다. -p 없이 실행하면 "이 명령은 재부팅 후 사라진다. 영구 적용하려면 clish에서 set cluster member admin down/up permanent를 쓰거나 expert mode에서 끝에 -p를 붙이라"는 안내가 출력됩니다.

스크립트는 먼저 cphaprob stat로 클러스터가 켜져 있는지 확인 하고("HA is not started"면 종료), Sync only/Bridge Mode 여부에 따라 상태 컬럼 위치(4 또는 5)를 골라 현재 상태를 읽은 뒤, 기대한 상태로 바뀌지 않으면 "still down"이라며 show cluster members pnotes problem/cphaprob list로 원인을 보라고 안내합니다.

#! /bin/csh -f
#
# The script will cause the machine to get into down state, thus the member will not filter packets.
# It will supply a simple way to initiate a failover by registering a new device in problem state when
# a failover is required and will unregister the device when wanting to return to normal operation.
# USAGE:
# clusterXL_admin <up|down>
set PERSISTENT = ""
# checking number of arguments
if ( $#argv > 2 || $#argv < 1 ) then
echo "clusterXL_admin : Invalid Argument Count"
echo "Usage: clusterXL_admin <up|down> [-p]"
exit 1
else if ( "$1" != "up" && "$1" != "down" ) then
echo "clusterXL_admin : Invalid Argument ($1)"
echo "Usage: clusterXL_admin <up|down> [-p]"
exit 1
else if ( $#argv == 2 ) then
if ( "$2" != "-p" ) then
echo "clusterXL_admin : Invalid Argument ($2)"
echo "Usage: clusterXL_admin <up|down> [-p]"
exit 1
endif
set PERSISTENT = "-p"
endif
#checking if cpha is started
$FWDIR/bin/cphaprob stat | grep "Cluster" > /dev/null
if ($status) then
echo "HA is not started"
exit 1
endif
# Inform the user that the command can run with persistent mode.
if ("$PERSISTENT" != "-p") then
echo "This command does not survive reboot. To make the change permanent, please run
'set cluster member admin down/up permanent' in clish or add '-p' at the end of the command in
expert mode"
endif
if ( $1 == "up" ) then
echo "Setting member to normal operation ..."
$FWDIR/bin/cphaconf set_pnote -d admin_down $PERSISTENT unregister > & /dev/null
if ( `uname` == 'IPSO' ) then
sleep 5
else
sleep 1
endif
set stateArr = `$FWDIR/bin/cphaprob stat | grep "local"`
$FWDIR/bin/cphaprob stat | egrep "Sync only|Bridge Mode" > /dev/null
#If it's third party or bridge mode, use column 4 , otherwise 5
if ($status) then
set state = $stateArr[5]
else
set state = $stateArr[4]
endif
echo "Member current state is $state"
if (($state != "Active" && $state != "Standby") && ($state != "ACTIVE" && $state != "STANDBY" && $state != "ACTIVE(!)")) then
echo "Operation failed: member is still down, please run 'show cluster members pnotes problem' in clish or 'cphaprob list' in expert mode for further details"
endif
exit 0
endif

if ( $1 == "down" ) then
echo "Setting member to administratively down state ..."
$FWDIR/bin/cphaconf set_pnote -d admin_down -t 0 -s problem $PERSISTENT register > & /dev/null
sleep 1
set stateArr = `$FWDIR/bin/cphaprob stat | grep "local"`
$FWDIR/bin/cphaprob stat | egrep "Sync only|Bridge Mode" > /dev/null
#If it's third party or bridge mode, use column 4 , otherwise 5
if ($status) then
set state = $stateArr[5]
else
set state = $stateArr[4]
endif
echo "Member current state is $state"
if ( $state == "Active attention" || $state == "ACTIVE(!)" ) then
echo "All the members within the cluster have problem/s and the local member was chosen to become active"
else
if ( $state != "Down" && $state != "DOWN" ) then
echo "Operation failed: member is still down, please run 'show cluster members pnotes problem' in clish or 'cphaprob list' in expert mode for further details"
endif
endif
exit 0
else
echo "clusterXL_admin : Invalid Option ($1)"
echo "Usage: clusterXL_admin <up|down> [-p]"
exit 1
endif

clusterXL_monitor_ips 스크립트 — 호스트 핑 감시

clusterXL_monitor_ips미리 정해 둔 IP 목록에 핑을 보내고, 응답 여부에 따라 멤버를 DOWN/UP 으로 바꾸는 스크립트입니다. 동작하려면 $FWDIR/conf/cpha_hosts 파일에 IP를 한 줄에 하나씩 적어야 합니다. 이 파일은 주석이나 공백을 허용하지 않 습니다. 위치는 다음과 같습니다.

$FWDIR/bin/clusterXL_monitor_ips

동작 흐름은 이렇습니다. ① host_monitor라는 Critical Device를 상태 ok 로 등록하고, ② cpha_hosts의 IP들에 핑을 보냅니다. ③ 응답이 오는 동안에는 상태를 바꾸지 않다가, ④ 단 하나라도 핑 응답이 없으면 상태를 problem 으로 보고해 멤버를 DOWN으로 만듭니다. 다시 응답이 오면 상태를 ok로 되돌립니다. 사용법은 cpha_monitor_ips X silent 이며, X핑 루프 사이의 간격(초), silent1이면 콘솔에 메시지를 출력하지 않습니다. 자세한 내용은 sk35780.

#
# The script tries to ping the hosts written in the file $FWDIR/conf/cpha_hosts. The names (must
be resolveable) ot the IPs of the hosrs must be written in seperate lines.
# the file must not contain anything else.
# We ping the given hosts every number of seconds given as parameter to the script.
# USAGE:
# cpha_monitor_ips X silent
# where X is the number of seconds between loops over the IPs.
# if silent is set to 1, no messages will appear on the console
#
# We initially register a pnote named "host_monitor" in the problem notification mechanism
# when we detect that a host is not responding we report the pnote to be in "problem" state.
# when ping succeeds again - we report the pnote is OK.
silent=0
if [ -n "$2" ]; then
if [ $2 -le 1 ]; then
silent=$2
fi
fi
hostfile=$FWDIR/conf/cpha_hosts
arch=`uname -s`
if [ $arch = "Linux" ]
then
#system is linux
ping="ping -c 1 -w 1"
else
ping="ping"
fi
$FWDIR/bin/cphaconf set_pnote -d host_monitor -t 0 -s ok register
TRUE=1
while [ "$TRUE" ]
do
result=1
for hosts in `cat $hostfile`
do
if [ $silent = 0 ]
then
echo "pinging $hosts using command $ping $hosts"
fi
if [ $arch = "Linux" ]
then
$ping $hosts > /dev/null 2>&1
else
$ping $hosts $1 > /dev/null 2>&1
fi
status=$?
if [ $status = 0 ]
then
if [ $silent = 0 ]
then
echo " $hosts is alive"
fi
else
if [ $silent = 0 ]
then
echo " $hosts is not responding "
fi
result=0
fi
done
if [ $silent = 0 ]
then
echo "done pinging"
fi
if [ $result = 0 ]
then
if [ $silent = 0 ]
then
echo " Cluster member should be down!"
fi
$FWDIR/bin/cphaconf set_pnote -d host_monitor -s problem report
else
if [ $silent = 0 ]
then
echo " Cluster member seems fine!"
fi
$FWDIR/bin/cphaconf set_pnote -d host_monitor -s ok report
fi
if [ "$silent" = 0 ]
then
echo "sleeping"
fi
sleep $1
echo "sleep $1"
done

clusterXL_monitor_process 스크립트 — 프로세스 감시

clusterXL_monitor_process지정한 사용자 공간(user space) 프로세스가 실행 중인지 감시하고, 멈추면 페일오버를 일으키는 스크립트입니다. 동작하려면 $FWDIR/conf/cpha_proc_list 파일에 감시할 프로세스 이름을 정확히(대소문자 구분) 한 줄에 하나씩 적어야 합니다. 이 파일도 주석·공백을 허용하지 않 으며, 프로세스 이름은 최대 15자 까지입니다. 위치는 다음과 같습니다.

$FWDIR/bin/clusterXL_monitor_process

동작 흐름은 이렇습니다. ① cpha_proc_list에 적힌 각 프로세스 이름으로 Critical Device를 상태 ok 로 등록하고, ② 프로세스가 실행 중인 동안에는 상태를 그대로 두다가, ③ 프로세스가 더 이상 실행되지 않으면 해당 Critical Device를 problem 으로 보고해 멤버를 DOWN으로 만듭니다. 다시 실행되면 ok로 되돌립니다. 사용법은 cpha_monitor_process X silent 이며, X프로세스 확인 간격(초), silent1이면 콘솔 출력을 끕니다. 자세한 내용은 sk92904.

#
# This script monitors the existance of processes in the system. The process names should be written
# in the $FWDIR/conf/cpha_proc_list file one every line.
#
# USAGE :
# cpha_monitor_process X silent
# where X is the number of seconds between process probings.
# if silent is set to 1, no messages will appear on the console.
#
# We initially register a pnote for each of the monitored processes
# (process name must be up to 15 charachters) in the problem notification mechanism.
# when we detect that a process is missing we report the pnote to be in "problem" state.
# when the process is up again - we report the pnote is OK.
if [ "$2" -le 1 ]
then
silent=$2
else
silent=0
fi
if [ -f $FWDIR/conf/cpha_proc_list ]
then
procfile=$FWDIR/conf/cpha_proc_list
else
echo "No process file in $FWDIR/conf/cpha_proc_list "
exit 0
fi
arch=`uname -s`
for process in `cat $procfile`
do
$FWDIR/bin/cphaconf set_pnote -d $process -t 0 -s ok -p register > /dev/null 2>&1
done
while [ 1 ]
do
result=1
for process in `cat $procfile`
do
ps -ef | grep $process | grep -v grep > /dev/null 2>&1
status=$?
if [ $status = 0 ]
then
if [ $silent = 0 ]
then
echo " $process is alive"
fi
#
echo "3, $FWDIR/bin/cphaconf set_pnote -d $process -s ok report"
$FWDIR/bin/cphaconf set_pnote -d $process -s ok report
else
if [ $silent = 0 ]
then
echo " $process is down"
fi
$FWDIR/bin/cphaconf set_pnote -d $process -s problem report
result=0
fi
done
if [ $result = 0 ]
then
if [ $silent = 0 ]
then
echo " One of the monitored processes is down!"
fi
else
if [ $silent = 0 ]
then
echo " All monitored processes are up "
fi
fi
if [ "$silent" = 0 ]
then
echo "sleeping"
fi
sleep $1
done

Cluster 관리 API

소개와 API 목록

Cluster API 의 목적은 simple-gateway API처럼 Check Point 클러스터를 자동화·오케스트레이션 하는 것입니다. 이 API들은 새 클러스터 객체 생성, 기존 객체 수정(멤버 추가·제거, 인터페이스 조작) 같은 일반적인 작업을 지원합니다. 이름에 "simple"이 붙은 이유는 클러스터 객체의 모든 기능을 다 지원하지는 않 기 때문입니다. 따라서 이 API가 제공하지 않는 작업은 SmartConsole 에서 처리합니다.

API는 비동기(Asynchronous)와 동기(Synchronous)로 나뉩니다.

분류API설명
Asynchronousadd simple-cluster새 simple cluster 객체를 처음부터 생성 합니다.
Asynchronousset simple-cluster기존 simple cluster 객체를 수정 합니다.
Synchronousshow simple-cluster이름 또는 UID로 지정한 기존 객체 하나를 표시 합니다.
Synchronousshow simple-clusters모든 기존 객체 를 표시합니다.
Synchronousdelete simple-cluster기존 객체를 삭제 합니다.

API 예제

예제 1 — simple cluster 객체 추가 (`add simple-cluster`)

API 명령이 끝나고 세션을 publish하면 SmartConsole에 새 클러스터 객체가 나타납니다. 전제 조건 은 ① 모든 멤버가 이미 설치돼 있고, ② 각 멤버의 인터페이스가 이미 구성돼 있어야 한다는 것입니다.

예제 시나리오는 High Availability 모드의 cluster1, 멤버 둘(member1, member2), 인터페이스 셋(eth0 외부, eth1 sync, eth2 내부), Firewall 블레이드만 켜고 IPsec VPN은 끈 상태, 버전 R80.20입니다. 토폴로지는 다음과 같습니다.

인터페이스ClusterMember1Member2
eth0 (External)172.23.5.254 / 255.255.255.0172.23.5.1 / 255.255.255.0172.23.5.2 / 255.255.255.0
eth1 (Sync)N / A1.1.1.1 / 255.255.255.01.1.1.2 / 255.255.255.0
eth2 (Internal)192.168.1.254 / 255.255.255.0192.168.1.1 / 255.255.255.0192.168.1.2 / 255.255.255.0
"name" : "cluster1",
"color" : "yellow",
"version" : "R80.20",
"ip-address" : "172.23.5.254",
"os-name" : "Gaia",
"cluster-mode" : "cluster-xl-ha",
"firewall" : true,
"vpn" : false,
"interfaces" : [
{
"name" : "eth0",
"ip-address" : "172.23.5.254",
"network-mask" : "255.255.255.0",
"interface-type" : "cluster",
"topology" : "EXTERNAL",
"anti-spoofing" : "true"
},
{
"name" : "eth1",
"interface-type" : "sync",
"topology" : "INTERNAL",
"topology-settings": {
"ip-address-behind-this-interface": "network defined by the interface ip and net mask",
"interface-leads-to-dmz": false
}
},
{
"name" : "eth2",
"ip-address" : "192.168.1.254",
"network-mask" : "255.255.255.0",
"interface-type" : "cluster",
"topology" : "INTERNAL",
"anti-spoofing" : "true",
"topology-settings": {
"ip-address-behind-this-interface": "network defined by the interface ip and net mask",
"interface-leads-to-dmz": false
}
}
],
"members" : [ {
"name" : "member1",
"one-time-password" : "abcd",
"ip-address" : "172.23.5.1",
"interfaces" : [
{ "name" : "eth0", "ip-address" : "172.23.5.1", "network-mask" : "255.255.255.0" },
{ "name" : "eth1", "ip-address" : "1.1.1.1", "network-mask" : "255.255.255.0" },
{ "name" : "eth2", "ip-address" : "192.168.1.1", "network-mask" : "255.255.255.0" }
]
},
{
"name" : "member2",
"one-time-password" : "abcd",
"ip-address" : "172.23.5.2",
"interfaces" : [
{ "name" : "eth0", "ip-address" : "172.23.5.2", "network-mask" : "255.255.255.0" },
{ "name" : "eth1", "ip-address" : "1.1.1.2", "network-mask" : "255.255.255.0" },
{ "name" : "eth2", "ip-address" : "192.168.1.2", "network-mask" : "255.255.255.0" }
]
}
]
}

예제 2 — 멤버 추가 (scale up, `set simple-cluster`)

기존 객체에 member3을 추가 합니다. 새 멤버 정보는 members"add" 블록에 담고, 각 인터페이스의 IP를 함께 지정합니다(member3의 eth0=172.23.5.3, eth1=1.1.1.3, eth2=192.168.1.3).

"name" : "cluster1",
"members" : { "add" :
{
"name" : "member3",
"ipv4-address" : "172.23.5.3",
"one-time-password" : "aaaa",
"interfaces" : [
{ "name" : "eth0", "ip-address" : "172.23.5.3", "network-mask" : "255.255.255.0" },
{ "name" : "eth1", "ip-address" : "1.1.1.3", "network-mask" : "255.255.255.0" },
{ "name" : "eth2", "ip-address" : "192.168.1.3", "network-mask" : "255.255.255.0" }
]
}
}
}

예제 3 — 멤버 제거 (scale down, `set simple-cluster`)

member3을 제거합니다. members"remove" 에 제거할 멤버 이름만 적으면 됩니다.

"name" : "cluster1",
"members" :
{ "remove" : "member3" }
}

예제 4 — 클러스터 인터페이스 추가 (`set simple-cluster`)

eth3(내부, 10.10.10.x)을 추가합니다. interfaces"add" 로 클러스터 차원의 인터페이스를 정의 하고, members"update" 로 각 멤버의 해당 인터페이스 IP를 갱신 합니다. 마스크는 ipv4-mask-length(예: "24")나 ipv4-network-mask로 줄 수 있습니다.

"name" : "cluster1",
"interfaces" : { "add" :
{
"name" : "eth3",
"ip-address" : "10.10.10.254",
"ipv4-mask-length" : "24",
"interface-type" : "cluster",
"topology" : "INTERNAL",
"anti-spoofing" : "true"
}
},
"members" : { "update" :
[{
"name" : "member1" ,
"interfaces" :
{"name" : "eth3", "ipv4-address" : "10.10.10.1", "ipv4-network-mask" : "255.255.255.0"}
},
{
"name" : "member2" ,
"interfaces" :
{"name" : "eth3", "ipv4-address" : "10.10.10.2", "ipv4-network-mask" : "255.255.255.0"}
}
]}
}

예제 5 — 클러스터 인터페이스 제거 (`set simple-cluster`)

eth3을 제거합니다. interfaces"remove" 에 인터페이스 이름만 적습니다.

"name" : "cluster1",
"interfaces" :
{ "remove" : "eth3" }
}

예제 6 — 클러스터 인터페이스 설정 변경 (`set simple-cluster`)

eth2의 IP를 192.168.1.x/24에서 172.30.1.x/24로 바꿉니다. interfaces"update" 로 클러스터 IP를, members"update" 로 각 멤버 IP를 함께 갱신합니다.

"name" : "cluster1",
"interfaces" : { "update" :
{
"name" : "eth2",
"ip-address" : "172.30.1.254",
"ipv4-mask-length" : "24",
"interface-type" : "cluster",
"topology" : "INTERNAL",
"anti-spoofing" : "true"
}
},
"members" : { "update" : [
{
"name" : "member1" ,
"interfaces" :
{"name" : "eth2", "ipv4-address" : "172.30.1.1", "ipv4-mask-length" : "24"}
},
{
"name" : "member2" ,
"interfaces" :
{"name" : "eth2", "ipv4-address" : "172.30.1.2", "ipv4-mask-length" : "24"}
}
]}
}

예제 7 — SIC 재수립 (`set simple-cluster`)

멤버와 SIC를 다시 맺습니다. 전제 조건 은 멤버에서 이미 SIC가 reset돼 있어야 한다는 것입니다.

"name" : "cluster1",
"members" : { "update" :
[
{ "name" : "member1", "one-time-password" : "aaaa" },
{ "name" : "member2", "one-time-password" : "aaaa" }
]
}
}

예제 8 — 블레이드 켜기/끄기 (`set simple-cluster`)

멤버의 Software Blade를 켜고 끕니다. 켜려면 값을 true, 끄려면 false 로 둡니다. 아래는 Cluster API가 지원하는 블레이드를 모두 켜는/끄는 예입니다.

"name" : "cluster1",
"vpn" : true,
"application-control" : true,
"url-filtering" : true,
"ips" : true,
"content-awareness" : true,
"anti-bot" : true,
"anti-virus" : true,
"threat-emulation" : true
}
"name" : "cluster1",
"vpn" : false,
"application-control" : false,
"url-filtering" : false,
"ips" : false,
"content-awareness" : false,
"anti-bot" : false,
"anti-virus" : false,
"threat-emulation" : false
}

예제 9 — 객체 하나 조회 (`show simple-cluster`)

특정 클러스터 객체를 조회합니다.

요청은 다음과 같습니다.

"limit-interfaces" : "10",
"name" : "cluster1"
}

응답은 객체의 모든 속성을 담은 큰 JSON으로, UID·type·domain·meta-info(잠금/검증 상태/수정 시각/수정자)·색상·IP·버전·OS·하드웨어·블레이드 상태·firewall-settings·logs-settings·interfaces·cluster-mode·cluster-members(각 멤버의 SIC 상태와 인터페이스 IP) 까지 포함합니다. 아래는 응답의 앞부분입니다.

"uid": "e0ce560b-8a0a-4468-baa9-5f8eb2658b96",
"name": "cluster1",
"type": "simple-cluster",
"domain": {
"uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name": "SMC User",
"domain-type": "domain"
},
"meta-info": {
"lock": "unlocked",
"validation-state": "ok",
"last-modify-time": { "posix": 1567417185885, "iso-8601": "2019-09-02T12:39+0300" },
"last-modifier": "aa",
"creation-time": { "posix": 1567417140278, "iso-8601": "2019-09-02T12:39+0300" },
"creator": "aa"
},
"tags": [],
"read-only": false,
"comments": "",
"color": "yellow",
"icon": "NetworkObjects/cluster",
"groups": [],
"ipv4-address": "172.23.5.254",
"dynamic-ip": false,
"version": "R80.20",
"os-name": "Gaia",
"hardware": "Open server",
"firewall": true,
"firewall-settings": {
"auto-maximum-limit-for-concurrent-connections": true,
"maximum-limit-for-concurrent-connections": 25000,
"auto-calculate-connections-hash-table-size-and-memory-pool": true,
"connections-hash-size": 131072,
"memory-pool-size": 6,
"maximum-memory-pool-size": 30
},
"vpn": false,
"application-control": false,
"url-filtering": false,
"content-awareness": false,
"ips": false,
"anti-bot": false,
"anti-virus": false,
"threat-emulation": false,
...
"interfaces": {
"total": 3, "from": 1, "to": 3,
"objects": [ { "name": "eth0", "ipv4-address": "172.23.5.254", ... "topology": "external", "anti-spoofing": true, ... "interface-type": "cluster" }, ... ]
},
"cluster-mode": "cluster-xl-ha",
"cluster-members": [
{
"name": "member1",
"sic-state": "initialized",
"sic-message": "Initialized but trust not established",
"ip-address": "172.23.5.1",
"interfaces": [
{ "name": "eth0", "ipv4-address": "172.23.5.1", "ipv4-network-mask": "255.255.255.0", "ipv4-mask-length": 24, ... },
{ "name": "eth1", "ipv4-address": "1.1.1.1", ... },
{ "name": "eth2", "ipv4-address": "192.168.1.1", ... }
]
}
]
}

예제 10 — 모든 객체 조회 (`show simple-clusters`)

존재하는 모든 클러스터 객체를 조회합니다.

show simple-clusters

예제 11 — 객체 삭제 (`delete simple-cluster`)

지정한 클러스터 객체를 삭제합니다. 이름만 넘기면 됩니다.

"name" : "cluster1"
}

알려진 제약 (Known Limitations)

이 Cluster API는 강력하지만 모든 것을 다 할 수는 없 으므로, 다음 제약을 알고 있어야 합니다. 제약에 걸리는 작업은 SmartConsole로 처리하세요.

  • 클러스터 작업의 일부 subset만 지원합니다.
  • Software Blade는 기본 구성만 지원합니다(simple-gateway API와 유사 — Check Point Management API Reference 참고).
  • ClusterXL High Availability, ClusterXL Load Sharing, CloudGuard OPSEC 클러스터 만 지원합니다.
  • Cluster Virtual IP를 멤버 IP와 다른 서브넷에 두는 구성은 지원하지 않 습니다. 이런 구성은 SmartConsole로 하세요.
  • VRRP 클러스터(Gaia OS·IPSO OS 모두)는 지원하지 않 습니다.
  • 인터페이스 설정은 제한된 subset만 지원합니다. Topology, Anti-Spoofing, Security Zone 같은 설정을 바꾸려면 인터페이스를 교체(replace) 해야 합니다.

정리하면, 일상 운영과 진단은 Gaia Clish·Expert mode 명령(show cluster ... / cphaprob ...)으로, 멤버 상태 조작과 자동 감시는 clusterXL_admin·clusterXL_monitor_ips·clusterXL_monitor_process 스크립트로, 대량 생성·변경은 Cluster API로 내려가며, 그 방대한 명령·필드 사전은 R82 CLI Reference Guide와 Check Point Management API Reference 가 담당합니다.