使用 stunnel 保护 telnet 连接

Curt Warfield 的头像

·

·

·

8,336 次阅读

Telnet 是一种客户端-服务端协议,通过 TCP 的 23 端口连接到远程服务器。Telnet 并不加密数据,因此它被认为是不安全的,因为数据是以明文形式发送的,所以密码很容易被嗅探。但是,仍有老旧系统需要使用它。这就是用到 stunnel 的地方。

stunnel 旨在为使用不安全连接协议的程序增加 SSL 加密。本文将以 telnet 为例介绍如何使用它。

服务端安装

使用 sudo 安装 stunnel 以及 telnet 的服务端和客户端:

sudo dnf -y install stunnel telnet-server telnet

添加防火墙规则,在提示时输入你的密码:

firewall-cmd --add-service=telnet --perm
firewall-cmd --reload

接下来,生成 RSA 私钥和 SSL 证书:

openssl genrsa 2048 > stunnel.key
openssl req -new -key stunnel.key -x509 -days 90 -out stunnel.crt

系统将一次提示你输入以下信息。当询问 Common Name 时,你必须输入正确的主机名或 IP 地址,但是你可以按回车键跳过其他所有内容。


You are about to be asked to enter information that will be
incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.

via: <https://fedoramagazine.org/securing-telnet-connections-with-stunnel/>

作者:[Curt Warfield](https://fedoramagazine.org/author/rcurtiswarfield/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)

本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注