File tree Expand file tree Collapse file tree 1 file changed +0
-19
lines changed
cookbooks/aws-parallelcluster-config/templates/default/openssh Expand file tree Collapse file tree 1 file changed +0
-19
lines changed Original file line number Diff line number Diff line change @@ -19,24 +19,6 @@ log() {
19
19
echo " $@ " | logger -t " pcluster_ssh_target_checker"
20
20
}
21
21
22
- retrieve_vpc_cidr_list () {
23
- TOKEN=$( curl --retry 3 --retry-delay 0 --fail -s -X PUT " http://169.254.169.254/latest/api/token" -H " X-aws-ec2-metadata-token-ttl-seconds: 300" )
24
- if ! mac=$( curl --retry 3 --retry-delay 0 --silent --fail -H " X-aws-ec2-metadata-token: ${TOKEN} " http://169.254.169.254/latest/meta-data/mac) ; then
25
- log " Unable to determine MAC address for network interface"
26
- exit 1
27
- fi
28
-
29
- vpc_cidr_uri=" http://169.254.169.254/latest/meta-data/network/interfaces/macs/${mac} /vpc-ipv4-cidr-blocks"
30
- vpc_cidr_list=($( curl --retry 3 --retry-delay 0 --silent --fail -H " X-aws-ec2-metadata-token: ${TOKEN} " " ${vpc_cidr_uri} " ) )
31
-
32
- if ! (( ${# vpc_cidr_list[@]} )) ; then
33
- log " Unable to retrieve VPC CIDR list from EC2 meta-data"
34
- exit 1
35
- fi
36
-
37
- echo " ${vpc_cidr_list[@]} "
38
- }
39
-
40
22
convert_ip_to_decimal () {
41
23
IFS=./ read -r x y z t mask <<< " ${1}"
42
24
echo -n " $(( x<< 24 | y<< 16 | z<< 8 | t)) "
78
60
79
61
for vpc_cidr in " ${VPC_CIDR_LIST[@]} "
80
62
do
81
- check_ip_in_cidr " ${resolved_ip} " " ${vpc_cidr} "
82
63
if check_ip_in_cidr " ${resolved_ip} " " ${vpc_cidr} " ; then
83
64
log " Target Host ${target_host} is in VPC CIDR ${vpc_cidr} "
84
65
exit 0
You can’t perform that action at this time.
0 commit comments