소개
이 문서에서는 Cisco ESA(Email Security Appliance)의 클러스터에 있는 어플라이언스의 컨피그레이션을 저장하기 위해 배치 명령을 사용하는 방법에 대해 설명합니다. 이는 모든 버전의 AsyncOS for ESA에서 사용할 수 있습니다.
AsyncOS 버전 8.5 이전에는 클러스터링된 어플라이언스에서 컨피그레이션을 Cisco ESA로 복원하는 데 사용할 사용 가능한 컨피그레이션을 저장할 수 없었습니다.어플라이언스에서 사용 가능한 컨피그레이션을 가져오려면 클러스터에서 어플라이언스를 제거하고 컨피그레이션을 독립형 어플라이언스로 저장해야 합니다.
사전 요구 사항
참고:이 문서는 개념 증명으로, 예로서 제공됩니다.이 단계는 성공적으로 테스트되었지만, 이 문서는 주로 데모 및 그림 용도로 작성되었습니다.맞춤형 스크립트는 Cisco의 범위와 지원 범위를 벗어납니다.Cisco Technical Assistance Center는 언제든지 맞춤형 외부 스크립트를 작성, 업데이트 또는 트러블슈팅하지 않습니다. 스크립트를 시도하고 구성하기 전에 최종 스크립트를 작성할 때 스크립팅 지식이 있는지 확인하십시오.
클러스터의 ESA에서 다음 정보를 수집합니다.
- IP 주소 및/또는 호스트 이름
- 클러스터 이름
- 클러스터 그룹 이름(해당되는 경우)
ESA가 실행하는 수정 버전에 따라 달라지는 CLI 배치 변경 사항이 있으므로 AsyncOS for Email Security 버전에 대해서는 CLI 참조 설명서를 참조하십시오.
다음 기술 노트를 읽고 이해하십시오.
클러스터에 있는 어플라이언스의 구성 파일 백업 자동화 또는 스크립트
AsyncOS 버전 8.5 이전 버전의 경우, saveconfig 또는 mailconfig 명령을 사용하여 클러스터에 있는 동안 컨피그레이션을 저장하려고 시도하면 ESA는 다음 경고를 생성합니다.
WARNING: Clustered machines do not support loadconfig. Your configuration file has
complete data for the entire cluster, but cannot be used to restore a configuration.
[an error occurred while processing this directive]
AsyncOS 버전 8.5 이상에서는 저장된 컨피그레이션에 시스템 레벨 컨피그레이션과 클러스터 컨피그레이션이 모두 포함됩니다.이 내용은 버전 8.5 이상 사용 설명서에서 자세히 다룹니다.자세한 내용은 최종 사용자 가이드를 참조하십시오.
클러스터의 각 어플라이언스에 대한 컨피그레이션을 백업할 필요가 없습니다.그러나 네트워크에는 여러 클러스터가 있을 수 있으며, 각 클러스터에 여러 그룹이 구성될 수 있습니다.클러스터에서 모든 어플라이언스를 제거한 다음 컨피그레이션을 저장하고 클러스터에 수동으로 다시 참여하는 것은 매우 어렵습니다.
이러한 명령은 ESA에 로그인하고, 클러스터에서 ESA를 제거하고, 컨피그레이션을 저장하거나 메일로 보낸 다음, 클러스터에 다시 참여하는 경우에 사용할 수 있습니다.
먼저 클러스터에 있는 ESA의 시스템 이름과 일련 번호와 그룹 이름을 알고 있어야 합니다.CLI에 clusterconfig 목록을 입력하면 이 정보를 얻을 수 있습니다.
(Cluster ESA1_ESA2)> clusterconfig list
Cluster esaA_esaB
=====================
Group Main_Group:
Machine ESA1.local (Serial #: 0000E878109A-G091111)
Machine ESA2.local (Serial #: 0000E878525D-9091111)
[an error occurred while processing this directive]
클러스터에서 어플라이언스를 제거하려면 clusterconfig removemachine <appliance name> 명령을 사용합니다.
(Cluster ESA1_ESA2)> clusterconfig removemachine ESA1.local
Please wait, this operation may take a minute...
Machine ESA1.local removed from the cluster.
[an error occurred while processing this directive]
saveconfig 명령을 사용하여 비밀번호와 함께 어플라이언스에 컨피그레이션을 저장합니다."loadconfig 명령을 사용하여 비밀번호가 마스킹된 파일을 로드할 수 없습니다." 따라서 다음 메시지가 표시되면 N을 입력해야 합니다.
ESA1.local> saveconfig
Do you want to mask the password? Files with masked passwords cannot be loaded
using loadconfig command. [Y]> n
File written on machine "esaA.local" to the location
"/configuration/C100V-0000E878109A-G091111-20140909T184724.xml".
Configuration saved.
[an error occurred while processing this directive]
또는 mailconfig를 사용하여 올바른 이메일 수신자에게 컨피그레이션을 이메일로 전송합니다."loadconfig 명령을 사용하여 비밀번호가 마스킹된 파일을 로드할 수 없습니다." 따라서 다음 메시지가 표시되면 N을 입력해야 합니다.
ESA1.local> mailconfig
Please enter the email address to which you want to send the configuration file.
Separate multiple addresses with commas.
[]> joe@example.com
Do you want to mask the password? Files with masked passwords cannot be loaded
using loadconfig command. [Y]> n
The configuration file has been sent to joe@example.com.
[an error occurred while processing this directive]
마지막으로 어플라이언스를 클러스터에 다시 가입시키려면 clusterconfig batch 명령을 사용합니다.
clusterconfig join [--port=xx] <ip_of_remote_cluster> <admin_username>
<admin_password> <groupname>
[an error occurred while processing this directive]
이전 예제를 계속 진행하려면 다음 명령에서 이 작업을 실행합니다.
esaA.local> clusterconfig join --port=22 172.16.6.161 admin ironport Main_Group
Joining a cluster takes effect immediately, there is no need to commit.
(Cluster ESA1_ESA2)>
[an error occurred while processing this directive]
이전 예에서 "Cluster ESA1_ESA2)와 같이 명령 프롬프트가 클러스터 레벨 이름으로 자동 변경되었음을 확인할 수 있습니다.
고급 자동 또는 스크립트 방식의 구성 파일 백업
외부 호스트(UNIX/Linux/OSX)에서 이전 명령을 사용하여 프로세스를 스크립팅할 수 있습니다.
다음은 클러스터가 SSH(Secure Shell), 포트 22를 통해 실행된다고 가정하고 스크립트에 작성된 전체 프로세스의 예입니다.
#! /bin/bash
#
# Script to save the ESA config, then copy locally via SCP. This is assuming you
wish to
# have the cluster in SSH via port 22. This script has been written and tested against
# AsyncOS 9.0.0-390 (01/15/2014).
#
# *NOTE* This script is a proof-of-concept and provided as an example basis. While
these steps have
# been successfully tested, this script is for demonstration and illustration purposes.
Custom
# scripts are outside of the scope and supportability of Cisco. Cisco Technical
Assistance will
# not write, update, or troubleshoot custom external scripts at any time.
#
# <SCRIPT>
#
# $HOSTNAME & $HOSTNAME2 can be either the FQDN or IP address of the ESAs in cluster.
#
HOSTNAME= [IP/HOSTNAME ESA1]
HOSTNAME2= [IP/HOSTNAME ESA2]
#
# $MACHINENAME is the local name for ESA1.
#
MACHINENAME= [MACHINENAME AS LISTED FROM 'clusterconfig list']
#
# $USERNAME assumes that you have preconfigured SSH key from this host to your ESA.
# http://www.cisco.com/c/en/us/support/docs/security/email-security-appliance/
118305-technote-esa-00.html
#
USERNAME=admin
#
# $BACKUP_PATH is the directory location on the local system.
#
BACKUP_PATH= [/local/path/as/desired]
#
# Following will remove ESA1 from cluster in order to backup standalone config.
# "2> /dev/null" at the end of string will quiet any additional output of the
clustermode command.
#
echo "|=== PHASE 1 ===| REMOVING $MACHINENAME FROM CLUSTER"
ssh $USERNAME@$HOSTNAME "clustermode cluster; clusterconfig removemachine
$MACHINENAME" 2> /dev/null
#
# $FILENAME contains the actual script that calls the ESA, issues the 'saveconfig'
command.
# The rest of the string is the cleanup action to reflect only the <model>-
<serial number>-<timestamp>.xml.
#
echo "|=== PHASE 2 ===| BACKUP CONFIGURATION ON ESA"
FILENAME=`ssh -q $USERNAME@$HOSTNAME "saveconfig y 1" | grep xml | sed -e
's/\/configuration\///g' | sed 's/\.$//g' | tr -d "\""`
#
# The 'scp' command will secure copy the $FILENAME from the ESA to specified
backup path, as entered above.
# The -q option for 'scp' will disable the copy meter/progress bar.
#
echo "|=== PHASE 3 ===| COPY XML FROM ESA TO LOCAL"
scp -q $USERNAME@$HOSTNAME:/configuration/$FILENAME $BACKUP_PATH
#
# Following will re-add ESA1 back into cluster.
#
echo "|=== PHASE 4 ===| ADDING $MACHINENAME BACK TO CLUSTER"
ssh $USERNAME@$HOSTNAME "clusterconfig join $HOSTNAME2 admin ironport
Main_Group" 2> /dev/null
#
echo "|=== COMPLETE ===| $FILENAME successfully saved to $BACKUP_PATH"
#
# </SCRIPT>
#
[an error occurred while processing this directive]
다음은 스크립트에 포함된 주요 명령에 대한 검사입니다.
- 클러스터에서 ESA1을 제거합니다.
ssh $USERNAME@$HOSTNAME "clustermode cluster; clusterconfig removemachine
$MACHINENAME" 2> /dev/null
[an error occurred while processing this directive]
- 독립형 구성 파일 다운로드:
FILENAME=`ssh -q $USERNAME@$HOSTNAME "saveconfig y 1" | grep xml | sed -e 's/
\/configuration\///g' | sed 's/\.$//g' | tr -d "\""`
[an error occurred while processing this directive]
- ESA1에서 로컬 호스트로 XML을 복사합니다.
scp -q $USERNAME@$HOSTNAME:/configuration/$FILENAME $BACKUP_PATH
[an error occurred while processing this directive]
- ESA1을 다시 클러스터에 넣습니다.
ssh $USERNAME@$HOSTNAME "clusterconfig join $HOSTNAME2 admin ironport
Main_Group" 2> /dev/null
[an error occurred while processing this directive]
실행 중인 스크립트의 전체 예는 다음과 같습니다.
my_host$ ./cluster_backup
|=== PHASE 1 ===| REMOVING ESA1.local FROM CLUSTER
Please wait, this operation may take a minute...
Machine ESA1.local removed from the cluster.
|=== PHASE 2 ===| BACKUP CONFIGURATION ON ESA
|=== PHASE 3 ===| COPY XML FROM ESA TO LOCAL
|=== PHASE 4 ===| ADDING ESA1.local BACK TO CLUSTER
Joining a cluster takes effect immediately, there is no need to commit.
|=== COMPLETE ===| C100V-0000E878109A-G091111-20150116T192955.xml successfully
saved to /Users/saved_esa_configurations/
[an error occurred while processing this directive]
관련 정보