Merge pull request #10260 from Security-Onion-Solutions/kilo

simplify cloud detection
This commit is contained in:
Jason Ertel
2023-05-01 11:26:34 -04:00
committed by GitHub

View File

@@ -919,11 +919,9 @@ create_repo() {
detect_cloud() { detect_cloud() {
info "Testing if setup is running on a cloud instance..." info "Testing if setup is running on a cloud instance..."
if ( curl --fail -s -m 5 http://169.254.169.254/latest/meta-data/instance-id > /dev/null ) || \ if dmidecode -s bios-version | grep -q amazon || \
( curl --fail -s -m 5 -H "X-aws-ec2-metadata-token: $(curl -s -X PUT -m 5 'http://169.254.169.254/latest/api/token' -H 'X-aws-ec2-metadata-token-ttl-seconds: 30')" http://169.254.169.254/latest/meta-data/instance-id > /dev/null) || \ dmidecode -s bios-vendor | grep -q Google || \
(dmidecode -s bios-vendor | grep -q Google > /dev/null) || \
[ -f /var/log/waagent.log ]; then [ -f /var/log/waagent.log ]; then
info "Detected a cloud installation..." && export is_cloud="true"; info "Detected a cloud installation..." && export is_cloud="true";
else else
info "This does not appear to be a cloud installation." info "This does not appear to be a cloud installation."