历史Linux镜像处理及修复方案

 更新时间:2018年09月30日 14:14:45   投稿:laozhang  
在本文中我们给大家整理了关于如何对于历史Linux镜像的问题进行修复处理的相关内容,有需要的朋友们参考下。

历史Linux镜像创建的ECS云服务器,可能存在NTP没有配置,YUM没有配置,还可能存在最近暴漏较高的安全漏洞,请按照以下步骤进行修复,可以让您的云服务器更加安全,还可以使用阿里云提供的YUM服务进行安装软件,可以使用免费的阿里云提供的NTP进行时间同步。

1. 配置NTP

不区分发行版,先备份 /etc/ntp.conf,然后将其内容替换为如下:

# ntp.conf
#
# ntpd config for aliyun ecs.
#
# 6LAN+6LAN+3WAN
#        shijun.cao@alibaba-inc.com
#        2014.8.11
#
driftfile /var/lib/ntp/drift
pidfile  /var/run/ntpd.pid
logfile /var/log/ntp.log
# Access Control Support
restrict  default ignore
restrict -6 default ignore
restrict 127.0.0.1
restrict 192.168.0.0 mask 255.255.0.0 nomodify notrap nopeer noquery
restrict 172.16.0.0 mask 255.240.0.0 nomodify notrap nopeer noquery
restrict 100.64.0.0 mask 255.192.0.0 nomodify notrap nopeer noquery
restrict 10.0.0.0 mask 255.0.0.0 nomodify notrap nopeer noquery
restrict ntp1.aliyun.com nomodify notrap nopeer noquery
restrict ntp2.aliyun.com nomodify notrap nopeer noquery
restrict ntp3.aliyun.com nomodify notrap nopeer noquery
restrict ntp4.aliyun.com nomodify notrap nopeer noquery
restrict ntp5.aliyun.com nomodify notrap nopeer noquery
restrict ntp6.aliyun.com nomodify notrap nopeer noquery
# local clock
server 127.127.1.0
fudge 127.127.1.0 stratum 10
#public ntp server
server ntp1.aliyun.com iburst minpoll 4 maxpoll 10
server ntp2.aliyun.com iburst minpoll 4 maxpoll 10
server ntp3.aliyun.com iburst minpoll 4 maxpoll 10
server ntp4.aliyun.com iburst minpoll 4 maxpoll 10
server ntp5.aliyun.com iburst minpoll 4 maxpoll 10
server ntp6.aliyun.com iburst minpoll 4 maxpoll 10
#Private ntp server
server ntp1.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp2.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp3.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp4.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp5.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp6.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
#New private ntp server
server ntp7.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp8.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp9.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp10.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp11.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
server ntp12.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

2. 更新软件源

0 . 先确认镜像当前的 Linux 系统发行版和版本号。

如果有 lsb_release 命令,执行:

lsb_release -a

否则执行

cat /etc/issue

1 . 对于 CentOS,备份 /etc/yum.repos.d/ 下的 CentOS-Base.repo 和 epel.repo 文件,根据 CentOS 版本,执行如下相应的命令:

CentOS 5:

wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo
CentOS 6:
wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
CentOS 7:
wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

repo 文件下载完成后,执行:

yum makecache

2 . 对于 Aliyun 5.7,备份 /etc/yum.repos.d/CentOS-Base.repo ,然后执行:

wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/aliyun-5.repo

repo 文件下载完成后,执行:

yum makecache

3 . 对于 Ubuntu,备份 /etc/apt/sources.list 文件,根据发行版版本,执行命令:

ubuntu12.04:
wget -qO /etc/apt/sources.list http://mirrors.aliyun.com/repo/ubuntu1204-lts.list
ubuntu14.04:
wget -qO /etc/apt/sources.list http://mirrors.aliyun.com/repo/ubuntu1404-lts.list

然后执行:

apt-get update

4 . 对于 Debian,备份 /etc/apt/sources.list 文件,根据发行版版本,执行命令:

