Description
What would you like to be added:
cidr
flag completion for the ssh
command.
The completion should return:
- the public
IP
s using the ipify service - the
IP
s of the systems network interfaces, excludingdown
andloopback
interfaces.
This adds some convenience for the user to specify the correct CIDR
range that should be allowed to access the bastion. Alternatively the user should still be able to specify a different CIDR
that is not part of the completion (e.g. because of natting).
Why is this needed:
When running the ssh
command you can pass the cidr
range as flag that should be allowed to access the bastion via flag. For more details on the SSH
-flow see GEP-15
If it is not provided, gardenctl
tries to guess the proper IP
/CIDR
range by using a public service (https://www.ipify.org/ in particular).
However using the public IP may not work in all scenarios, e.g. when using a VPN to access non-internet facing bastions. In this case, the user should be able to specify the correct CIDR
range that should be used and gardenctl
should have a completion for the cidr
flag that would add some convenience.
Out of scope:
- The IP could be automatically detected similar to the public
ipify
service. Instead, such a service would have to be setup within the internal network andgardenctl
would call it to have it return its internalIP
s. - First create the bastion to get it's "public" endpoint from the
status
. Then figure out which network interface is used by using something likeip route get <bastion-endpoint>
. Afterwards alter thebastion
resource to specify theIP
that was returned. See also https://engineering.qubecinema.com/2019/05/13/go-routing-package.html which is usinggithub.com/google/gopacket
, however not all architectures are supported.