关于安全扫描漏洞修复的问题(配置yum源--安装telnet--安装openssl--安装openssh--修改22端口)

这篇具有很好参考价值的文章主要介绍了关于安全扫描漏洞修复的问题(配置yum源--安装telnet--安装openssl--安装openssh--修改22端口)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

流程:配置yum源--安装telnet--安装openssl--安装openssh--修改22端口(看具体情况)--关闭并卸载telnet

1、主机配置yum源

#本地yum源配置
cd /etc/yum.repos.d/
mkdir baks
mv *.repo baks/
vi local.repo

#添加如下本地yum源
[base]
name=CentOS-$releasever - Base - local
failovermethod=priority
baseurl=http://172.168.1.199:18686/software/yum/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://172.168.1.199:18686/software/yum/RPM-GPG-KEY-CentOS-7

#执行命令
yum clean all   表示删除原来的yum源文件索引
yum makecache   重新缓存新的yum源文件索引

2、安装telnet

安装前,可以使用ssh -V以及openssl version查询一下当前版本:

[root@home-lsolation-02 ~]# ssh -V
OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013
[root@home-lsolation-02 ~]# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013


1,安装telnet
先查看原服务器有无安装telnet:

rpm -qa | grep telnet
如果在返回中没有telnet-server,就代表并未安装telnet服务端,执行下面操作即可。

直接安装这三个软件:
yum -y install telnet telnet-server xinetd
#进行一些配置:
systemctl enable xinetd.service
systemctl enable telnet.socket
#启动telnet服务:
systemctl start telnet.socket
systemctl start xinetd
#使用netstat -antpl | grep 23,如果有返回值,则说明安装成功
netstat -antpl | grep 23
tcp6       0      0 :::23                   :::*                    LISTEN      1/systemd   
配置telnet连接方式:
vi /etc/securetty
然后在下面添加这几行:

pts/0
pts/1
pts/2
pts/3
配置完毕之后,使用如下命令,会看到的是这样:

[root@localhost ~]# tail -5 /etc/securetty
xvc0
pts/0
pts/1
pts/2
pts/3
在防火墙上开放23端口:

[root@localhost ~]# firewall-cmd --zone=public --add-port=23/tcp --permanent
success
重启防火墙:

[root@localhost ~]# firewall-cmd --reload
success
查看防火墙上开放的服务:

[root@localhost ~]# firewall-cmd --list-services
dhcpv6-client ssh telnet
可以看到,其中有telnet了。

退出ssh,使用telnet远程连接,以下均是在telnet连接下的操作。

3、安装openssl

1,安装openssl
先查看原服务器有无安装openssl;

2,备份
[root@localhost ~]# cp -r /etc/pam.d /etc/pam.d.bak
[root@localhost ~]# cp -af  /usr/bin/openssl  /usr/bin/openssl.old
[root@localhost ~]# cp -af  /etc/pki/ca-trust/extracted/openssl  /etc/pki/ca-trust/extracted/openssl.old
[root@localhost ~]# cp -af  /usr/lib64/openssl /usr/lib64/openssl.old
[root@localhost ~]# cp -af  /usr/lib64/libcrypto.so.10  /usr/lib64/libcrypto.so.10.old
[root@localhost ~]# cp -af  /usr/lib64/libssl.so.10  /usr/lib64/libssl.so.10.old 
[root@localhost ~]# cp -arf /etc/ssh/ /etc/ssh_old

3,关闭selinux并重启
[root@localhost ~]# vim /etc/sysconfig/selinux
将其中的SELINUX=enforcing改为SELINUX=disabled

4,升级openssl


#下载openssl:https://ftp.openssl.org/source
#解压:
tar -zxvf openssl-1.1.1l.tar.gz
[root@localhost ~]# ls
openssl-1.1.1l  openssl-1.1.1l.tar.gz
#进入openssl目录:

[root@localhost ~]# cd openssl-1.1.1l/

#清理旧文件并安装依赖包:
[root@localhost ~]# yum remove -y openssl
[root@localhost ~]# yum remove -y openssh
[root@localhost ~]# yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel  pam-devel cpan
[root@localhost ~]# yum install -y pam* zlib* perl*

#检查文件并移走备份:
[root@localhost openssl-1.1.1l]# ll /usr/bin/openssl
[root@localhost openssl-1.1.1l]# mv /usr/bin/openssl /usr/bin/openssl_bak
[root@localhost openssl-1.1.1l]# ll /usr/include/openssl
[root@localhost openssl-1.1.1l]# mv /usr/include/openssl /usr/include/openssl_bak

