기술 가이드

CentOS 5.5에 Kippo SSH 허니팟 설치 방법

4 min read 서버 보안 업데이트됨 23 Sep 2025
CentOS 5.5에 Kippo SSH 허니팟 설치 가이드
CentOS 5.5에 Kippo SSH 허니팟 설치 가이드

요약: 이 문서는 CentOS 5.5 서버에 Kippo 중간 상호작용 SSH 허니팟을 설치하고 구성하는 단계별 가이드입니다. Python 2.6과 의존 라이브러리를 설치하고, Kippo를 다운로드해 설정한 뒤 실행과 테스트까지 다룹니다.

개요

Kippo는 공격자의 전체 쉘 상호작용을 기록하도록 설계된 중간 수준 SSH 허니팟입니다. 주로 무차별 대입 공격(brute force)과 이후 수행되는 명령을 기록합니다. 이 가이드는 CentOS 5.5 환경에서 Kippo를 컴파일하고 설치하는 방법을 단계별로 설명합니다. 이 문서의 절차는 운영 환경에 따라 조정이 필요할 수 있으며, 모든 환경에서 동작을 보장하지 않습니다.

Important: Kippo는 루트(uid=0)로 실행하면 안 됩니다. 반드시 일반 사용자로 실행하세요.

사전 준비

  • CentOS 5.5 서버에 루트 또는 sudo 권한이 있는 계정
  • 인터넷 연결 (패키지 다운로드용)
  • 최소한의 패키지 빌드 도구 (gcc, make 등)

Python 2.6 설치

CentOS 5.5 기본은 Python 2.4입니다. Kippo와 일부 라이브러리는 Python 2.6이 필요합니다. 미리 빌드된 RPM을 사용해 Python 2.6을 설치하세요. 예시 설치 안내는 다음 페이지를 참조하세요:

http://www.geekymedia.com/tech-articles/rhel5-centos5-rpms-for-python-2-5-and-2-6/.

중요 사항:

  • 필요한 패키지는 최소 base python 패키지와 libs 패키지입니다.
  • Python 2.6을 실행하려면 터미널에서 python26 을 사용하세요. system Python(2.4)은 그대로 남습니다.
  • setuptools로 패키지를 설치할 때는 python26 setup.py install 처럼 명령에 python26을 명시하세요.

Twisted, Zope Interface 및 Pycrypto 설치

Twisted는 이벤트 기반 네트워킹 엔진입니다. SSH 프로토콜을 처리하려면 Twisted가 필요합니다. 다음은 소스에서 빌드하는 예시입니다:

cd /tmp  
wget http://twistedmatrix.com/Releases/Twisted/10.2/Twisted-10.2.0.tar.bz2  
tar -xvf Twisted-10.2.0.tar.bz2  
cd Twisted-10.2.0  
python26 setup.py build  
python26 setup.py install

Zope Interface는 Python으로 작성된 인터페이스 선언 라이브러리입니다. 설치 예시:

cd /tmp  
wget http://www.zope.org/Products/ZopeInterface/3.3.0/zope.interface-3.3.0.tar.gz  
tar -xvf zope.interface-3.3.0.tar.gz  
cd zope.interface-3.3.0  
python26 setup.py build  
python26 setup.py install

Pycrypto는 Python에서 암호화 알고리즘을 제공하는 라이브러리입니다. 설치 예시(원본 파일 경로를 확인하세요):

cd /tmp  
wget wget http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz  
tar -xvf pycrypto-2.0.1.tar.gz  
cd pycrypto-2.0.1  
python26 setup.py build  
python26 setup.py install

ASN.1 타입과 코덱 구현이 필요하면 pyasn1을 설치합니다:

cd /tmp  
wget http://sourceforge.net/projects/pyasn1/files/pyasn1-devel/0.0.12a/pyasn1-0.0.12a.tar.gz/download  
tar -xvf pyasn1-0.0.12a.tar.gz  
cd pyasn1-0.0.12a  
python26 setup.py build  
python26 setup.py install

Notes: 일부 wget URL은 리다이렉트나 중복된 토큰을 포함할 수 있습니다. 각 URL을 브라우저나 curl로 확인한 후 사용하세요.

정규 사용자 생성

Kippo는 루트로 실행하면 안 됩니다. 일반 사용자 계정을 하나 만드세요:

useradd kippouser

Kippo 소스 다운로드

kippouser로 전환한 뒤 소스 파일을 다운로드하고 압축을 풉니다:

