Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fb833d3c4 |
@@ -62,11 +62,14 @@ case "${1,,}" in
|
|||||||
;;
|
;;
|
||||||
esac;
|
esac;
|
||||||
|
|
||||||
# collect info via: curl http://instance-data/latest/meta-data/
|
# collect info via: curl http://169.254.169.254/latest/meta-data/
|
||||||
instance_id=$(curl -s http://instance-data/latest/meta-data/instance-id)
|
instance_data=$(
|
||||||
account_id=$(curl -s http://instance-data/latest/meta-data/identity-credentials/ec2/info/ | jq -r .AccountId)
|
TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` &&
|
||||||
region=$(curl -s http://instance-data/latest/meta-data/placement/region)
|
curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/dynamic/instance-identity/document
|
||||||
|
)
|
||||||
|
instance_id=$(echo "${instance_data}" | jq .instanceId)
|
||||||
|
account_id=$(echo "${instance_data}" | jq .accountId)
|
||||||
|
region=$(echo "${instance_data}" | jq .region)
|
||||||
|
|
||||||
if [ "${OUTPUT_TARGET}" = "text" ]; then
|
if [ "${OUTPUT_TARGET}" = "text" ]; then
|
||||||
LOG="${LOG}/check_ssh_user."$(date +"%F_%H%m%S")".log";
|
LOG="${LOG}/check_ssh_user."$(date +"%F_%H%m%S")".log";
|
||||||
|
|||||||
Reference in New Issue
Block a user