Chinaunix首页 | 论坛 | 博客
  • 博客访问: 233993
  • 博文数量: 29
  • 博客积分: 1224
  • 博客等级: 中尉
  • 技术积分: 415
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-23 19:05
文章分类

全部博文(29)

文章存档

2013年(1)

2012年(1)

2011年(22)

2008年(5)

分类: LINUX

2011-12-18 18:42:14

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目录



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目录



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
五 关闭Telnet远程管理,
六 OpenSSH更新完成!
文章出处:DIY部落(#)
 
阅读(8300) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~