#编译安装:
[root@localhost openssl-1.1.1l]# ./config --prefix=/usr/local --openssldir=/usr/local/openssl && make && make install

#再次安装:
[root@localhost openssl-1.1.1l]# ./config shared && make && make install

#检查编译安装结果,如果输出为0,则代表安装成功:
[root@localhost openssl-1.1.1l]# echo $?
0

#配置openssl:
[root@localhost openssl-1.1.1l]# ln -s /usr/local/bin/openssl /usr/bin/openssl
[root@localhost openssl-1.1.1l]# ln -s /usr/local/include/openssl /usr/include/openssl
[root@localhost openssl-1.1.1l]# ll /usr/bin/openssl
lrwxrwxrwx. 1 root root 22 Sep 17 16:19 /usr/bin/openssl -> /usr/local/bin/openssl
[root@localhost openssl-1.1.1l]# ll /usr/include/openssl -ld
drwxr-xr-x. 2 root root 4096 Sep 17 16:19 /usr/include/openssl
[root@localhost openssl-1.1.1l]# echo "/usr/local/lib" >> /etc/ld.so.conf
[root@localhost openssl-1.1.1l]# echo "/usr/local/lib64/" >> /etc/ld.so.conf
[root@localhost openssl-1.1.1l]# /sbin/ldconfig
[root@localhost openssl-1.1.1l]# cp  libcrypto.so.1.1  libssl.so.1.1 /usr/lib64

#安装成功,查看openssl版本:
[root@localhost openssl-1.1.1l]# openssl version
OpenSSL 1.1.1l  24 Aug 2021

4、安装openssh

下载openssh:https://openbsd.hk/pub/OpenBSD/OpenSSH/portable

#解压:
[root@localhost ~]# tar -zxvf openssh-8.8p1.tar.gz

#进入openssh目录:
[root@localhost ~]# cd openssh-8.8p1/
[root@localhost openssh-8.8p1]# 