su - kippouser   
wget http://kippo.googlecode.com/files/kippo-0.5.tar.gz  
tar -xvf kippo-0.5.tar.gz  
cd kippo-0.5

Kippo 구성

기본 설정 파일 kippo.cfg를 편집해 포트, 호스트명, 로그 경로 등을 조정하세요.

vi kippo.cfg

아래는 kippo.cfg의 예시 내용입니다. (원본 주석과 항목을 그대로 포함)

#
# Kippo configuration file (kippo.cfg)
#
[honeypot]
# IP addresses to listen for incoming SSH connections.
#
# (default: 0.0.0.0) = any address
#ssh_addr = 0.0.0.0
# Port to listen for incoming SSH connections.
#
# (default: 2222)
ssh_port = 2222
# Hostname for the honeypot. Displayed by the shell prompt of the virtual
# environment.
#
# (default: sales)
hostname = sales
# Directory where to save log files in.
#
# (default: log)
log_path = log
# Directory where to save downloaded (malware) files in.
#
# (default: dl)
download_path = dl
# Directory where virtual file contents are kept in.
#
# This is only used by commands like 'cat' to display the contents of files.
# Adding files here is not enough for them to appear in the honeypot - the
# actual virtual filesystem is kept in filesystem_file (see below)
#
# (default: honeyfs)
contents_path = honeyfs
# File in the python pickle format containing the virtual filesystem. 
#
# This includes the filenames, paths, permissions for the whole filesystem,
# but not the file contents. This is created by the createfs.py utility from
# a real template linux installation.
#
# (default: fs.pickle)
filesystem_file = fs.pickle
# Directory for miscellaneous data files, such as the password database.
#
# (default: data_path)
data_path = data
# Directory for creating simple commands that only output text.
#
# The command must be placed under this directory with the proper path, such
# as:
#   txtcmds/usr/bin/vi
# The contents of the file will be the output of the command when run inside
# the honeypot.
#
# In addition to this, the file must exist in the virtual
# filesystem {filesystem_file}
#
# (default: txtcmds)
txtcmds_path = txtcmds
# Public and private SSH key files. If these don't exist, they are created
# automatically.
#
# (defaults: public.key and private.key)
public_key = public.key
private_key = private.key
# Initial root password. Future passwords will be stored in
# {data_path}/pass.db
#
# (default: 123456)
password = 123456
# IP address to bind to when opening outgoing connections. Used exclusively by
# the wget command.
#
# (default: not specified)
#out_addr = 0.0.0.0
# Sensor name use to identify this honeypot instance. Used by the database
# logging modules such as mysql.
#
# If not specified, the logging modules will instead use the IP address of the
# connection as the sensor name.
#
# (default: not specified)
#sensor_name=myhostname
# Fake address displayed as the address of the incoming connection.
# This doesn't affect logging, and is only used by honeypot commands such as
# 'w' and 'last'
#
# If not specified, the actual IP address is displayed instead (default
# behaviour).
#
# (default: not specified)
#fake_addr = 192.168.66.254
# MySQL logging module
#
# Database structure for this module is supplied in doc/sql/mysql.sql
#
# To enable this module, remove the comments below, including the
# [database_mysql] line.
#[database_mysql]
#host = localhost
#database = kippo
#username = kippo
#password = secret

설명: 주요 설정은 ssh_port(기본 2222), hostname, log_path, download_path, filesystem_file 등입니다. MySQL 로그를 사용하려면 database 섹션을 활성화하고 데이터베이스 정보를 입력하세요.

Kippo 시작

구성 후 다음으로 Kippo를 실행합니다:

./start.sh

프로세스는 일반 사용자 권한으로 실행되어야 합니다.

로그 확인

기본적으로 출력은 log/kippo.log로 리다이렉트됩니다. 실시간 로그 확인:

tail -f log/kippo.log

포트를 외부에 노출하기

기본 포트는 2222입니다. 외부에서 22번 포트로 접속을 유도하려면 NAT 룰로 22->2222 리다이렉트할 수 있습니다(리눅스에서 루트 전용 포트 제한 때문에 흔히 사용되는 방법).

iptables -t nat -A PREROUTING -i IN_IFACE -p tcp --dport 22 -j REDIRECT --to-port 2222

IN_IFACE를 실제 인터페이스 이름(예: eth0)으로 바꾸세요.

중요: 생산 환경에서 이 방식은 SSH 데몬과 충돌하거나 방화벽 정책에 영향을 줍니다. 필요한 경우 방화벽/SELinux 정책을 검토하세요.

테스트

로컬에서 Kippo에 접속해 동작을 확인하세요:

