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 はこれ以上使用すべきではないと読んだことがありますが、さらに詳しく調べてみます。