Welcome 微信登录

首页 / 操作系统 / Linux / 在Debian 7/Ubuntu 13.10 上使用隧道封装SSH连接

隧道 被设计用于远端客户端和本地(可通过inetd启动)或远端服务器间的SSL加密封装。它可以用于为inetd进程增加SSL功能,像POP2(译注:厄,POP2这个服务还有人用么?),POP3和IMAP服务而不必改变程序代码。隧道使用OpenSSL库用于加密,因此它支持任何被编译进库的加密算法。简而言之,隧道可以使任何一个不安全的端口变得安全加密。在本篇中,我会描述如何通过SSL水稻封装SSH。这个步骤非常简单。你需要在你的客户端PC和远程PC都已经安装运行了sshd。我正在使用下面提到的两个系统。远程系统:操作系统: Debian 7IP 地址: 192.168.1.200/24客户端(本地) 系统:操作系统: Ubuntu 13.04 desktopIP 地址: 192.168.1.100/24

配置远程系统

让我们在远程Debian 7服务器上安装stunnel包。# apt-get install stunnel4现在让我们像下面那样创建一个SSL证书。# openssl genrsa 1024 > stunnel.key示例输出:Generating RSA private key, 1024 bit long modulus............................................++++++...................++++++e is 65537 (0x10001)# openssl req -new -key stunnel.key -x509 -days 1000 -out stunnel.crt你会被询问若干个问题如国家、州、公司细节等。You are about to be asked to enter information that will be incorporatedinto 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 blankFor some fields there will be a default value,If you enter ".", the field will be left blank.-----Country Name (2 letter code) [AU]:INState or Province Name (full name) [Some-State]:TamilnaduLocality Name (eg, city) []:ErodeOrganization Name (eg, company) [Internet Widgits Pty Ltd]:unixmenOrganizational Unit Name (eg, section) []:TechnicalCommon Name (e.g. server FQDN or YOUR name) []:server.unixmen.comEmail Address []:sk@unixmen.com# cat stunnel.crt stunnel.key > stunnel.pem# mv stunnel.pem /etc/stunnel/现在我们需要配置stunnel来将 443(https)隧道到22(ssh)。这可以通过在/etc/stunnel/目录下创建stunnel.conf文件来实现: # vi /etc/stunnel/stunnel.conf并加入下面的行:pid = /var/run/stunnel.pidcert = /etc/stunnel/stunnel.pem[ssh]accept = 192.168.1.200:443connect = 127.0.0.1:22上面的几行说明了stunnel在哪里寻找证书文件和哪里接收和转发ssh链接。在本例中,stunnel会接收来自443端口的流量并会转发给22端口。保存并关闭文件。现在让我们启用stunnel服务。要这么做,编辑文件 /etc/default/stunnel4:# vi /etc/default/stunnel4改变行从 ENABLED = 01。# /etc/default/stunnel# Julien LEMOINE <speedblue@debian.org># September 2003# Change to one to enable stunnel automatic startupENABLED=1FILES="/etc/stunnel/*.conf"OPTIONS=""# Change to one to enable ppp restart scriptsPPP_RESTART=0接着使用命令启用stunnel服务:# service stunnel4 start  更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2 相关阅读:Ubuntu 下配置 SSH服务全过程及问题解决 http://www.linuxidc.com/Linux/2011-09/42775.htmUbuntu 12.04下安装Git,SSH及出现的Permission denied解决办法 http://www.linuxidc.com/Linux/2013-06/85336.htmUbuntu 12.10下OpenSSH的离线安装方法 http://www.linuxidc.com/Linux/2013-04/82814.htmUbuntu下SSH安装或设置 http://www.linuxidc.com/Linux/2013-07/87368.htm
  • 1
  • 2
  • 下一页
Ubuntu使用教程:合上笔记本,系统不睡眠Linux下ntop网络监控的安装与配置相关资讯      SSH  SSH连接 
  • SSH/SSL 源码编译安装简易操作说明  (今 07:03)
  • Mac使用ssh出现permission denied(  (03月23日)
  • Mac OS X下配置远程Linux 服务器  (12/22/2015 15:21:41)
  • Teleport:面向集群及团队的 SSH  (04月11日)
  • 如何在 CentOS / RHEL 上设置 SSH   (01月18日)
  • SSH相互信任配置  (12/20/2015 19:58:17)
本文评论 查看全部评论 (0)
表情: 姓名: 字数