Skip to content

Commit ded8f0b

Browse files
authored
Merge pull request #23 from brant-ruan/dev
fix #9
2 parents 8b19743 + 1a5c3a6 commit ded8f0b

File tree

6 files changed

+37
-18
lines changed

6 files changed

+37
-18
lines changed

config.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@
7272
release=release)
7373

7474
# kernel apt repositories
75-
_kernel_apt_repo_entry_xenial_official = 'deb http://security.ubuntu.com/ubuntu xenial-security main'
7675
_kernel_apt_repo_entry_trusty_official = 'deb http://security.ubuntu.com/ubuntu trusty-security main'
76+
_kernel_apt_repo_entry_xenial_official = 'deb http://security.ubuntu.com/ubuntu xenial-security main'
7777
_kernel_apt_repo_entry_bionic_official = 'deb http://security.ubuntu.com/ubuntu bionic-security main'
7878

79+
# containerd apt repository
80+
_containerd_apt_repo_entry_xenial_official = 'deb http://archive.ubuntu.com/ubuntu xenial-updates universe'
81+
_containerd_apt_repo_entry_bionic_official = 'deb http://archive.ubuntu.com/ubuntu bionic-updates universe'
82+
7983
# active k8s components images source
8084
k8s_images_prefix_official = "k8s.gcr.io/"
8185
k8s_images_prefix_official_9 = "gcr.io/google_containers/"
@@ -104,6 +108,12 @@
104108
_kernel_apt_repo_entry_bionic_official,
105109
]
106110

111+
# active containerd apt repository
112+
containerd_apt_repo_entries = [
113+
_containerd_apt_repo_entry_xenial_official,
114+
_containerd_apt_repo_entry_bionic_official,
115+
]
116+
107117
# CNI plugins
108118
available_cni_plugins = [
109119
'flannel',

core/env_managers/docker_installer.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,8 @@ def _pre_install(cls, verbose=False):
7676
# install requirements
7777
color_print.debug('installing prerequisites')
7878
try:
79-
subprocess.run(
80-
cls.cmd_apt_update,
81-
stdout=stdout,
82-
stderr=stderr,
83-
check=True)
79+
if not cls._apt_update(verbose=verbose):
80+
return False
8481
subprocess.run(
8582
cls.cmd_apt_install +
8683
cls._docker_requirements,
@@ -89,8 +86,12 @@ def _pre_install(cls, verbose=False):
8986
check=True)
9087
except subprocess.CalledProcessError:
9188
return False
92-
return cls._add_apt_repository(gpg_url=config.docker_apt_repo_gpg,
93-
repo_entry=config.docker_apt_repo_entry, verbose=verbose)
89+
cls._add_apt_repository(gpg_url=config.docker_apt_repo_gpg,
90+
repo_entry=config.docker_apt_repo_entry, verbose=verbose)
91+
for repo in config.containerd_apt_repo_entries:
92+
cls._add_apt_repository(repo_entry=repo, verbose=verbose)
93+
94+
return True
9495

9596

9697
if __name__ == "__main__":

core/env_managers/installer.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,19 @@ def _install_one_gadget_by_version(
103103
color_print.warning('no candidate version for %s' % name)
104104
return False
105105

106+
@classmethod
107+
def _apt_update(cls, verbose=False):
108+
stdout, stderr = verbose_func.verbose_output(verbose)
109+
try:
110+
subprocess.run(
111+
cls.cmd_apt_update,
112+
stdout=stdout,
113+
stderr=stderr,
114+
check=True)
115+
return True
116+
except subprocess.CalledProcessError:
117+
return False
118+
106119
@classmethod
107120
def _add_apt_repository(cls, repo_entry, gpg_url=None, verbose=False):
108121
stdout, stderr = verbose_func.verbose_output(verbose)
@@ -132,11 +145,6 @@ def _add_apt_repository(cls, repo_entry, gpg_url=None, verbose=False):
132145
stdout=stdout,
133146
stderr=stderr,
134147
check=True)
135-
subprocess.run(
136-
cls.cmd_apt_update,
137-
stdout=stdout,
138-
stderr=stderr,
139-
check=True)
140148
return True
141149
except subprocess.CalledProcessError:
142150
return False

core/env_managers/kernel_installer.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def install_by_version(cls, gadgets, context=None, verbose=False):
4141
color_print.debug('switching kernel by version')
4242
for repo in config.kernel_apt_repo_entries:
4343
cls._add_apt_repository(repo_entry=repo, verbose=verbose)
44+
4445
if cls._is_version_available_in_apt(version, verbose=verbose):
4546
return cls._install_by_version_with_apt(version, verbose=verbose)
4647
else:

core/env_managers/kubernetes_installer.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,7 @@ def _pre_install(cls, mappings=None, verbose=False):
319319
color_print.debug('pre-installing')
320320
stdout, stderr = verbose_func.verbose_output(verbose)
321321
# install requirements
322-
subprocess.run(
323-
cls.cmd_apt_update,
324-
stdout=stdout,
325-
stderr=stderr,
326-
check=True)
322+
cls._apt_update(verbose=verbose)
327323
subprocess.run(
328324
cls.cmd_apt_install +
329325
cls._kubernetes_requirements,

vulns_cn/docker/cve-2020-15257.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ dependencies:
55
- name: docker-ce
66
version: 18.03.1
77
versions: ~
8+
- name: containerd
9+
version: 1.3.3
10+
versions: ~
811
links:
912
- https://nvd.nist.gov/vuln/detail/CVE-2020-15257
1013
- https://xz.aliyun.com/t/8681

0 commit comments

Comments
 (0)