赞
踩
- #!/bin/bash
- # 安装编译环境
- yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel pam* zlib*
-
-
- # 【openssl】
- # 备份当前openssl
- mv /usr/bin/openssl /usr/bin/openssl_bak
- mv /usr/include/openssl /usr/include/openssl_bak
-
-
- # 编译安装openssl
- tar xf openssl-1.1.1o.tar.gz
- cd openssl-1.1.1o
- ./config shared && make && make install
-
- cp libssl.so.1.1 /usr/lib64/
- cp libcrypto.so.1.1 /usr/lib64/
- ln -s /usr/local/include/openssl /usr/include/openssl
- echo "/usr/local/lib64" >> /etc/ld.so.conf
- /sbin/ldconfig
- openssl version
-
- # 创建软连接 openssl-1.1.1o 这个版本
- ln -s /usr/local/bin/openssl /usr/bin/openssl
- ln -s /usr/local/include/openssl /usr/include/openssl
-
-
-
- # 【openssh】
- # 编译安装
- https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.5p1.tar.gz
- tar xf openssh-9.5p1.tar.gz
- cd openssh-9.5p1
-
- # 隐藏版本号
- sed -i 's/OpenSSH_9.0/OpenSSH_899/g' version.h
-
-
- wget "http://hello.ejoydom.com:19009/static/openssh-9.3p1.tar.gz"
- ./configure --prefix=/usr/local/myssh_9.5p1 --sysconfdir=/usr/local/myssh_9.5p1/ssh --with-openssl-includes=/usr/include/openssl --with-ssl-dir=/usr/local/lib64 --with-privsep-user=sshd --with-zlib --with-pam
-
-
- make && make install
-
- # 备份openssh
- mv /etc/init.d/sshd /etc/init.d/sshd1124.bak
- mv /usr/sbin/sshd /usr/sbin/sshd1124.bak
- mv /etc/ssh/sshd_config /etc/ssh/sshd_config1124.bak
- mv /usr/bin/ssh /usr/bin/ssh1124.bak
-
-
- # 创建软连接
- cp contrib/redhat/sshd.init /etc/init.d/sshd
- ln -s /usr/local/myssh_9.5p1/sbin/sshd /usr/sbin/sshd
- ln -s /usr/local/myssh_9.5p1/ssh/sshd_config /etc/ssh/sshd_config
- ln -s /usr/local/myssh_9.5p1/bin/ssh /usr/bin/ssh
-
- # 复制sshd启动脚本
- # 允许root用户远程连接
- #sed -i '20a PermitRootLogin yes' /usr/local/myssh_9.3p1/ssh/sshd_config
-
- # 避开绿盟安全扫描
- echo "Protocol 2" >> /usr/local/myssh_9.3p1/ssh/sshd_config
- echo "Banner /etc/ssh_banner" >> /usr/local/myssh_9.3p1/ssh/sshd_config
- # 禁止dns解析
- sed -i 's/#UseDNS no/UseDNS no/g' /usr/local/myssh_9.3p1/ssh/sshd_config
-
- # 不移走的话影响启动
- mv /usr/lib/systemd/system/sshd.service /root/
- chkconfig sshd on
-
- # 重启sshd (默认不许root登录 )
- systemctl restart sshd
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。