Openssh+Openssl更新步骤

 Openssh+Openssl更新步骤
  
一、关闭并卸载自带的Openssh
1.0 开启Telnet远程管理
# vi /etc/xinetd.d/telnet
# default: on
# description: The telnet server serves telnet sessions; it uses \
#       unencrypted username/password pairs for authentication.
service telnet
{
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/sbin/in.telnetd
        log_on_failure  += USERID
        disable         = no
}
#/# /etc/init.d/xinetd restart 开启Telnet远程管理
# netstat -tnlp | grep :23
注意;以普通用户登录 后切换root
1.1 停止SSHD服务
#/sbin/service sshd stop
cp /etc/init.d/sshd  /root/ 备份复制启动脚本  
1.2 卸载Openssh
  
#rpm -e openssh --nodeps
#rpm -e openssh-server --nodeps
#rpm -e openssh-clients --nodeps
#rpm -e openssh-askpass-gnome
#rpm -e openssh-askpass
  
二、下载安装最新的openssl和openssh
  
2.1 下载相关软件包至/usr/local/src目录  
  
http://www.openssl.org/source/openssl-0.9.8i.tar.gz

  
2.2 安装openssl
  
#cd /usr/local/src
#tar zxvf openssl-0.9.8i.tar.gz
#cd openssl-0.9.8i
#./config shared zlib
#make  
#make test
#make install
mv /usr/bin/openssl /usr/bin/openssl.OFF
mv /usr/include/openssl /usr/include/openssl.OFF
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
  
2.3 配置库文件搜索路径
  
# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
# /sbin/ldconfig -v
  
2.4 查看openssl的版本号,以验正是否安装正确
#  openssl version -a
OpenSSL 0.9.8i 15 Sep 2008
built on: Mon Oct 13 18:43:54 CST 2008
platform. linux-elf
options:  bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) blo
ish(idx)
compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_
FCN -DHAVE_DLFCN_H -march=pentium -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer
Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DSHA1_ASM -DMD5_ASM -DRM
60_ASM -DAES_ASM
OPENSSLDIR: "/usr/local/ssl"
三、下载安装最新的zlib,openssh
3.0安装最新zlib软件包
# tar -zxvf zlib-1.2.3.tar.gz
#./config
#make
#make install
  
3.1 下载相关软件包至/usr/local/src目录  
  
ftp://openbsd.nsysu.edu.tw/BSD/OpenBSD/OpenSSH/portable/openssh-5.1p1.tar.gz

  
3.2 安装
  
#cd /usr/local/src
#tar zxvf openssh-5.1p1.tar.gz
#cd openssh-5.1p1
#./configure --prefix=/usr/local/ssh --sysconfdir=/etc/ssh --with-pam --with-zlib --with-ssl-dir=/usr/local/ssl --with-md5-passwords --mandir=/usr/share/man  
#make  
#make install  
#cp /usr/local/ssh/bin/*     /usr/bin/
#cp /usr/local/ssh/sbin/*     /usr/sbin/
  
3.3 查看openssh版本号,验正安装结果
# ssh -v
OpenSSH_5.1p1, OpenSSL 0.9.8i 15 Sep 2008
usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-e escape_char] [-F configfile]
           [-i identity_file] [-L [bind_address:]port:host:hostport]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-R [bind_address:]port:host:hostport] [-S ctl_path]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
  
四、启动并验正服务的开启状况
  
4.1 调试启动,如果以下显示均正常,就可以正常启动sshd了。
  
#/usr/sbin/sshd -d
debug1: sshd version OpenSSH_4.6p1
debug1: private host key: #0 type 0 RSA1
debug1: read PEM private key done: type RSA
debug1: private host key: #1 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #2 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
socket: Address family not supported by protocol
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
Generating 768 bit RSA key.
RSA key generation complete.
  
4.2 启动服务
  
#/usr/sbin/sshd
  
4.3 查看监听端口中是否有22
  
#netstat -tnlp | grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      21018/sshd  
4.4 增加开机启动服务:
cp /root/sshd  /etc/init.d/sshd
#chkconfig sshd
#chkconfig –-add sshd
#chkconfig –-level 345 sshd on
  
4.5 尝试从本机通过ssh登录
ssh
[email=root@localhost]root@localhost[/email]
五 关闭Telnet远程管理,
六 OpenSSH更新完成!


本文来自ChinaUnix博客,如果查看原文请点: http://blog.chinaunix.net/u/26125/showart_1730636.html

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25755772/viewspace-709539/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25755772/viewspace-709539/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值