tailscale/tailscale
Auf GitHub ansehenutil/cloudenv: improve AWS detection to cover Windows and other non-Linux OSes
Open
#4.984 geöffnet am 30. Juni 2022
dnshelp wantedneeds-fix
Repository-Metriken
- Stars
- (31.565 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 5T 22h) (173 gemergte PRs in 30 T)
Beschreibung
#4980 adds DNS-specific tweaks when running on AWS (e.g. bootstrap DNS, not shadowing *.internal) but only works if we can detect that we're running on AWS.
Our current implementation of that detection is super minimal:
func getCloud() Cloud {
// TODO(bradfitz): also detect AWS on Windows, etc. Just try to hit the metadata server
// and see if it's there? But it might be turned off. Do some small-timeout DNS request
// to 169.254.169.253 and see if it replies? But which DNS request?
if runtime.GOOS == "linux" {
biosVendorB, _ := os.ReadFile("/sys/class/dmi/id/bios_vendor")
biosVendor := strings.TrimSpace(string(biosVendorB))
if biosVendor == "Amazon EC2" || strings.HasSuffix(biosVendor, ".amazon") {
return AWS
}
}
....
We should do something that works for BSDs & Windows on AWS too.
See that TODO above.