历史Linux镜像的问题修复方案

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

1. 配置NTP

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

# ntp.conf
#
# ntpd config for aliyun ecs.
#
# 6LAN+6LAN+3WAN
#               [email protected]
#               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
时间: 2024-07-30 13:51:59

历史Linux镜像的问题修复方案的相关文章

Linux Glibc库严重安全漏洞修复方案通知(腾讯开发者社区)

如何查看当前glibc的版本号? rpm -aq | grep glibc 尊敬的用户: 您好!2015年1月28日, 腾讯云安全情报监测到LinuxGlibc库存在一处严重安全漏洞,可以通过gethostbyname系列函数实现远程代码执行,获取服务器的控制权及Shell权限,漏洞详细点击这里查看. [影响版本]: Glibc2.2 ~ Glibc 2.18 [修复方案]:       1.通过官方渠道自助下载更新,升级到Glibc 2.19及其以上版本.官方已在Glibc 2.19及以上版本

Linux系统故障排查和修复技巧

Linux系统故障排查和修复技巧 任何操作系统都有出现故障的时候,Linux系统也不例外,在启动过程中可能会出现一些故障,从而导致系统无法正常启动.本文从单用户模式.GRUB命令操作.Linux救援模式这三个方面分析了故障排查和修复案例,来帮助大家解决此类问题. AD:2014WOT全球软件技术峰会北京站 课程视频发布 我发现Linux系统在启动过程中会出现一些故障,导致系统无法正常启动,我在这里写了几个应用单用户模式.GRUB命令操作.Linux救援模式的故障修复案例帮助大家了解此类问题的解决

Bash漏洞批量检测工具与修复方案

<img src="http://image.3001.net/images/20140928/14118931103311.jpg!small" title="shellshock-bug-bash-bashbug-938x535.jpg"/></strong></span>&a

【渗透测试】NSA Windows 0day漏洞+修复方案

这个漏洞是前段时间爆出来的,几乎影响了全球70%的电脑,不少高校.政府和企业都还在用Windows服务器,这次时间的影响力堪称网络大地震. ----------------------------------------------------------------------------------------------------------------------- 一.实验环境 本机IP:172.16.11.2  Windows 2003 本机IP:172.16.12.2  Kali

网站安全之逻辑漏洞检测 附网站漏洞修复方案

在网站安全的日常安全检测当中,我们SINE安全公司发现网站的逻辑漏洞占比也是很高的,前段时间某酒店网站被爆出存在高危的逻辑漏洞,该漏洞导致酒店的几亿客户的信息遭泄露,包括手机号,姓名,地址都被泄露,后续带来的损失很大,最近几年用户信息泄露的事件时有发生,给很多企业,酒店都上了一堂生动的安全课.关于网站逻辑漏洞的总结,今天跟大家详细讲解一下.网站逻辑漏洞 用户的隐私信息属于数据的保护的最高级别,也是最重要的一部分数据,在逻辑漏洞当中属于敏感信息泄露,有些敏感信息还包括了系统的重要信息,比如服务器的

网站安全之逻辑漏洞检测 附漏洞修复方案

在网站安全的日常安全检测当中,我们SINE安全公司发现网站的逻辑漏洞占比也是很高的,前段时间某酒店网站被爆出存在高危的逻辑漏洞,该漏洞导致酒店的几亿客户的信息遭泄露,包括手机号,姓名,地址都被泄露,后续带来的损失很大,最近几年用户信息泄露的事件时有发生,给很多企业,酒店都上了一堂生动的安全课.关于网站逻辑漏洞的总结,今天跟大家详细讲解一下. 网站逻辑漏洞 用户的隐私信息属于数据的保护的最高级别,也是最重要的一部分数据,在逻辑漏洞当中属于敏感信息泄露,有些敏感信息还包括了系统的重要信息,比如服务器

制作SD(8G)卡Linux镜像,使得ZC706开发板可以从SD卡启动进入Linux系统

转自网络,供学习记录使用,红色部分是我实验时,这篇文章和网站稍有出入的地方. 目的:制作SD(8G)卡Linux镜像,使得ZC706开发板可以从SD卡启动进入Linux系统 在http://wiki.analog.com/resources/eval/user-guides/ad-fmcomms2-ebz/quickstart/zynq(姑且把这个链接成为链接1吧)链接中找到 图1 点击绿色字体的链接,下载镜像原始文件.这里有不同时期的版本,本说明中选择 图2 下载的原始文件为:2014_R2-

树莓派及其他硬件平台国内外Linux镜像站全汇总

转载至segmentfault. 本文收集整理国内对于Raspberry Pi.CubieBoard.pcDuino等各种Linux开源硬件平台,所使用的Raspbian.Arch Linux ARM等各种ARM次级架构的Linux系统,在国内外的软件源镜像站. 本页面欢迎国内的软件源维护者与Linux爱好者留言补充! 注:全志(Allwinner).瑞芯微(Rockchip).德仪(TI)等核心的开发板,统称为ARM Cortex-A开发板. 系统列表 Raspbian [Rspb] Rasp

国内常用Linux镜像站点

网易镜像站点 http://mirrors.163.com/ 搜狐镜像站点 http://mirrors.sohu.com/ 阿里云镜像站点 http://mirrors.aliyun.com/ 北京理工大学镜像站点    IPV4  http://mirror.bit.edu.cn/web/ IPV6 http://mirror.bit6.edu.cn/web/ 天津大学镜像站点 http://mirror.tju.edu.cn/ 中科大镜像站点 http://mirrors.ustc.edu