ssh 127.0.0.1 -p 2222 -l root

성공적으로 로그인하면 다음과 같은 프롬프트가 보여야 합니다:

sales:~#

대체 접근법

  • Docker 컨테이너에 Kippo를 올려 격리된 환경에서 실행하면 설치 충돌을 줄일 수 있습니다. 그러나 CentOS 5.5처럼 오래된 호스트에서는 도커 사용에 제약이 있을 수 있습니다.
  • 이미 패키징된 배포판이나 가상 머신 이미지를 사용하면 빌드 문제를 피할 수 있습니다.
  • Cowrie는 Kippo의 포크로 더 활발히 유지보수되는 대안입니다. 최신 기능과 Python3 지원이 필요하면 Cowrie를 고려하세요.

언제 작동하지 않는가

  • 의존성 라이브러리 버전 불일치(예: Twisted, PyCrypto)가 있으면 빌드 실패가 발생합니다.
  • CentOS 5.5가 너무 오래되어 최신 TLS/네트워크 스택과 충돌할 수 있습니다.
  • SELinux나 방화벽 규칙이 프로세스의 네트워크 바인딩을 차단할 수 있습니다.

보안 강화 체크리스트

  • Kippo를 공개망에 두기 전 별도 네트워크 세그먼트(예: 격리된 VLAN)에 배치하세요.
  • 허니팟 실행 계정의 권한을 최소화하세요.
  • 호스트 OS의 모니터링(로그, CPU, 네트워크 트래픽)을 활성화하세요.
  • 외부로 연결되는 wget 등 기능의 아웃바운드 연결을 제한하세요.
  • 로그를 중앙 수집지로 전송해 보존 및 분석하세요.

운영자 및 보안분석가 체크리스트

  • 운영자: Kippo 프로세스가 일반 사용자로 실행되는지 확인한다.
  • 운영자: 포트 포워딩 규칙과 SSH 데몬 충돌 여부를 확인한다.
  • 보안분석가: 수집된 세션 로그와 다운로드(downlad_path) 샘플을 격리된 분석 환경에서 검사한다.
  • 보안분석가: 악성 파일은 샌드박스에서 실행하지 말고 정적·동적 분석 프로세스에 따라 처리한다.

간단 용어집

  • 허니팟: 공격자를 유인해 활동을 관찰·기록하기 위한 유인 시스템.
  • Brute force: 여러 비밀번호를 자동으로 대입해 인증을 우회하려는 공격.
  • Twisted: 네트워크 이벤트 루프 기반 Python 네트워킹 프레임워크.

테스트 기준

  • SSH 포트(2222)에 연결 시 sales:~# 프롬프트가 출력되어야 한다.
  • 로그인 시 입력한 명령과 파일 다운로드가 log/ 에 기록되어야 한다.
  • 다운로드된 파일은 download_path에 저장되어야 한다.

요약 및 권장 사항

  • CentOS 5.5는 오래된 운영체제입니다. 가능하면 더 최신의 허니팟 솔루션(예: Cowrie) 또는 최신 OS에서 실행하는 것을 권장합니다.
  • Kippo 설치 전 Python과 의존성 버전을 확인하고, 각 라이브러리의 빌드 로그를 주의 깊게 확인하세요.
  • 허니팟은 분석 목적의 도구입니다. 수집한 데이터는 안전한 환경에서 분석하고, 민감 데이터가 포함되지 않도록 주의하세요.

참고 링크:

Notes: 이 가이드는 절차와 권장 사항을 설명합니다. 실제 배포 전 테스트 환경에서 충분히 검증하세요.

공유하기: X/Twitter Facebook LinkedIn Telegram
저자
편집

유사한 자료

Excel XLOOKUP으로 다중 조건 조회하는 방법
엑셀

Excel XLOOKUP으로 다중 조건 조회하는 방법

rtGui를 rTorrent에 구성하는 방법
튜토리얼

rtGui를 rTorrent에 구성하는 방법

인스타그램 약관 위반 계정 복구 가이드
소셜 미디어

인스타그램 약관 위반 계정 복구 가이드

CentOS 5.5에 Kippo SSH 허니팟 설치 가이드
서버 보안

CentOS 5.5에 Kippo SSH 허니팟 설치 가이드

카메라 롤 스캔 차단 및 권한 검사 가이드
프라이버시

카메라 롤 스캔 차단 및 권한 검사 가이드

YouTube 검색 기록 확인 및 삭제 가이드
Privacy

YouTube 검색 기록 확인 및 삭제 가이드