Skip to contentSkip to conversation

fetch2: Add BB_TRUSTED_NETWORK support

PATCH In review Liam R. Howlett 7 participants 22 messages Mar 31, 2015 – Jun 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2: Add BB_TRUSTED_NETWORK support

This patch adds support for a new local.conf variable called BB_TRUSTED_NETWORK. BB_TRUSTED_NETWORK holds a list of hostnames that the user trusts as a source for downloading content. If network access is enabled and the user has configured trusted hosts, then any hosts that are not in the list will cause an error to occur at fetch. Any mirrors and pre-mirrors that are not in the list will result in warnings that these locations will not be used.

The BB_NO_NETWORK variable still stops all network access.

Please see the comments in the patch for more details and example usage.

Liam R. Howlett (1):
fetch2: Add BB_TRUSTED_NETWORK support

 lib/bb/fetch2/__init__.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/bb/tests/fetch.py     | 33 +++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 fetch2: Add BB_TRUSTED_NETWORK support

BB_TRUSTED_NETWORK is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set.

If BB_NO_NETWORK is set, then networking is still disabled.

If BB_TRUSTED_NETWORK is not set, the behaviour remains the same as today.

If BB_NO_NETWORK is NOT set, and BB_TRUSTED_NETWORK is configured, then only the hosts in the list are usable by the fetcher.

eg:
BB_TRUSTED_NETWORK="yoctoproject.org git.gnu.org"
The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the list.

There is also limited support for wildcards on the beginning of the hosts, so BB_TRUSTED_NETWORK="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org

---
 lib/bb/fetch2/__init__.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/bb/tests/fetch.py     | 33 +++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
lib/bb/fetch2/__init__.py +57 -0
index b004dae..09e13e0 100644
@@ -61,6 +61,17 @@ class BBFetchException(Exception):
     def __str__(self):
          return self.msg
 
+class UntrustedUrl(BBFetchException):
+    """Exception raised when encountering a host not listed in BB_TRUSTED_NETWORK"""
+    def __init__(self, url, message=''):
+        if message:
+            msg = message
+        else:
+            msg = "The URL: '%s' is not trusted and cannot be used" % url
+        self.url = url
+        BBFetchException.__init__(self, msg)
+        self.args = (url,)
+
 class MalformedUrl(BBFetchException):
     """Exception raised when encountering an invalid url"""
     def __init__(self, url, message=''):
@@ -851,6 +862,11 @@ def build_mirroruris(origud, mirrors, ld):
             newuri = uri_replace(ud, find, replace, replacements, ld)
             if not newuri or newuri in uris or newuri == origud.url:
                 continue
+
+            if not trusted_network(ld, newuri):
+                logger.warn("Mirror %s not in list of trusted networks, skipping" %  (newuri))
+                continue
+
             try:
                 newud = FetchData(newuri, ld)
                 newud.setup_localpath(ld)
@@ -971,6 +987,44 @@ def try_mirrors(d, origud, mirrors, check = False):
             return ret
     return None
 
