Add 127.0.0.1 localhost to container /etc/hosts
This commit is contained in:
parent
ede631b8e1
commit
021bac46b3
@ -29,8 +29,9 @@ def load_leases():
|
|||||||
leases = {ip: hostname for ip, hostname in leases}
|
leases = {ip: hostname for ip, hostname in leases}
|
||||||
mtime = file_mtime
|
mtime = file_mtime
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
# If the file doesn't exist, create it with localhost and container host as default records
|
||||||
interface = get_bridge_interface()
|
interface = get_bridge_interface()
|
||||||
leases = {str(interface.ip): 'host'}
|
leases = {'127.0.0.1': 'localhost', str(interface.ip): 'host'}
|
||||||
|
|
||||||
@locked(config.HOSTS_LOCK_FILE)
|
@locked(config.HOSTS_LOCK_FILE)
|
||||||
def save_leases():
|
def save_leases():
|
||||||
|
@ -94,6 +94,7 @@ def unpack_archive(archive_path, destination, expected_hash, observer):
|
|||||||
data = None
|
data = None
|
||||||
|
|
||||||
def load(force=False):
|
def load(force=False):
|
||||||
|
# Download package manifest and signature and verify
|
||||||
global data
|
global data
|
||||||
if not data or force:
|
if not data or force:
|
||||||
with requests.Session() as session:
|
with requests.Session() as session:
|
||||||
@ -103,6 +104,7 @@ def load(force=False):
|
|||||||
resource = session.get(config.ONLINE_SIG_URL, timeout=5)
|
resource = session.get(config.ONLINE_SIG_URL, timeout=5)
|
||||||
resource.raise_for_status()
|
resource.raise_for_status()
|
||||||
packages_sig = resource.content
|
packages_sig = resource.content
|
||||||
|
# Raises cryptography.exceptions.InvalidSignature on verification failure
|
||||||
get_public_key().verify(packages_sig, packages, ec.ECDSA(hashes.SHA512()))
|
get_public_key().verify(packages_sig, packages, ec.ECDSA(hashes.SHA512()))
|
||||||
data = json.loads(packages.decode())
|
data = json.loads(packages.decode())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user