From 021bac46b39ef25b0daea1eb6c4ee0c38160a89f Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 3 May 2020 21:52:16 +0200 Subject: [PATCH] Add 127.0.0.1 localhost to container /etc/hosts --- usr/lib/python3.8/spoc/net.py | 3 ++- usr/lib/python3.8/spoc/repo_online.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/usr/lib/python3.8/spoc/net.py b/usr/lib/python3.8/spoc/net.py index 844f5b2..b85aabf 100644 --- a/usr/lib/python3.8/spoc/net.py +++ b/usr/lib/python3.8/spoc/net.py @@ -29,8 +29,9 @@ def load_leases(): leases = {ip: hostname for ip, hostname in leases} mtime = file_mtime except FileNotFoundError: + # If the file doesn't exist, create it with localhost and container host as default records interface = get_bridge_interface() - leases = {str(interface.ip): 'host'} + leases = {'127.0.0.1': 'localhost', str(interface.ip): 'host'} @locked(config.HOSTS_LOCK_FILE) def save_leases(): diff --git a/usr/lib/python3.8/spoc/repo_online.py b/usr/lib/python3.8/spoc/repo_online.py index a895f87..4b136fc 100644 --- a/usr/lib/python3.8/spoc/repo_online.py +++ b/usr/lib/python3.8/spoc/repo_online.py @@ -94,6 +94,7 @@ def unpack_archive(archive_path, destination, expected_hash, observer): data = None def load(force=False): + # Download package manifest and signature and verify global data if not data or force: with requests.Session() as session: @@ -103,6 +104,7 @@ def load(force=False): resource = session.get(config.ONLINE_SIG_URL, timeout=5) resource.raise_for_status() packages_sig = resource.content + # Raises cryptography.exceptions.InvalidSignature on verification failure get_public_key().verify(packages_sig, packages, ec.ECDSA(hashes.SHA512())) data = json.loads(packages.decode())