debian6:
wget -qO /etc/apt/sources.list http://mirrors.aliyun.com/repo/debian6-lts.list
debian7:
wget -qO /etc/apt/sources.list http://mirrors.aliyun.com/repo/debian7-lts.list

然后执行:

apt-get update

3. 安全漏洞修复补丁

主要修复目前已知的重大安全漏洞,需要升级的软件包括: bash 、glibc 、 openssl 、wget 、ntp 。

在执行如下命令之前,需要确保系统当前的软件源已经设置正确。

1 . 对于 CentOS 和 Aliyun Linux,执行:

yum update bash glibc openssl wget ntp

2 . 对于 Ubuntu 和 Debian,执行:

apt-get install bash libc6 libc-bin openssl wget ntp

 

相关文章

  • 详解如何使用Spark和Scala分析Apache访问日志

    详解如何使用Spark和Scala分析Apache访问日志

    这篇文章主要介绍了详解如何使用Spark和Scala分析Apache访问日志,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2019-06-06
  • Linux如何使用HTTP进行远程系统监控

    Linux如何使用HTTP进行远程系统监控

    这篇文章主要介绍了Linux如何使用HTTP进行远程系统监控问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
    2024-11-11
  • 详解如何在Linux上一次性批量重命名一组文件

    详解如何在Linux上一次性批量重命名一组文件

    这篇文章主要介绍了详解如何在Linux上一次性批量重命名一组文件,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2019-11-11
  • Ubuntu安装scrcpy完成手机投屏和控制(Ubuntu用QQ微信的另一种方法)

    Ubuntu安装scrcpy完成手机投屏和控制(Ubuntu用QQ微信的另一种方法)

    这篇文章主要介绍了Ubuntu安装scrcpy手机投屏和控制(Ubuntu用QQ微信的另一种方法),这样的话不用频繁在键盘和手机间切换了 ,需要的朋友可以参考下
    2019-10-10
  • ubuntu中snap包的安装、更新删除与简单使用

    ubuntu中snap包的安装、更新删除与简单使用

    Ubuntu 16.04引入了snap包管理,它是一种全新的软件包安装管理方式。它和dpkg/apt有本质的区别。下面这篇文章就来给大家详细介绍了关于ubuntu中snap包的安装、更新删除与简单使用的相关资料,需要的朋友可以参考借鉴,下面随着小编来一起学习学习吧。
    2017-11-11
  • linux网络参数配置方法详解

    linux网络参数配置方法详解

    这篇文章主要介绍了linux网络参数的配置方法,这样可以让你的服务器访问网络,主要参数:IP地址、子网掩码、网关、DNS
    2013-11-11
  • 在LINUX系统上使用rsync命令详解

    在LINUX系统上使用rsync命令详解

    rsync是一款多功能的文件同步工具,支持增量备份,减少数据传输时间和带宽,它可以与不同的shell和协议配合使用,确保数据传输的安全性,提供了详细的安装和使用指南,适用于多种Linux发行版,使用户能够轻松掌握和应用,Rsync的命令选项丰富
    2024-10-10
  • Apache tika 实现各种文档内容解析示例代码

    Apache tika 实现各种文档内容解析示例代码

    这篇文章主要介绍了Apache tika 实现各种文档内容解析,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友跟随小编一起看看吧
    2024-07-07
  • apache日志文件详解和实用分析命令

    apache日志文件详解和实用分析命令

    这篇文章主要介绍了apache日志文件每条数据的请意义,以及一些实用日志分析命令,需要的朋友可以参考下
    2014-03-03
  • SSM项目频繁打成war包部署,使用tomcat和maven实现热部署配置

    SSM项目频繁打成war包部署,使用tomcat和maven实现热部署配置

    这篇文章主要介绍了SSM项目频繁打成war包部署操作频繁?使用tomcat和maven实现热部署配置,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
    2019-11-11

最新评论