Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Commit

Permalink
Limit SSH node security group to Bastion IP
Browse files Browse the repository at this point in the history
  • Loading branch information
jfortin-sap committed Aug 13, 2020
1 parent a215dad commit 3a65cda
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/cmd/ssh_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (a *AwsInstanceAttribute) createBastionHostSecurityGroup() {
fmt.Println("Bastion host security group set up.")

// add shh rule to ec2 instance
arguments = fmt.Sprintf("aws ec2 authorize-security-group-ingress --group-id %s --protocol tcp --port 22 --cidr 0.0.0.0/0", a.SecurityGroupID)
arguments = fmt.Sprintf("aws ec2 authorize-security-group-ingress --group-id %s --protocol tcp --port 22 --cidr %s/32", a.SecurityGroupID, a.BastionIP)
captured = capture()
operate("aws", arguments)
_, err = captured()
Expand Down Expand Up @@ -336,7 +336,7 @@ func (a *AwsInstanceAttribute) cleanupAwsBastionHost() {

// remove shh rule from ec2 instance
fmt.Println(" (2/3) Close SSH Port on Node.")
arguments = fmt.Sprintf("aws ec2 revoke-security-group-ingress --group-id %s --protocol tcp --port 22 --cidr 0.0.0.0/0", a.SecurityGroupID)
arguments = fmt.Sprintf("aws ec2 revoke-security-group-ingress --group-id %s --protocol tcp --port 22 --cidr %s/32", a.SecurityGroupID, a.BastionIP)
captured = capture()
operate("aws", arguments)
capturedOutput, err = captured()
Expand Down

0 comments on commit 3a65cda

Please sign in to comment.