Stunnel로 암호화

Stunnel로 암호화

저는 CentOS 서버에서 OTRS를 실행하고 있으며 MySQL DB는 CentOS의 원격 서버에서도 실행되고 있습니다. OTRS는 MySQL과의 암호화된 연결을 지원하지 않으므로 연결이 암호화되지 않습니다. stunnel을 사용하여 연결을 암호화하고 싶지만 구성에 실패했습니다. MySQL은 기본 포트 3306을 사용하고 있습니다.

OTRS = 10.0.0.4 MySQL = 10.0.0.3

#Sample stunnel configuration on OTRS Server

#Provide the full path to your certificate-key pair file

cert = /etc/pki/tls/certs/stunnel.pem

#lock the process into a chroot jail

chroot = /var/run/stunnel

# and create the PID file in this jail

pid = /stunnel.pid

#change the UID and GID of the process for security reasons
setuid = nobody
setgid = nobody

#enable client mode
client = yes


socket = l:TCP_NODELAY=1
#socket = r:TCP:NODELAY=1

[mysqls]
accept = 0.0.0.0:3306
connect = 10.0.0.3:3307

그리고 데이터베이스 서버의 구성 파일은 다음과 같습니다.

#Sample configuration file for MySQL

#Provide the full path to your certificate-key pair file
cert = /etc/pki/tls/certs/stunnel.pem

#Allow only TLS, thus avoiding SSL
sslVersion = TLSv1

#lock the process into a chroot jail
chroot = /var/run/stunnel

#change the UID and GID of the process for security reasons
setuid = nobody
setgid = nobody

pid = /stunnel.pid
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1

#Configure our secured MySQL Server
[mysqls]

accept = 3307
connect = 3306

OTRS 서버의 stunnel 구성 파일에 있는 부분이 잘못된 것 같습니다. 어떤 아이디어가 있나요?

수락 = 0.0.0.0:3306

답변1

알았어, 알아냈어.

Config.pm 파일의 데이터베이스 호스트 값을 데이터베이스 서버의 실제 IPv4 주소에서 127.0.0.1로 변경했습니다.

여기에 이미지 설명을 입력하세요

그런 다음 OTRS 상자에서 stunnel.conf를 구성하여 127.0.0.1:3306(기본적으로 OTRS는 표준 MySQL 포트에 연결됨)을 수신하고 데이터베이스 호스트의 실제 IPv$ 주소에 연결하지만 포트 3307에 연결합니다.

여기에 이미지 설명을 입력하세요

데이터베이스 서버에서 stunnel.conf는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

db 서버에서 tcpdump를 실행하고 Wireshark에서 .pcap을 분석하면 연결이 암호화되었으며 OTRS가 여전히 작동하는 것으로 나타났습니다.

여기에 이미지 설명을 입력하세요

stunnel.conf 파일이 제대로 구성되었는지 여부는 아직 모릅니다. 그러나 예를 들어 chroot를 더 이상 사용하면 안 되지만 더 깊이 파고들 것이라는 내용을 읽었습니다.

관련 정보