#编译文件:
[root@localhost openssh-8.8p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam  --with-ssl-dir=/usr/local/openssl --with-zlib=/usr/local/lib64 --without-hardening

#最后应该为这个样子:
config.status: config.h is unchanged

OpenSSH has been configured with the following options:
                     User binaries: /usr/bin
                   System binaries: /usr/sbin
               Configuration files: /etc/ssh
                   Askpass program: /usr/libexec/ssh-askpass
                      Manual pages: /usr/share/man/manX
                          PID file: /var/run
  Privilege separation chroot path: /var/empty
            sshd default user PATH: /usr/bin:/bin:/usr/sbin:/sbin
                    Manpage format: doc
                       PAM support: yes
                   OSF SIA support: no
                 KerberosV support: no
                   SELinux support: no
              MD5 password support: yes
                   libedit support: no
                   libldns support: no
  Solaris process contract support: no
           Solaris project support: no
         Solaris privilege support: no
       IP address in $DISPLAY hack: no
           Translate v4 in v6 hack: yes
                  BSD Auth support: no
              Random number source: OpenSSL internal ONLY
             Privsep sandbox style: seccomp_filter
                   PKCS#11 support: yes
                  U2F/FIDO support: yes

              Host: x86_64-pc-linux-gnu
          Compiler: cc
    Compiler flags: -g -O2 -pipe -Wall -Wextra -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-parameter -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -fstack-protector-strong  
Preprocessor flags: -I/usr/local/openssl -I/usr/local/lib64  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE
      Linker flags: -L/usr/local/openssl -L/usr/local/lib64  -fstack-protector-strong 
         Libraries: -lcrypto -ldl -lutil -lz  -lcrypt -lresolv
         +for sshd:  -lpam

PAM is enabled. You may need to install a PAM control file 
for sshd, otherwise password authentication may fail. 
Example PAM control files can be found in the contrib/ 
subdirectory

#检查输出结果:
[root@localhost openssh-8.8p1]# echo $?
0
为0说明编译正常。

安装:

[root@localhost openssh-8.8p1]# make
[root@localhost openssh-8.8p1]# echo $?
0
[root@localhost openssh-8.8p1]# chmod 600 /etc/ssh/ssh_host*
[root@localhost openssh-8.8p1]# make install
[root@localhost openssh-8.8p1]# echo $?
0


配置ssh并启动:

[root@localhost openssh-8.8p1]# echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
[root@localhost openssh-8.8p1]# grep "^PermitRootLogin"  /etc/ssh/sshd_config
PermitRootLogin yes
[root@localhost openssh-8.8p1]# echo "UseDNS no" >> /etc/ssh/sshd_config
[root@localhost openssh-8.8p1]# grep  "UseDNS"  /etc/ssh/sshd_config 
#UseDNS no
UseDNS no
[root@localhost openssh-8.8p1]# cp -a contrib/redhat/sshd.init /etc/init.d/sshd
[root@localhost openssh-8.8p1]# cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
[root@localhost openssh-8.8p1]# chmod +x /etc/init.d/sshd
[root@localhost openssh-8.8p1]# chkconfig --add sshd
[root@localhost openssh-8.8p1]# systemctl enable sshd
sshd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig sshd on
[root@localhost openssh-8.8p1]# chkconfig sshd on
移走原先服务,有报错可以无视:

[root@localhost openssh-8.8p1]# mv /usr/lib/systemd/system/sshd.service  /home/
mv: cannot stat ‘/usr/lib/systemd/system/sshd.service’: No such file or directory
重启sshd:

[root@localhost openssh-8.8p1]# /etc/init.d/sshd restart
Restarting sshd (via systemctl):                           [  OK  ]
查看是否正常开放:

[root@localhost openssh-8.7p1]# netstat -antpl
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      784/rpcbind         
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1804/dnsmasq        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      107261/sshd: /usr/s 
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1309/cupsd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1660/master         
tcp6       0      0 :::111                  :::*                    LISTEN      784/rpcbind         
tcp6       0      0 :::22                   :::*                    LISTEN      107261/sshd: /usr/s 
tcp6       0      0 :::23                   :::*                    LISTEN      1/systemd           
tcp6       0      0 ::1:631                 :::*                    LISTEN      1309/cupsd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      1660/master         
tcp6       0      2 192.168.145.139:23      192.168.145.2:1205      ESTABLISHED 1/systemd   
查看版本:

[root@localhost openssh-8.7p1]# ssh -V
OpenSSH_8.7p1, OpenSSL 1.1.1l  24 Aug 2021

5、修改22端口(此步骤如果没需求可以不用操作)

[root@home-lsolation-02 openssh-8.8p1]# vi /etc/ssh/sshd_config

找到Port=22
然后取消Port=22前面的注释
并修改Port=22为Port=22222
重启sshd即可
[root@home-lsolation-02 openssh-8.8p1]# service sshd restart
Restarting sshd (via systemctl):                           [  确定  ]
[root@home-lsolation-02 openssh-8.8p1]# 


---------------------------------------------------关闭并卸载telnet------------------------------------------------------------------

6,关闭并卸载telnet
[root@localhost ~]# systemctl disable xinetd.service
Removed symlink /etc/systemd/system/multi-user.target.wants/xinetd.service.
[root@localhost ~]# systemctl stop xinetd.service
[root@localhost ~]# systemctl disable telnet.socket
Removed symlink /etc/systemd/system/sockets.target.wants/telnet.socket.
[root@localhost ~]# systemctl stop telnet.socket
[root@localhost ~]# netstat -antpl
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      750/rpcbind         
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1502/dnsmasq        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1245/sshd: /usr/sbi 
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1191/cupsd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1509/master         
tcp        0     36 192.168.145.139:22      192.168.145.2:15925     ESTABLISHED 1996/sshd: root@pts 
tcp6       0      0 :::111                  :::*                    LISTEN      750/rpcbind         
tcp6       0      0 :::22                   :::*                    LISTEN      1245/sshd: /usr/sbi 
tcp6       0      0 ::1:631                 :::*                    LISTEN      1191/cupsd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      1509/master                    
结束!
 文章来源地址https://www.toymoban.com/news/detail-789570.html

到了这里,关于关于安全扫描漏洞修复的问题(配置yum源--安装telnet--安装openssl--安装openssh--修改22端口)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Nessus漏洞扫描以及OpenSSH漏洞修复验证

    主机 IP地址 资源 kali 192.168.200.128 5GB内存/4CPU CentOS7.5 192.168.200.129 2GB内存/2CPU https://www.tenable.com/downloads/nessus?loginAttempted=true 中间有注册激活账户的信息照实际情况填就行 username:admin password:123456 初始化完就进来了 这里在线激活只有16个IP地址可供使用,所以可以给虚拟机打个快

    2024年02月13日
    浏览(35)
  • debian12网络静态ip配置-OSSIM 安全漏洞扫描系统平台

    本配置适合于服务器上的静态ip配置,该方法简单可靠。 1 临时配置 ifconfig eth0 192.168.1.97 netmask 255.255.255.0 broadcast 192.168.1.255 ip route add default via 192.168.1.1 2 主要的网络配置文件 /etc/network/interfaces /etc/resolv.conf 3 配置ip、netmask和gateway 在/etc/network/interfaces里面加上: auto eth0 (这个

    2024年02月11日
    浏览(28)
  • Web安全漏洞扫描神器-AWVS下载、安装及使用教程

    目录 一、AWVS介绍 二、网站漏洞扫描 三、漏洞扫描结果 四、漏洞告警分析利用 五、根据漏洞信息进行验证、利用 六、网络爬虫 七、主机发现(c段探测) 八、子域名探测 九、SQL注入 十、HTTP头编辑 十一、HTTP监听拦截 AWVS为Acunetix Web Vulnarability Scanner的简称,是一种web网站漏

    2024年02月08日
    浏览(39)
  • 漏洞扫描工具AWVS的安装及配置使用过程

    Acunetix Web Vulnerability Scanner(AWVS)可以扫描任何通过Web浏览器访问和遵循HTTP/HTTPS规则的Web站点。适用于任何中小型和大型企业的内联网、外延网和面向客户、雇员、厂商和其它人员的Web网站。 AWVS可以通过检查SQL注入攻击漏洞、XSS跨站脚本攻击漏洞等漏洞来审核Web应用程序的

    2023年04月16日
    浏览(31)
  • 渗透测试——安全漏洞扫描工具APPScan的安装与基本使用步骤

            HCL AppScan Standard是安全专家和渗透测试者设计的动态应用程序安全测试工具,AppScan使用强大的扫描引擎,会自动检索目标应用程序并测试漏洞。测试结果按优先级排列,允许操作员快速分类问题、发现最关键的漏洞。每个检测到的问题都可以根据清晰且可操作的修

    2024年02月09日
    浏览(33)
  • weblogic 修改控制台路径或禁用控制台,解决weblogic安全扫描访问路径漏洞问题

    在⼀些安全漏洞扫描中,经常会扫描发现,使⽤weblogic管理控制台,会有个中危的漏洞。 出于安全的考虑需要对weblogic的console进行屏避,或者修改默认的访问路径,主要有两种方法,任选一种即可:(这里针对weblogic 11g 10.3.6.0) 1、进入默认的控制台,例如“localhost/console”

    2024年02月11日
    浏览(48)
  • SonarQube扫描常见Bug、漏洞修复整理(持续更新中)

    这种提示是指可能存在空指针异常,需要增加空值检测。 说明:未做非空校验,可能产生空指针 解决方案:加上非空校验 解决方式:先判断或者先实例化,再访问里面的属性或者成员。 说明:int数运算最终再把结果转为long将有可能产生溢出 说明:防止内存泄露溢出,Thr

    2024年02月15日
    浏览(38)
  • Microsoft 已经发布了5月份关于修复其产品中安全问题的报告。

      🔥 Microsoft 已经发布了5月份关于修复其产品中安全问题的报告。注意这个报告中的趋势性漏洞。   💻随着研究背景的获得,CVE-2023-29324获得了意义。 什么是风险: 所有支持的Windows版本都受到影响--该漏洞是对MSHTML安全机制的一种绕过。 它能导致什么? 攻击者可以创建

    2024年02月08日
    浏览(24)
  • SSL/TLS RC4 信息泄露漏洞(CVE-2013-2566)【原理扫描】修复方案

    SSL/TLS协议 RC4信息泄露漏洞被扫描出来,一般出现的问题在ssh和https服务上使用了RC4算法,修改配置文件就可以了 1.使用nmap扫描出来: nmap -sV --script ssl-enum-ciphers -p 443 ip 2.使用绿盟扫描 扫描出来显示CVE-2013-2566 apache: 1.禁止apache服务器使用RC4加密算法 2.重启apache服务 Nginx: 1.禁

    2024年02月16日
    浏览(26)
  • 记录Windows Server CVE-2016-2183/CVE-2015-2808/CVE-2013-2566原理扫描漏洞修复

    *漏洞扫描出如下漏洞,针对标记的三个进行漏洞修复。 *关键:禁用3DES/RC4加密 1.Win+R运行:regedit,进入注册表。 2.进入目录:[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSecurityProvidersSCHANNELCiphers 3.在Ciphers下新建5个项,分别对应如下,进行命名: RC4 40/128 、RC4 56/128、RC4 64/128、

    2024年02月13日
    浏览(35)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包