mirrors
mirrors copied to clipboard
Exclude the private mirrors from the mirrors list in the case of fallback behavior
Change https://github.com/AlmaLinux/mirrors/blob/mirrors_service/src/backend/api/handlers.py#L187-L190 to make the call with without_private_mirrors=True
To expand on the context here, I noted that when a client doesn't match on the network service cone (subnets and/or ASNs) of any mirrors, it falls back to rely on geo data to find near-by mirrors.
The get_mirrors_list()→ _get_nearest_mirrors(without_private_mirrors=False)→_get_nearest_mirrors_by_geo_data() call chain then fails to account for private mirrors only servicing their specified network cones.
The failure modes here are:
- A client which fails geo match lookup receives a full list of mirrors, including private mirrors.
- A private mirror accidentally incudes geo data in their mirror.d configuration file, and starts matching as an option for other near-by clients outside their network service cone.
Result from dev machine
[ec2-user@ip-172-31-90-25 ~]$ curl -H "X-Forwarded-For: 127.0.0.1" http://localhost/mirrorlist/8/appstream 2>&1 | grep "centos.corp.cloudlinux.com"
[ec2-user@ip-172-31-90-25 ~]$
For 127.0.0.1
the service should return full list and centos.corp.cloudlinux.com
is private mirror
The patch is deployed to production