ホームページ  >  記事  >  運用・保守  >  過去の Linux イメージの問題を修復する方法

過去の Linux イメージの問題を修復する方法

坏嘻嘻
坏嘻嘻転載
2018-09-30 14:01:532240ブラウズ

この記事では、過去の Linux イメージの問題を修復する方法を紹介し、具体的な手順に焦点を当てています。この記事の内容はコンパクトなので、何かを得ることができれば幸いです。

過去の Linux イメージの問題修正計画

過去の Linux イメージを使用して作成された ECS クラウド サーバーには、NTP が設定されておらず、YUM も設定されていない可能性があり、最近公開されたセキュリティ脆弱性も存在する可能性があります。以下の手順に従って修復して、クラウド サーバーの安全性を高めてください。また、Alibaba Cloud が提供する YUM サービスを使用してソフトウェアをインストールしたり、Alibaba Cloud が提供する無料の 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 バージョンの 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

リポジトリの後ファイルがダウンロードされたら、

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
を実行します。

リポジトリ ファイルがダウンロードされたら、次のコマンドを実行します。

yum makecache

3. Ubuntu の場合は、ディストリビューションのバージョンに応じて、次のコマンドを実行します。

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
を実行します。

以上が過去の Linux イメージの問題を修復する方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はaliyun.comで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。