dgzlopes / cloud-detect

Module that determines a host's cloud provider.
https://pypi.org/project/cloud-detect/
MIT License
35 stars 13 forks source link

Vultr detected as Azure #23

Closed derekjc closed 1 year ago

derekjc commented 1 year ago

cloud-detect identifies Vultr as Azure:

[root@test-id ~]# python3
Python 3.11.3 (main, May 24 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cloud_detect import provider
>>> provider()
'azure'
>>>

It looks like azure provider only checks for return status of 200. In vultr, it also responds with a 200.

[root@test-id ~]# curl -v http://169.254.169.254/metadata/instance?api-version=2017-12-01
*   Trying 169.254.169.254:80...
* Connected to 169.254.169.254 (169.254.169.254) port 80 (#0)
> GET /metadata/instance?api-version=2017-12-01 HTTP/1.1
> Host: 169.254.169.254
> User-Agent: curl/8.0.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Sat, 15 Jul 2023 11:25:35 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Expires: Sat, 15 Jul 2023 11:25:34 GMT
< Cache-Control: no-cache
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
<
* Connection #0 to host 169.254.169.254 left intact