+def trusted_network(d, url):
+    """
+    Use a trusted url during download if networking is enabled and
+    BB_TRUSTED_NETWORK is set globally or for a specific recipe.
+    Note: modifies SRC_URI & mirrors.
+    """
+    if d.getVar('BB_NO_NETWORK', True) == "1":
+        return True
+
+    pkgname = d.expand(d.getVar('PN'))
+    trusted_hosts = d.getVarFlag('BB_TRUSTED_NETWORK', pkgname)
+
+    if not trusted_hosts:
+        trusted_hosts = d.getVar('BB_TRUSTED_NETWORK', True)
+
+    # Not enabled.
+    if not trusted_hosts:
+        return True
+
+    scheme, network, path, user, passwd, param = decodeurl(url)
+
+    if not network:
+        return True
+
+    network = network.lower()
+
+    for host in trusted_hosts.split(" "):
+        host = host.lower()
+        if (re.match('^\*?\.', host)):
+            host = host[2:]
+            m = network.split('.')
+            network = "%s.%s" % (m[-2], m[-1])
+        if (host == network):
+            return True
+
+
+    return False
+
 def srcrev_internal_helper(ud, d, name):
     """
     Return:
@@ -1511,6 +1565,9 @@ class Fetch(object):
 
             lf = bb.utils.lockfile(ud.lockfile)
 
+            if not trusted_network(self.d, ud.url):
+                raise UntrustedUrl(ud.url)
+
             try:
                 self.d.setVar("BB_NO_NETWORK", network)
  
lib/bb/tests/fetch.py +33 -0
index d56ef49..69e689d 100644
@@ -547,6 +547,39 @@ class FetcherNetworkTest(FetcherTest):
             os.chdir(os.path.dirname(self.unpackdir))
             fetcher.unpack(self.unpackdir)
 
+        def test_trusted_network(self):
+            # Ensure trusted_network returns False when the host IS in the list.
+            url = "git://Someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_wild_trusted_network(self):
+            # Ensure trusted_network returns true when the *.host IS in the list.
+            url = "git://Someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org *.someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_prefix_wild_trusted_network(self):
+            # Ensure trusted_network returns true when the prefix matches *.host.
+            url = "git://git.Someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org *.someserver.org server2.org server3.org")
+            name = bb.fetch.trusted_network(self.d, url)
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+        def test_two_prefix_wild_trusted_network(self):
+            # Ensure trusted_network returns true when the prefix matches *.host.
+            url = "git://something.git.Someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org *.someserver.org server2.org server3.org")
+            name = bb.fetch.trusted_network(self.d, url)
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_untrusted_network(self):
+            # Ensure trusted_network returns False when the host is NOT in the list.
+            self.d.delVar("BB_TRUSTED_NETWORK")
+            url = "git://someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org server2.org server3.org")
+            self.assertFalse(bb.fetch.trusted_network(self.d, url))
+
+
 class URLHandle(unittest.TestCase):
 
     datatable = {
Signature · 1 line
2.1.0
#2 lore raw

PATCH v2 1/1 fetch2: Add BB_TRUSTED_NETWORK support

This patch adds support for a new local.conf variable called BB_TRUSTED_NETWORK. BB_TRUSTED_NETWORK holds a list of hostnames that the user trusts as a source for downloading content. If network access is enabled and the user has configured trusted hosts, then any hosts that are not in the list will cause an error to occur at fetch. Any mirrors and pre-mirrors that are not in the list will result in warnings that these locations will not be used.

The BB_NO_NETWORK variable still stops all network access.

Please see the comments in the patch for more details and example usage.

Liam R. Howlett (1):
fetch2: Add BB_TRUSTED_NETWORK support

 lib/bb/fetch2/__init__.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/bb/tests/fetch.py     | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
Signature · 1 line
2.1.1
#3 lore raw

PATCH v2 1/1 fetch2: Add BB_TRUSTED_NETWORK support

BB_TRUSTED_NETWORK is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set.

If BB_NO_NETWORK is set, then networking is still disabled.

If BB_TRUSTED_NETWORK is not set, the behaviour remains the same as today.

If BB_NO_NETWORK is NOT set, and BB_TRUSTED_NETWORK is configured, then only the hosts in the list are usable by the fetcher.

eg:
BB_TRUSTED_NETWORK="yoctoproject.org git.gnu.org"
The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the list.

There is also limited support for wildcards on the beginning of the hosts, so BB_TRUSTED_NETWORK="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org

---
 lib/bb/fetch2/__init__.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/bb/tests/fetch.py     | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
lib/bb/fetch2/__init__.py +53 -0
index b004dae..f34b74a 100644
@@ -61,6 +61,17 @@ class BBFetchException(Exception):
     def __str__(self):
          return self.msg
 
+class UntrustedUrl(BBFetchException):
+    """Exception raised when encountering a host not listed in BB_TRUSTED_NETWORK"""
+    def __init__(self, url, message=''):
+        if message:
+            msg = message
+        else:
+            msg = "The URL: '%s' is not trusted and cannot be used" % url
+        self.url = url
+        BBFetchException.__init__(self, msg)
+        self.args = (url,)
+
 class MalformedUrl(BBFetchException):
     """Exception raised when encountering an invalid url"""
     def __init__(self, url, message=''):
@@ -851,6 +862,11 @@ def build_mirroruris(origud, mirrors, ld):
             newuri = uri_replace(ud, find, replace, replacements, ld)
             if not newuri or newuri in uris or newuri == origud.url:
                 continue
+
+            if not trusted_network(ld, newuri):
+                logger.debug(1, "Mirror %s not in the list of trusted networks, skipping" %  (newuri))
+                continue
+
             try:
                 newud = FetchData(newuri, ld)
                 newud.setup_localpath(ld)
@@ -971,6 +987,41 @@ def try_mirrors(d, origud, mirrors, check = False):
             return ret
     return None
 
+def trusted_network(d, url):
+    """
+    Use a trusted url during download if networking is enabled and
+    BB_TRUSTED_NETWORK is set globally or for a specific recipe.
+    Note: modifies SRC_URI & mirrors.
+    """
+    if d.getVar('BB_NO_NETWORK', True) == "1":
+        return True
+
+    pkgname = d.expand(d.getVar('PN'))
+    trusted_hosts = d.getVarFlag('BB_TRUSTED_NETWORK', pkgname)
+
+    if not trusted_hosts:
+        trusted_hosts = d.getVar('BB_TRUSTED_NETWORK', True)
+
+    # Not enabled.
+    if not trusted_hosts:
+        return True
+
+    scheme, network, path, user, passwd, param = decodeurl(url)
+
+    if not network:
+        return True
+
+    network = network.lower()
+
+    for host in trusted_hosts.split(" "):
+        host = host.lower()
+        if host.startswith("*.") and ("." + network).endswith(host[1:]):
+            return True
+        if host == network:
+            return True
+
+    return False
+
 def srcrev_internal_helper(ud, d, name):
     """
     Return:
@@ -1529,6 +1580,8 @@ class Fetch(object):
                 firsterr = None
                 if not localpath and ((not verify_donestamp(ud, self.d)) or m.need_update(ud, self.d)):
                     try:
+                        if not trusted_network(self.d, ud.url):
+                            raise UntrustedUrl(ud.url)
                         logger.debug(1, "Trying Upstream")
                         m.download(ud, self.d)
                         if hasattr(m, "build_mirror_data"):
lib/bb/tests/fetch.py +37 -0
index d56ef49..06726f2 100644
@@ -547,6 +547,43 @@ class FetcherNetworkTest(FetcherTest):
             os.chdir(os.path.dirname(self.unpackdir))
             fetcher.unpack(self.unpackdir)
 
+        def test_trusted_network(self):
+            # Ensure trusted_network returns False when the host IS in the list.
+            url = "git://Someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_wild_trusted_network(self):
+            # Ensure trusted_network returns true when the *.host IS in the list.
+            url = "git://Someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org *.someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_prefix_wild_trusted_network(self):
+            # Ensure trusted_network returns true when the prefix matches *.host.
+            url = "git://git.Someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org *.someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_two_prefix_wild_trusted_network(self):
+            # Ensure trusted_network returns true when the prefix matches *.host.
+            url = "git://something.git.Someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org *.someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_untrusted_network(self):
+            # Ensure trusted_network returns False when the host is NOT in the list.
+            url = "git://someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org server2.org server3.org")
+            self.assertFalse(bb.fetch.trusted_network(self.d, url))
+
+        def test_wild_untrusted_network(self):
+            # Ensure trusted_network returns False when the host is NOT in the list.
+            url = "git://*.someserver.org/foo;rev=1"
+            self.d.setVar("BB_TRUSTED_NETWORK", "server1.org server2.org server3.org")
+            self.assertFalse(bb.fetch.trusted_network(self.d, url))
+
+
 class URLHandle(unittest.TestCase):
 
     datatable = {
Signature · 1 line
2.1.1
#4 lore raw

PATCH v3 1/1 fetch2: Add BB_ALLOWED_NETWORKS support

This patch adds support for a new local.conf variable called BB_ALLOWED_NETWORKS. BB_ALLOWED_NETWORKS holds a list of hostnames that the user trusts as a source for downloading content. If network access is enabled and the user has configured trusted hosts, then any hosts that are not in the list will cause an error to occur at fetch. Any mirrors and pre-mirrors that are not in the list will result in warnings that these locations will not be used.

The BB_NO_NETWORK variable still stops all network access.

Please see the comments in the patch for more details and example usage.

Liam R. Howlett (1):
fetch2: Add BB_ALLOWED_NETWORKS support

 lib/bb/fetch2/__init__.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/bb/tests/fetch.py     | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
Signature · 1 line
2.1.1
#5 lore raw

PATCH v3 1/1 fetch2: Add BB_ALLOWED_NETWORKS support

In reply to Liam R. Howlett

BB_ALLOWED_NETWORKS is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set.

If BB_NO_NETWORK is set, then networking is still disabled.

If BB_ALLOWED_NETWORKS is not set, the behaviour remains the same as today.

If BB_NO_NETWORK is NOT set, and BB_ALLOWED_NETWORKS is configured, then only the hosts in the list are usable by the fetcher.

eg:
BB_ALLOWED_NETWORKS="yoctoproject.org git.gnu.org"
The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the list.

There is also limited support for wildcards on the beginning of the hosts, so BB_ALLOWED_NETWORKS="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org

---
 lib/bb/fetch2/__init__.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/bb/tests/fetch.py     | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
lib/bb/fetch2/__init__.py +53 -0
index b004dae..8eebd63 100644
@@ -61,6 +61,17 @@ class BBFetchException(Exception):
     def __str__(self):
          return self.msg
 
+class UntrustedUrl(BBFetchException):
+    """Exception raised when encountering a host not listed in BB_ALLOWED_NETWORKS"""
+    def __init__(self, url, message=''):
+        if message:
+            msg = message
+        else:
+            msg = "The URL: '%s' is not trusted and cannot be used" % url
+        self.url = url
+        BBFetchException.__init__(self, msg)
+        self.args = (url,)
+
 class MalformedUrl(BBFetchException):
     """Exception raised when encountering an invalid url"""
     def __init__(self, url, message=''):
@@ -851,6 +862,11 @@ def build_mirroruris(origud, mirrors, ld):
             newuri = uri_replace(ud, find, replace, replacements, ld)
             if not newuri or newuri in uris or newuri == origud.url:
                 continue
+
+            if not trusted_network(ld, newuri):
+                logger.debug(1, "Mirror %s not in the list of trusted networks, skipping" %  (newuri))
+                continue
+
             try:
                 newud = FetchData(newuri, ld)
                 newud.setup_localpath(ld)
@@ -971,6 +987,41 @@ def try_mirrors(d, origud, mirrors, check = False):
             return ret
     return None
 
+def trusted_network(d, url):
+    """
+    Use a trusted url during download if networking is enabled and
+    BB_ALLOWED_NETWORKS is set globally or for a specific recipe.
+    Note: modifies SRC_URI & mirrors.
+    """
+    if d.getVar('BB_NO_NETWORK', True) == "1":
+        return True
+
+    pkgname = d.expand(d.getVar('PN'))
+    trusted_hosts = d.getVarFlag('BB_ALLOWED_NETWORKS', pkgname)
+
+    if not trusted_hosts:
+        trusted_hosts = d.getVar('BB_ALLOWED_NETWORKS', True)
+
+    # Not enabled.
+    if not trusted_hosts:
+        return True
+
+    scheme, network, path, user, passwd, param = decodeurl(url)
+
+    if not network:
+        return True
+
+    network = network.lower()
+
+    for host in trusted_hosts.split(" "):
+        host = host.lower()
+        if host.startswith("*.") and ("." + network).endswith(host[1:]):
+            return True
+        if host == network:
+            return True
+
+    return False
+
 def srcrev_internal_helper(ud, d, name):
     """
     Return:
@@ -1529,6 +1580,8 @@ class Fetch(object):
                 firsterr = None
                 if not localpath and ((not verify_donestamp(ud, self.d)) or m.need_update(ud, self.d)):
                     try:
+                        if not trusted_network(self.d, ud.url):
+                            raise UntrustedUrl(ud.url)
                         logger.debug(1, "Trying Upstream")
                         m.download(ud, self.d)
                         if hasattr(m, "build_mirror_data"):
lib/bb/tests/fetch.py +37 -0
index d56ef49..d3f7b6a 100644
@@ -547,6 +547,43 @@ class FetcherNetworkTest(FetcherTest):
             os.chdir(os.path.dirname(self.unpackdir))
             fetcher.unpack(self.unpackdir)
 
+        def test_trusted_network(self):
+            # Ensure trusted_network returns False when the host IS in the list.
+            url = "git://Someserver.org/foo;rev=1"
+            self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_wild_trusted_network(self):
+            # Ensure trusted_network returns true when the *.host IS in the list.
+            url = "git://Someserver.org/foo;rev=1"
+            self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_prefix_wild_trusted_network(self):
+            # Ensure trusted_network returns true when the prefix matches *.host.
+            url = "git://git.Someserver.org/foo;rev=1"
+            self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_two_prefix_wild_trusted_network(self):
+            # Ensure trusted_network returns true when the prefix matches *.host.
+            url = "git://something.git.Someserver.org/foo;rev=1"
+            self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org")
+            self.assertTrue(bb.fetch.trusted_network(self.d, url))
+
+        def test_untrusted_network(self):
+            # Ensure trusted_network returns False when the host is NOT in the list.
+            url = "git://someserver.org/foo;rev=1"
+            self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org server2.org server3.org")
+            self.assertFalse(bb.fetch.trusted_network(self.d, url))
+
+        def test_wild_untrusted_network(self):
+            # Ensure trusted_network returns False when the host is NOT in the list.
+            url = "git://*.someserver.org/foo;rev=1"
+            self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org server2.org server3.org")
+            self.assertFalse(bb.fetch.trusted_network(self.d, url))
+
+
 class URLHandle(unittest.TestCase):
 
     datatable = {
Signature · 1 line
2.1.1
#6 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 20 lines · Liam R. Howlett

BB_ALLOWED_NETWORKS is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set.

If BB_NO_NETWORK is set, then networking is still disabled.

If BB_ALLOWED_NETWORKS is not set, the behaviour remains the same as today.

If BB_NO_NETWORK is NOT set, and BB_ALLOWED_NETWORKS is configured, then only the hosts in the list are usable by the fetcher.

eg:
BB_ALLOWED_NETWORKS="yoctoproject.org git.gnu.org"
The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the list.

There is also limited support for wildcards on the beginning of the hosts, so BB_ALLOWED_NETWORKS="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org

Quoted 5 lines
---
 lib/bb/fetch2/__init__.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/bb/tests/fetch.py     | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)

I've merged this, however, one of the things we're trying to do is improve the documentation of bitbake. Would you be able to work with Scott (cc'd) to ensure this is documented in the manual please?

Cheers,

Richard

#7 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 27 lines · Richard Purdie
Quoted 20 lines · Liam R. Howlett

BB_ALLOWED_NETWORKS is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set.

If BB_NO_NETWORK is set, then networking is still disabled.

If BB_ALLOWED_NETWORKS is not set, the behaviour remains the same as today.

If BB_NO_NETWORK is NOT set, and BB_ALLOWED_NETWORKS is configured, then only the hosts in the list are usable by the fetcher.

eg:
BB_ALLOWED_NETWORKS="yoctoproject.org git.gnu.org"
The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the list.

There is also limited support for wildcards on the beginning of the hosts, so BB_ALLOWED_NETWORKS="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org

Quoted 5 lines
---
 lib/bb/fetch2/__init__.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/bb/tests/fetch.py     | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
Quoted 8 lines

I've merged this, however, one of the things we're trying to do is improve the documentation of bitbake. Would you be able to work with Scott (cc'd) to ensure this is documented in the manual please?

Cheers,

Richard

Absolutely, Thanks Richard.

Hello Scott,

If you don't have anything started, we can work from the text below if you'd like.

--------

BB_ALLOWED_NETWORKS

Specifies a space delimited list of hosts which are allowed to be used by the fetcher to obtain the required source code. This list is only used if BB_NO_NETWORK is not set. Wildcard matching at the beginning of hosts is supported. Mirrors that are not in the list will be skipped and logged in debug. Attempts to access networks that are not in the BB_ALLOWED_NETWORKS will cause a failure.

--------

Thanks,
Liam

#8 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 56 lines · On Tuesday 12 May 2015 10:28:08 Liam R. Howlett wrote:
Quoted 29 lines · Richard Purdie
Quoted 20 lines · Liam R. Howlett

BB_ALLOWED_NETWORKS is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set.

If BB_NO_NETWORK is set, then networking is still disabled.

If BB_ALLOWED_NETWORKS is not set, the behaviour remains the same as today.

If BB_NO_NETWORK is NOT set, and BB_ALLOWED_NETWORKS is configured, then only the hosts in the list are usable by the fetcher.

eg:
BB_ALLOWED_NETWORKS="yoctoproject.org git.gnu.org"
The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the list.

There is also limited support for wildcards on the beginning of the hosts, so BB_ALLOWED_NETWORKS="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org

Quoted 7 lines

---

 lib/bb/fetch2/__init__.py | 53
 +++++++++++++++++++++++++++++++++++++++++++++++ lib/bb/tests/fetch.py 
    | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
Quoted 7 lines

I've merged this, however, one of the things we're trying to do is improve the documentation of bitbake. Would you be able to work with Scott (cc'd) to ensure this is documented in the manual please?

Cheers,

Richard

Absolutely, Thanks Richard.

Hello Scott,

If you don't have anything started, we can work from the text below if you'd like.

--------

BB_ALLOWED_NETWORKS

Specifies a space delimited list of hosts which are allowed to be used by the fetcher to obtain the required source code. This list is only used if BB_NO_NETWORK is not set. Wildcard matching at the beginning of hosts is supported. Mirrors that are not in the list will be skipped and logged in debug. Attempts to access networks that are not in the BB_ALLOWED_NETWORKS will cause a failure.

Quoted 4 lines

--------

Thanks,
Liam

Replying to add Scott on CC - I think he has something for review.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#9 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Liam,

I will take your raw information and create a new variable description in both the BitBake manual and the YP reference manual. I will send out a review link to you when it is ready.

Thanks,
Scott

Quoted 82 lines

-----Original Message-----
From: Paul Eggleton [mailto:[email protected]]
Sent: Monday, June 15, 2015 6:28 AM
To: Howlett, Liam (Wind River)
Cc: Richard Purdie; Rifenbark, Scott M; bitbake- [email protected]
Subject: Re: [bitbake-devel] [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 10 lines · On Tuesday 12 May 2015 10:28:08 Liam R. Howlett wrote:
Quoted 9 lines · Richard Purdie
Quoted 8 lines · Liam R. Howlett

BB_ALLOWED_NETWORKS is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set.

If BB_NO_NETWORK is set, then networking is still disabled.

If BB_ALLOWED_NETWORKS is not set, the behaviour remains the same as today.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

If BB_NO_NETWORK is NOT set, and BB_ALLOWED_NETWORKS is configured, then only the hosts in the list are usable by the fetcher.

eg:
BB_ALLOWED_NETWORKS="yoctoproject.org git.gnu.org"
The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the

list.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

There is also limited support for wildcards on the beginning of the hosts, so BB_ALLOWED_NETWORKS="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org

---

 lib/bb/fetch2/__init__.py | 53

+++++++++++++++++++++++++++++++++++++++++++++++

lib/bb/tests/fetch.py

Quoted 29 lines
Quoted 10 lines
Quoted 2 lines
    | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)

I've merged this, however, one of the things we're trying to do is improve the documentation of bitbake. Would you be able to work with Scott (cc'd) to ensure this is documented in the manual please?

Cheers,

Richard

Absolutely, Thanks Richard.

Hello Scott,

If you don't have anything started, we can work from the text below if you'd like.

--------

BB_ALLOWED_NETWORKS

Specifies a space delimited list of hosts which are allowed to be used by the fetcher to obtain the required source code. This list is only used if BB_NO_NETWORK is not set. Wildcard matching at the beginning of hosts is supported. Mirrors that are not in the list will be skipped and logged in debug. Attempts to access networks that are not in the BB_ALLOWED_NETWORKS will cause a failure.

Quoted 4 lines

--------

Thanks,
Liam

Replying to add Scott on CC - I think he has something for review.

Cheers,
Paul

--

Paul Eggleton
Intel Open Source Technology Centre

#10 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

In reply to Paul Eggleton
Quoted 46 lines · Paul Eggleton
Quoted 45 lines · On Tuesday 12 May 2015 10:28:08 Liam R. Howlett wrote:
Quoted 29 lines · Richard Purdie
Quoted 20 lines · Liam R. Howlett

BB_ALLOWED_NETWORKS is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set.

If BB_NO_NETWORK is set, then networking is still disabled.

If BB_ALLOWED_NETWORKS is not set, the behaviour remains the same as today.

If BB_NO_NETWORK is NOT set, and BB_ALLOWED_NETWORKS is configured, then only the hosts in the list are usable by the fetcher.

eg:
BB_ALLOWED_NETWORKS="yoctoproject.org git.gnu.org"
The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the list.

There is also limited support for wildcards on the beginning of the hosts, so BB_ALLOWED_NETWORKS="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org

Quoted 7 lines

---

  lib/bb/fetch2/__init__.py | 53
  +++++++++++++++++++++++++++++++++++++++++++++++ lib/bb/tests/fetch.py
     | 37 +++++++++++++++++++++++++++++++++
  2 files changed, 90 insertions(+)
Quoted 7 lines

I've merged this, however, one of the things we're trying to do is improve the documentation of bitbake. Would you be able to work with Scott (cc'd) to ensure this is documented in the manual please?

Cheers,

Richard

Absolutely, Thanks Richard.

Hello Scott,

If you don't have anything started, we can work from the text below if you'd like.

Quoted 7 lines
Quoted 7 lines

--------

BB_ALLOWED_NETWORKS

Specifies a space delimited list of hosts which are allowed to be used by the fetcher to obtain the required source code. This list is only used if BB_NO_NETWORK is not set. Wildcard matching at the beginning of

Hopefully BB_NO_NETWORK='0' (which is different from 'not set')as well? That works for all other uses of BB_NO_NETWORK.

Quoted 14 lines
Quoted 8 lines

hosts is supported. Mirrors that are not in the list will be skipped and logged in debug. Attempts to access networks that are not in the BB_ALLOWED_NETWORKS will cause a failure.

--------

Thanks,
Liam

Replying to add Scott on CC - I think he has something for review.

Cheers,
Paul

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#11 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Hi,

Here is a first draft of documenting the BB_ALLOWED_NETWORKS variable in the BitBake User Manual. I re-wrote the original text to be active voice and applied some different organization of the facts to help the flow out. Regarding Gary's input about BB_NO_NETWORK..... I took a half guess at incorporating it. Please look this new description over and let me know of any corrections I need to make. http://www.yoctoproject.org/docs/1.9/bitbake-user-manual/bitbake-user-manual.html#var-BB_ALLOWED_NETWORKS.

Thanks,
Scott

Quoted 95 lines

-----Original Message-----
From: [email protected] [mailto:bitbake- [email protected]] On Behalf Of Gary Thomas
Sent: Monday, June 15, 2015 6:39 AM
To: [email protected]
Subject: Re: [bitbake-devel] [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 6 lines · Paul Eggleton
Quoted 5 lines · On Tuesday 12 May 2015 10:28:08 Liam R. Howlett wrote:
Quoted 4 lines · Richard Purdie
Quoted 3 lines · Liam R. Howlett

BB_ALLOWED_NETWORKS is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

If BB_NO_NETWORK is set, then networking is still disabled.

If BB_ALLOWED_NETWORKS is not set, the behaviour remains the same as today.

If BB_NO_NETWORK is NOT set, and BB_ALLOWED_NETWORKS is

configured,

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

then only the hosts in the list are usable by the fetcher.

eg:
BB_ALLOWED_NETWORKS="yoctoproject.org git.gnu.org"
The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the

list.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

There is also limited support for wildcards on the beginning of the hosts, so BB_ALLOWED_NETWORKS="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org

---

  lib/bb/fetch2/__init__.py | 53

+++++++++++++++++++++++++++++++++++++++++++++++

lib/bb/tests/fetch.py

Quoted 18 lines
Quoted 18 lines
Quoted 10 lines
Quoted 2 lines
     | 37 +++++++++++++++++++++++++++++++++
  2 files changed, 90 insertions(+)

I've merged this, however, one of the things we're trying to do is improve the documentation of bitbake. Would you be able to work with Scott (cc'd) to ensure this is documented in the manual please?

Cheers,

Richard

Absolutely, Thanks Richard.

Hello Scott,

If you don't have anything started, we can work from the text below if you'd like.

Quoted 8 lines
Quoted 8 lines

--------

BB_ALLOWED_NETWORKS

Specifies a space delimited list of hosts which are allowed to be used by the fetcher to obtain the required source code. This list is only used if BB_NO_NETWORK is not set. Wildcard matching at the beginning of

Hopefully BB_NO_NETWORK='0' (which is different from 'not set')as well? That works for all other uses of BB_NO_NETWORK.

Quoted 6 lines
Quoted 6 lines

hosts is supported. Mirrors that are not in the list will be skipped and logged in debug. Attempts to access networks that are not in the BB_ALLOWED_NETWORKS will cause a failure.

--------

Quoted 8 lines
Quoted 2 lines

Thanks,
Liam

Replying to add Scott on CC - I think he has something for review.

Cheers,
Paul

--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

#12 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 9 lines · Scott M

Hi,

Here is a first draft of documenting the BB_ALLOWED_NETWORKS variable in the BitBake User Manual. I re-wrote the original text to be active voice and applied some different organization of the facts to help the flow out. Regarding Gary's input about BB_NO_NETWORK..... I took a half guess at incorporating it. Please look this new description over and let me know of any corrections I need to make.
http://www.yoctoproject.org/docs/1.9/bitbake-user-manual/bitbake-user-manual.html#var-BB_ALLOWED_NETWORKS.

Was the v3 fixed / extended to allow for netmasks, btw? Think
/etc/hosts
foo.example.com 10.0.0.1
bar.example.com 10.0.0.254
baz.example.com ::1

BB_ALLOWED_NETWORKS = 10.0.0.0/24 1.1.1.1/31 ::1/127

Thanks,

#13 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 1 line · On Monday 15 June 2015 23:47:29 Bernhard Reutner-Fischer wrote:

On June 15, 2015 4:03:11 PM GMT+02:00, "Rifenbark, Scott M"

Quoted 10 lines · <[email protected]> wrote:
Quoted 10 lines

Hi,

Here is a first draft of documenting the BB_ALLOWED_NETWORKS variable in the BitBake User Manual. I re-wrote the original text to be active voice and applied some different organization of the facts to help the flow out. Regarding Gary's input about BB_NO_NETWORK..... I took a half guess at incorporating it. Please look this new description over and let me know of any corrections I need to make.
http://www.yoctoproject.org/docs/1.9/bitbake-user-manual/bitbake-user-manua
l.html#var-BB_ALLOWED_NETWORKS.

Quoted 8 lines

Was the v3 fixed / extended to allow for netmasks, btw? Think
/etc/hosts
foo.example.com 10.0.0.1
bar.example.com 10.0.0.254
baz.example.com ::1

BB_ALLOWED_NETWORKS = 10.0.0.0/24 1.1.1.1/31 ::1/127

I don't believe so. You can see what actually went in here:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=59ce7d02a57e0a642d839ab48677f6ac1886180f

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#14 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 5 lines · Paul Eggleton
Quoted 1 line · On Monday 15 June 2015 23:47:29 Bernhard Reutner-Fischer wrote:

On June 15, 2015 4:03:11 PM GMT+02:00, "Rifenbark, Scott M"

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Here is a first draft of documenting the BB_ALLOWED_NETWORKS variable in the BitBake User Manual. I re-wrote the original text to be active voice and applied some different organization of the facts to help the flow out. Regarding Gary's input about BB_NO_NETWORK..... I took a half guess at incorporating it. Please look this new description over and let me know of any corrections I need to make.
http://www.yoctoproject.org/docs/1.9/bitbake-user-manual/bitbake-user-manua
l.html#var-BB_ALLOWED_NETWORKS.

Hi,

The documentation looks correct, however it might be worth noting that adding the host you'd like to use to PREMIRROR will result in the source code being fetched from an allowed location and avoid raising an error when a host that is not allowed is in a SRC_URI because the fetcher will not attempt to use the SRC_URI host after a successful fetch from the PREMIRROR. Using BB_ALLOWED_NETWORK in conjunction with PREMIRROR is where this feature is very useful.

Quoted 7 lines
Quoted 7 lines

Was the v3 fixed / extended to allow for netmasks, btw? Think
/etc/hosts
foo.example.com 10.0.0.1
bar.example.com 10.0.0.254
baz.example.com ::1

Quoted 8 lines
Quoted 1 line

BB_ALLOWED_NETWORKS = 10.0.0.0/24 1.1.1.1/31 ::1/127

I don't believe so. You can see what actually went in here:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=59ce7d02a57e0a642d839ab48677f6ac1886180f

Cheers,
Paul

There isn't netmask support, but you can achieve the same result in your example above by using BB_ALLOWED_NETWORKS = "*.example.com"

Version 2 updated the host matching and added a few more tests.

Version 3 changed the name from BB_TRUSTED_NETWORKS to BB_ALLOWED_NETWORKS.

Thanks,
Liam R. Howlett

Quoted 5 lines
Signature · 4 lines
-- 

Paul Eggleton
Intel Open Source Technology Centre
#15 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 30 lines

-----Original Message-----
From: Liam R. Howlett [mailto:[email protected]]
Sent: Tuesday, June 16, 2015 6:42 AM
To: Paul Eggleton
Cc: Bernhard Reutner-Fischer; Rifenbark, Scott M; Gary Thomas; bitbake- [email protected]
Subject: Re: [bitbake-devel] [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 11 lines · Paul Eggleton
Quoted 1 line · On Monday 15 June 2015 23:47:29 Bernhard Reutner-Fischer wrote:

On June 15, 2015 4:03:11 PM GMT+02:00, "Rifenbark, Scott M"

Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines

Hi,

Here is a first draft of documenting the BB_ALLOWED_NETWORKS variable in the BitBake User Manual. I re-wrote the original text to be active voice and applied some different organization of the facts to help the flow out. Regarding Gary's input about BB_NO_NETWORK..... I took a half guess at incorporating it. Please look this new description over and let me know of any corrections I need

to make.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

http://www.yoctoproject.org/docs/1.9/bitbake-user-manual/bitbake-us
er-manua
l.html#var-BB_ALLOWED_NETWORKS.

Hi,

Quoted 7 lines

The documentation looks correct, however it might be worth noting that adding the host you'd like to use to PREMIRROR will result in the source code being fetched from an allowed location and avoid raising an error when a host that is not allowed is in a SRC_URI because the fetcher will not attempt to use the SRC_URI host after a successful fetch from the PREMIRROR. Using BB_ALLOWED_NETWORK in conjunction with PREMIRROR is where this feature is very useful.

Check the link to the variable description out now Liam. Let me know if this addition is okay.

Quoted 37 lines
Quoted 11 lines
Quoted 10 lines

Was the v3 fixed / extended to allow for netmasks, btw? Think
/etc/hosts
foo.example.com 10.0.0.1
bar.example.com 10.0.0.254
baz.example.com ::1

BB_ALLOWED_NETWORKS = 10.0.0.0/24 1.1.1.1/31 ::1/127

Quoted 7 lines

I don't believe so. You can see what actually went in here:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=59ce7d02a57e
0a642d839ab48677f6ac1886180f

Cheers,
Paul

There isn't netmask support, but you can achieve the same result in your example above by using BB_ALLOWED_NETWORKS = "*.example.com"

Version 2 updated the host matching and added a few more tests.

Version 3 changed the name from BB_TRUSTED_NETWORKS to BB_ALLOWED_NETWORKS.

Thanks,
Liam R. Howlett

Quoted 5 lines

--

Paul Eggleton
Intel Open Source Technology Centre

#16 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 38 lines · Rifenbark, Scott M
Quoted 30 lines

-----Original Message-----
From: Liam R. Howlett [mailto:[email protected]]
Sent: Tuesday, June 16, 2015 6:42 AM
To: Paul Eggleton
Cc: Bernhard Reutner-Fischer; Rifenbark, Scott M; Gary Thomas; bitbake- [email protected]
Subject: Re: [bitbake-devel] [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 11 lines · Paul Eggleton
Quoted 1 line · On Monday 15 June 2015 23:47:29 Bernhard Reutner-Fischer wrote:

On June 15, 2015 4:03:11 PM GMT+02:00, "Rifenbark, Scott M"

Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines

Hi,

Here is a first draft of documenting the BB_ALLOWED_NETWORKS variable in the BitBake User Manual. I re-wrote the original text to be active voice and applied some different organization of the facts to help the flow out. Regarding Gary's input about BB_NO_NETWORK..... I took a half guess at incorporating it. Please look this new description over and let me know of any corrections I need

to make.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

http://www.yoctoproject.org/docs/1.9/bitbake-user-manual/bitbake-us
er-manua
l.html#var-BB_ALLOWED_NETWORKS.

Hi,

Quoted 7 lines

The documentation looks correct, however it might be worth noting that adding the host you'd like to use to PREMIRROR will result in the source code being fetched from an allowed location and avoid raising an error when a host that is not allowed is in a SRC_URI because the fetcher will not attempt to use the SRC_URI host after a successful fetch from the PREMIRROR. Using BB_ALLOWED_NETWORK in conjunction with PREMIRROR is where this feature is very useful.

Quoted 1 line

Check the link to the variable description out now Liam. Let me know if this addition is okay.

This looks good!

Thanks,
Liam

Quoted 38 lines
Quoted 38 lines
Quoted 12 lines
Quoted 11 lines

Was the v3 fixed / extended to allow for netmasks, btw? Think
/etc/hosts
foo.example.com 10.0.0.1
bar.example.com 10.0.0.254
baz.example.com ::1

BB_ALLOWED_NETWORKS = 10.0.0.0/24 1.1.1.1/31 ::1/127

Quoted 7 lines

I don't believe so. You can see what actually went in here:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=59ce7d02a57e
0a642d839ab48677f6ac1886180f

Cheers,
Paul

There isn't netmask support, but you can achieve the same result in your example above by using BB_ALLOWED_NETWORKS = "*.example.com"

Version 2 updated the host matching and added a few more tests.

Version 3 changed the name from BB_TRUSTED_NETWORKS to BB_ALLOWED_NETWORKS.

Thanks,
Liam R. Howlett

Quoted 5 lines

--

Paul Eggleton
Intel Open Source Technology Centre

#17 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 52 lines

-----Original Message-----
From: Liam R. Howlett [mailto:[email protected]]
Sent: Tuesday, June 16, 2015 12:24 PM
To: Rifenbark, Scott M
Cc: Paul Eggleton; Bernhard Reutner-Fischer; Gary Thomas; bitbake- [email protected]
Subject: Re: [bitbake-devel] [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 40 lines · Rifenbark, Scott M
Quoted 39 lines

-----Original Message-----
From: Liam R. Howlett [mailto:[email protected]]
Sent: Tuesday, June 16, 2015 6:42 AM
To: Paul Eggleton
Cc: Bernhard Reutner-Fischer; Rifenbark, Scott M; Gary Thomas; bitbake- [email protected]
Subject: Re: [bitbake-devel] [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 5 lines · Paul Eggleton
Quoted 1 line · On Monday 15 June 2015 23:47:29 Bernhard Reutner-Fischer wrote:

On June 15, 2015 4:03:11 PM GMT+02:00, "Rifenbark, Scott M"

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines

Hi,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Here is a first draft of documenting the BB_ALLOWED_NETWORKS variable in the BitBake User Manual. I re-wrote the original text to be active voice and applied some different organization of the facts to help the flow out. Regarding Gary's input about BB_NO_NETWORK..... I took a half guess at incorporating it. Please look this new description over and let me know of any corrections I need

to make.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

http://www.yoctoproject.org/docs/1.9/bitbake-user-manual/bitbake
-us
er-manua
l.html#var-BB_ALLOWED_NETWORKS.

Hi,

The documentation looks correct, however it might be worth noting that adding the host you'd like to use to PREMIRROR will result in the source code being fetched from an allowed location and avoid raising an error when a host that is not allowed is in a SRC_URI because the fetcher will not attempt to use the SRC_URI host after a successful fetch from the PREMIRROR. Using BB_ALLOWED_NETWORK in conjunction with PREMIRROR is where this feature is very useful.

Quoted 7 lines
Quoted 1 line

Check the link to the variable description out now Liam. Let me know if this

addition is okay.

This looks good!

Thanks,
Liam

Awesome... I will get the commit into the Bitbake repo and then duplicate the entry in the YP ref-manual.

Thanks,
Scott

Quoted 41 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 4 lines
Quoted 8 lines

Was the v3 fixed / extended to allow for netmasks, btw? Think
/etc/hosts
foo.example.com 10.0.0.1
bar.example.com 10.0.0.254
baz.example.com ::1

BB_ALLOWED_NETWORKS = 10.0.0.0/24 1.1.1.1/31 ::1/127

I don't believe so. You can see what actually went in here:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=59ce7d02a
57e
0a642d839ab48677f6ac1886180f

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Cheers,
Paul

There isn't netmask support, but you can achieve the same result in your example above by using BB_ALLOWED_NETWORKS =

"*.example.com"

Quoted 15 lines
Quoted 15 lines

Version 2 updated the host matching and added a few more tests.

Version 3 changed the name from BB_TRUSTED_NETWORKS to BB_ALLOWED_NETWORKS.

Thanks,
Liam R. Howlett

Quoted 5 lines

--

Paul Eggleton
Intel Open Source Technology Centre

#18 lore raw

Re: [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Ok - I am done with this thread. The description for BB_ALLOWED_NETWORKS is now in the BitBake User Manual and the YP Reference Manual. The commit has been pushed to my contrib area for bitbake and Richard has been notified.

Scott

Quoted 125 lines

-----Original Message-----
From: [email protected] [mailto:bitbake- [email protected]] On Behalf Of Rifenbark, Scott M
Sent: Tuesday, June 16, 2015 12:26 PM
To: Howlett, Liam (Wind River)
Cc: Paul Eggleton; [email protected]; Gary Thomas
Subject: Re: [bitbake-devel] [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 7 lines

-----Original Message-----
From: Liam R. Howlett [mailto:[email protected]]
Sent: Tuesday, June 16, 2015 12:24 PM
To: Rifenbark, Scott M
Cc: Paul Eggleton; Bernhard Reutner-Fischer; Gary Thomas; bitbake- [email protected]
Subject: Re: [bitbake-devel] [PATCH v3] fetch2: Add

BB_ALLOWED_NETWORKS

Quoted 44 lines

support

Quoted 41 lines · Rifenbark, Scott M
Quoted 40 lines

-----Original Message-----
From: Liam R. Howlett [mailto:[email protected]]
Sent: Tuesday, June 16, 2015 6:42 AM
To: Paul Eggleton
Cc: Bernhard Reutner-Fischer; Rifenbark, Scott M; Gary Thomas; bitbake- [email protected]
Subject: Re: [bitbake-devel] [PATCH v3] fetch2: Add BB_ALLOWED_NETWORKS support

Quoted 5 lines · Paul Eggleton
Quoted 1 line · On Monday 15 June 2015 23:47:29 Bernhard Reutner-Fischer wrote:

On June 15, 2015 4:03:11 PM GMT+02:00, "Rifenbark, Scott M"

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines

Hi,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Here is a first draft of documenting the BB_ALLOWED_NETWORKS variable in the BitBake User Manual. I re-wrote the original text to be active voice and applied some different organization of the facts to help the flow out. Regarding Gary's input about BB_NO_NETWORK..... I took a half guess at incorporating it. Please look this new description over and let me know of any corrections I need

to make.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

http://www.yoctoproject.org/docs/1.9/bitbake-user-manual/bitbak
e
-us
er-manua
l.html#var-BB_ALLOWED_NETWORKS.

Hi,

The documentation looks correct, however it might be worth noting that adding the host you'd like to use to PREMIRROR will result in the source code being fetched from an allowed location and avoid raising an error when a host that is not allowed is in a SRC_URI because the fetcher will not attempt to use the SRC_URI host after a successful fetch from the PREMIRROR. Using BB_ALLOWED_NETWORK in conjunction with PREMIRROR is where this feature is very useful.

Quoted 8 lines
Quoted 2 lines

Check the link to the variable description out now Liam. Let me know if this

addition is okay.

This looks good!

Thanks,
Liam

Awesome... I will get the commit into the Bitbake repo and then duplicate the entry in the YP ref-manual.

Thanks,
Scott

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 4 lines
Quoted 8 lines

Was the v3 fixed / extended to allow for netmasks, btw? Think
/etc/hosts
foo.example.com 10.0.0.1
bar.example.com 10.0.0.254
baz.example.com ::1

BB_ALLOWED_NETWORKS = 10.0.0.0/24 1.1.1.1/31 ::1/127

I don't believe so. You can see what actually went in here:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=59ce7d02
a
57e
0a642d839ab48677f6ac1886180f

Quoted 22 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Cheers,
Paul

There isn't netmask support, but you can achieve the same result in your example above by using BB_ALLOWED_NETWORKS =

"*.example.com"

Quoted 15 lines
Quoted 15 lines

Version 2 updated the host matching and added a few more tests.

Version 3 changed the name from BB_TRUSTED_NETWORKS to BB_ALLOWED_NETWORKS.

Thanks,
Liam R. Howlett

Quoted 5 lines

--

Paul Eggleton
Intel Open Source Technology Centre

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

#19 lore raw
In reply to Liam R. Howlett
Quoted 12 lines · Liam R. Howlett

This patch adds support for a new local.conf variable called BB_TRUSTED_NETWORK. BB_TRUSTED_NETWORK holds a list of hostnames that the user
trusts as a source for downloading content. If network access is enabled and
the user has configured trusted hosts, then any hosts that are not in the list
will cause an error to occur at fetch. Any mirrors and pre-mirrors that are
not in the list will result in warnings that these locations will not be used.

Quoted 4 lines

The BB_NO_NETWORK variable still stops all network access.

Please see the comments in the patch for more details and example usage.

Hmm, looks like this might be useful with an internal mirror coupled with PREMIRRORS, so fetches from the internal host are allowed, but anything missing from there would be immediately caught?

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#20 lore raw
Quoted 22 lines · Christopher Larson
Quoted 2 lines · Liam R. Howlett

This patch adds support for a new local.conf variable called BB_TRUSTED_NETWORK. BB_TRUSTED_NETWORK holds a list of hostnames

that the

Quoted 2 lines

user
trusts as a source for downloading content. If network access is

enabled

Quoted 2 lines

and
the user has configured trusted hosts, then any hosts that are not in

the

Quoted 2 lines

list
will cause an error to occur at fetch. Any mirrors and pre-mirrors

that

Quoted 2 lines

are
not in the list will result in warnings that these locations will not

be

Quoted 4 lines

used.

The BB_NO_NETWORK variable still stops all network access.

Quoted 8 lines
Quoted 1 line

Please see the comments in the patch for more details and example

usage.

Quoted 1 line

Hmm, looks like this might be useful with an internal mirror coupled with
PREMIRRORS, so fetches from the internal host are allowed, but anything missing from there would be immediately caught?

That was my thought, too.
I would find BB_ALLOWED_NETWORKS more intuitive though.

Cheers,

#21 lore raw
Quoted 23 lines · Bernhard Reutner-Fischer
Quoted 22 lines · Christopher Larson
Quoted 2 lines · Liam R. Howlett

This patch adds support for a new local.conf variable called BB_TRUSTED_NETWORK. BB_TRUSTED_NETWORK holds a list of hostnames

that the

Quoted 2 lines

user
trusts as a source for downloading content. If network access is

enabled

Quoted 2 lines

and
the user has configured trusted hosts, then any hosts that are not in

the

Quoted 2 lines

list
will cause an error to occur at fetch. Any mirrors and pre-mirrors

that

Quoted 2 lines

are
not in the list will result in warnings that these locations will not

be

Quoted 4 lines

used.

The BB_NO_NETWORK variable still stops all network access.

Quoted 9 lines
Quoted 8 lines
Quoted 1 line

Please see the comments in the patch for more details and example

usage.

Quoted 1 line

Hmm, looks like this might be useful with an internal mirror coupled with
PREMIRRORS, so fetches from the internal host are allowed, but anything missing from there would be immediately caught?

Yes, limiting to a local mirror is the main driving force behind this patch. It will also catch any packages getting pulled in from undesired locations through dependencies, etc.

Quoted 6 lines

That was my thought, too.
I would find BB_ALLOWED_NETWORKS more intuitive though.

Cheers,

I had BB_LIMITED_NETWORKS before, but I think BB_ALLOWED_NETWORKS is better than both of my suggestions.

Please note that I did send v2 of this patch with minor cleanup & a fix yesterday, 2015-04-15.

Thanks,
Liam