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

It would be nice if logging on the debug level would include verbose output for the ssh command itself (not only gardenctl ssh) #265

Closed
tedteng opened this issue Aug 20, 2020 · 3 comments · Fixed by #264
Assignees

Comments

@tedteng
Copy link
Contributor

tedteng commented Aug 20, 2020

It would be nice if logging on the debug level would include verbose output for the ssh command itself (not only gardenctl ssh)

Originally posted by @danielfoehrKn in #259 (comment)

@tedteng
Copy link
Contributor Author

tedteng commented Aug 20, 2020

@danielfoehrKn Please have a look PR: check #264. I was also want to set the global flag before, but working on another ticket which allow non-operator ssh node via gardenctl, doesn't have time working on that. Base on the global flag concept, two enhance in this PR.

  1. ssh Verbose mode
Bastion host instance running.
Waiting 60 seconds for Bastion SSH port open
=> nc: connectx to 54.93.202.72 port 22 (tcp) failed: Connection refused

=> nc: connectx to 54.93.202.72 port 22 (tcp) failed: Connection refused

=> Connection to 54.93.202.72 port 22 [tcp/*] succeeded!

Opened SSH Port on Bastion
SSH gardener@54.93.202.72 => gardener@ip-10-250-10-22.eu-central-1.compute.internalOpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Executing proxy command: exec ssh -W ip-10-250-10-22.eu-central-1.compute.internal:22 -i /Users/i333/.garden/cache/canary-virtual/projects/i333/zegfzwjhzh/key -o IdentitiesOnly=yes -o ConnectionAttempts=2 -o StrictHostKeyChecking=no gardener@54.93.202.72
debug1: identity file /Users/i333/.garden/cache/canary-virtual/projects/i333/zegfzwjhzh/key type -1
debug1: identity file /Users/i333/.garden/cache/canary-virtual/projects/i333/zegfzwjhzh/key-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
Warning: Permanently added '54.93.202.72' (ED25519) to the list of known hosts.
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Debian-4
debug1: match: OpenSSH_8.2p1 Debian-4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to ip-10-250-10-22.eu-central-1.compute.internal:22 as 'gardener'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
...
  1. Error msg enhance
    I try adopt logger.Debugf but not too much useful information as before, maybe I get wrong ways when use logger.Debugf
gg target -g ttt -p i333878 -t zegfzwjhzh -d
Garden:
KUBECONFIG=/Users/i333878/gardener_kubeconfig/ttt/kubeconfig
time="2020-08-20T08:42:35+08:00" level=debug msg="secrets \"seed-aws-eu1\" is forbidden: User \"system:serviceaccount:garden-i333878:robot\" cannot get resource \"secrets\" in API group \"\" in the namespace \"garden\""
exit status 2

after change, it looks like this when we call ErrorCheck, the error msg will display the error file and lines

gg target -g ttt -p i333xxx -t zegfzwjhzh -d
Garden:
KUBECONFIG=/Users/i333xxx/gardener_kubeconfig/ttt/kubeconfig
2020/08/20 08:51:51 [error] /Users/i333xxx/Work/tedteng/gardenctl/pkg/cmd/target.go:568 
 secrets "seed-aws-eu1" is forbidden: User "system:serviceaccount:garden-i333xxx:robot" cannot get resource "secrets" in API group "" in the namespace "garden"
exit status 2

@tedteng
Copy link
Contributor Author

tedteng commented Aug 21, 2020

/assign

@tedteng
Copy link
Contributor Author

tedteng commented Sep 7, 2020

done
ssh verbose in AWS PR :#264
GCP: #297
AZURE: #305

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants