summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst4
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst4
-rw-r--r--bitbake/lib/bb/fetch2/wget.py19
3 files changed, 24 insertions, 3 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
index 593de61f24..40b245b6d3 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
@@ -144,6 +144,10 @@ download without a checksum triggers an error message. The
144make any attempted network access a fatal error, which is useful for 144make any attempted network access a fatal error, which is useful for
145checking that mirrors are complete as well as other things. 145checking that mirrors are complete as well as other things.
146 146
147If :term:`BB_CHECK_SSL_CERTS` is set to ``0`` then SSL certificate checking will
148be disabled. This variable defaults to ``1`` so SSL certificates are normally
149checked.
150
147.. _bb-the-unpack: 151.. _bb-the-unpack:
148 152
149The Unpack 153The Unpack
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
index 6283c2654c..2392ec4256 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
@@ -93,6 +93,10 @@ overview of their function and contents.
93 fetcher does not attempt to use the host listed in :term:`SRC_URI` after 93 fetcher does not attempt to use the host listed in :term:`SRC_URI` after
94 a successful fetch from the :term:`PREMIRRORS` occurs. 94 a successful fetch from the :term:`PREMIRRORS` occurs.
95 95
96 :term:`BB_CHECK_SSL_CERTS`
97 Specifies if SSL certificates should be checked when fetching. The default
98 value is ``1`` and certificates are not checked if the value is set to ``0``.
99
96 :term:`BB_CONSOLELOG` 100 :term:`BB_CONSOLELOG`
97 Specifies the path to a log file into which BitBake's user interface 101 Specifies the path to a log file into which BitBake's user interface
98 writes output during the build. 102 writes output during the build.
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 988ea74d26..29fcfbb3d1 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -52,13 +52,19 @@ class WgetProgressHandler(bb.progress.LineFilterProgressHandler):
52 52
53 53
54class Wget(FetchMethod): 54class Wget(FetchMethod):
55 """Class to fetch urls via 'wget'"""
55 56
56 # CDNs like CloudFlare may do a 'browser integrity test' which can fail 57 # CDNs like CloudFlare may do a 'browser integrity test' which can fail
57 # with the standard wget/urllib User-Agent, so pretend to be a modern 58 # with the standard wget/urllib User-Agent, so pretend to be a modern
58 # browser. 59 # browser.
59 user_agent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" 60 user_agent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
60 61
61 """Class to fetch urls via 'wget'""" 62 def check_certs(self, d):
63 """
64 Should certificates be checked?
65 """
66 return (d.getVar("BB_CHECK_SSL_CERTS") or "1") != "0"
67
62 def supports(self, ud, d): 68 def supports(self, ud, d):
63 """ 69 """
64 Check to see if a given url can be fetched with wget. 70 Check to see if a given url can be fetched with wget.
@@ -82,7 +88,10 @@ class Wget(FetchMethod):
82 if not ud.localfile: 88 if not ud.localfile:
83 ud.localfile = d.expand(urllib.parse.unquote(ud.host + ud.path).replace("/", ".")) 89 ud.localfile = d.expand(urllib.parse.unquote(ud.host + ud.path).replace("/", "."))
84 90
85 self.basecmd = d.getVar("FETCHCMD_wget") or "/usr/bin/env wget -t 2 -T 30 --passive-ftp --no-check-certificate" 91 self.basecmd = d.getVar("FETCHCMD_wget") or "/usr/bin/env wget -t 2 -T 30 --passive-ftp"
92
93 if not self.check_certs(d):
94 self.basecmd += " --no-check-certificate"
86 95
87 def _runwget(self, ud, d, command, quiet, workdir=None): 96 def _runwget(self, ud, d, command, quiet, workdir=None):
88 97
@@ -309,7 +318,11 @@ class Wget(FetchMethod):
309 with bb.utils.environment(**newenv): 318 with bb.utils.environment(**newenv):
310 import ssl 319 import ssl
311 320
312 context = ssl._create_unverified_context() 321 if self.check_certs(d):
322 context = ssl.create_default_context()
323 else:
324 context = ssl._create_unverified_context()
325
313 handlers = [FixedHTTPRedirectHandler, 326 handlers = [FixedHTTPRedirectHandler,
314 HTTPMethodFallback, 327 HTTPMethodFallback,
315 urllib.request.ProxyHandler(), 328 urllib.request.ProxyHandler(),