az acs kubernetes get-credentials | EC密钥无效。 | ssh known_hosts corrupted

时间:2017-12-04 15:00:25

标签: azure ssh command-line-interface paramiko

我遇到了这个问题,我花了一段时间,一些直觉,有根据的猜测和一个strace -f command来找到这个错误。 我认为除了paramico之外它被错误地抓住了吗?库,由某些Azure CLI异常捕获程序隐藏。

无论如何,我离开它,所以futere-我和未来 - 你可以找到它。

az acs kubernetes get-credentials
Invalid EC key.


$ strace -f az acs kubernetes get-credentials

(interesting part of MissingHostKeyPolicy wrt hostkeys (my guess - known_hosts file)

[pid  9035] open("/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/paramiko/client.py", O_RDONLY) = 4
[pid  9035] fstat(4, {st_mode=S_IFREG|0664, st_size=30983, ...}) = 0
[pid  9035] fstat(4, {st_mode=S_IFREG|0664, st_size=30983, ...}) = 0
[pid  9035] read(4, "# Copyright (C) 2006-2007  Robey"..., 8192) = 8192
[pid  9035] read(4, " sock=None,\n        gss_auth=Fal"..., 4096) = 4096
[pid  9035] read(4, "t be\n            verified\n      "..., 4096) = 4096
[pid  9035] read(4, "        )\n            else:\n    "..., 4096) = 4096
[pid  9035] read(4, "    chan = self._transport.open_"..., 4096) = 4096
[pid  9035] read(4, "                allowed_types = "..., 4096) = 4096
[pid  9035] read(4, " MissingHostKeyPolicy (object):\n"..., 4096) = 2311
[pid  9035] read(4, "", 4096)           = 0
[pid  9035] close(4)                    = 0
[pid  9035] stat("/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/paramiko/hostkeys.py", {st_mode=S_IFREG|0664, st_size=13135, ...}) = 0


(part just before crush)
[pid  9035] read(4, "    bn_ptr = self._lib.BN_bin2bn"..., 4096) = 4096
[pid  9035] read(4, "lf._lib.BIO_new_mem_buf(\n       "..., 4096) = 4096
[pid  9035] read(4, "              hashes.SHA1,\n     "..., 4096) = 4096
[pid  9035] read(4, "DSA_free)\n\n        p = self._int"..., 4096) = 4096
[pid  9035] read(4, "ror(\n                \"MD5 is not"..., 4096) = 4096
[pid  9035] read(4, " CRL version. We only support v2"..., 4096) = 4096
[pid  9035] read(4, ": {0}'.format(extension.oid)\n   "..., 4096) = 4096
[pid  9035] read(4, "   return self._evp_pkey_to_priv"..., 4096) = 4096
[pid  9035] read(4, "eturn _CertificateRevocationList"..., 4096) = 4096
[pid  9035] read(4, " _Reasons.UNSUPPORTED_CIPHER\n   "..., 4096) = 4096
[pid  9035] read(4, "i.NULL)\n        ec_cdata = self."..., 4096) = 4096
[pid  9035] read(4, "res != 1:\n            self._cons"..., 4096) = 4096
[pid  9035] read(4, "ding must be an item from the En"..., 4096) = 4096
[pid  9035] read(4, "            write_bio = self._li"..., 4096) = 4096
[pid  9035] read(4, "        parameter_numbers = numb"..., 4096) = 4096
[pid  9035] read(4, "        self._lib.NID_X25519, se"..., 4096) = 1791
[pid  9035] read(4, "", 4096)           = 0

我是对的 - 我知道的两行胶粘在一起。奇怪的是,只有az cli确实失败了

|1|YDdg1mMCRjdmiJt7MkMpelWDk2o=|i1EMCbgw/5my5flPsw2BiFa8mUM= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTAAABBBCpdyijGVsvUtMdlLoB5ekaQHQ2ZzQ0Z8UY5xdOAx9qqb3cYCYJgv8mc32yUzSu8D4iKfW2E5JXB8fG5otZsi3E=
|1|bssRIVCpG+vfNtdM4RAwH6zUCW8=|7AFIFRTmvoqO12bTZ0CyTgTqKdw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBaXNnBKKBlQ1WDqy90c1zNjklBL7zXqDIB|1|AOjIgeSGPSh32t33uEGOX3iycrc=|7LupvcIR6QL8USA193kRORnA1rQ= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyTYAAAAIbmlzdHAyNTYAAABBBBaXNnBKKBlQ1WDqy90c1zNjklBL7zXqDIBbAp0NBe9dYmuyTytpGxOWvmWoA1gjbNd/ekXW+m8gd6Yf8pDE/Cg=
|1|67+OBFoZyiXGx6mDl+lu/3SpBOc=|K6GLNh6ztZ9eb8cNGV64Rn3/yIM= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBD7n79Vhwqw8zmRFFQvjnE2UB24vl8JWAN0ZPPFDOtr9jBd90AKsbZEXmqZhP1GennphesTU1cdHayQrQGbjV8=

1 个答案:

答案 0 :(得分:0)

一个侧面话题: 拆分行后,错误消息已更改为更易读的输出。最后,我确实删除了损坏的行以使其正常工作。

edited known_hosts file 
|1|YDdg1mMCRjdmiJt7MkMpelWDk2o=|i1EMCbgw/5my5flPsw2BiFa8mUM= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTAAABBBCpdyijGVsvUtMdlLoB5ekaQHQ2ZzQ0Z8UY5xdOAx9qqb3cYCYJgv8mc32yUzSu8D4iKfW2E5JXB8fG5otZsi3E=
|1|bssRIVCpG+vfNtdM4RAwH6zUCW8=|7AFIFRTmvoqO12bTZ0CyTgTqKdw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBaXNnBKKBlQ1WDqy90c1zNjklBL7zXqDIB
|1|AOjIgeSGPSh32t33uEGOX3iycrc=|7LupvcIR6QL8USA193kRORnA1rQ= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyTYAAAAIbmlzdHAyNTYAAABBBBaXNnBKKBlQ1WDqy90c1zNjklBL7zXqDIBbAp0NBe9dYmuyTytpGxOWvmWoA1gjbNd/ekXW+m8gd6Yf8pDE/Cg=
|1|67+OBFoZyiXGx6mDl+lu/3SpBOc=|K6GLNh6ztZ9eb8cNGV64Rn3/yIM= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBD7n79Vhwqw8zmRFFQvjnE2UB24vl8JWAN0ZPPFDOtr9jBd90AKsbZEXmqZhP1GennphesTU1cdHayQrQGbjV8=

az acs kubernetes get-credentials --resource-group=myResourcGroup --name=myK8sCluster
('|1|bssRIVCpG+vfNtdM4RAwH6zUCW8=|7AFIFRTmvoqO12bTZ0CyTgTqKdw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBaXNnBKKBlQ1WDqy90c1zNjklBL7zXqDIB', Error('Incorrect padding',))
Traceback (most recent call last):
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/main.py", line 36, in main
    cmd_result = APPLICATION.execute(args)
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/core/application.py", line 216, in execute
    result = expanded_arg.func(params)
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 377, in __call__
    return self.handler(*args, **kwargs)
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 620, in _execute_command
    reraise(*sys.exc_info())
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 602, in _execute_command
    result = op(client, **kwargs) if client else op(**kwargs)
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/command_modules/acs/custom.py", line 776, in k8s_get_credentials
    _k8s_get_credentials_internal(name, acs_info, path, ssh_key_file)
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/command_modules/acs/custom.py", line 797, in _k8s_get_credentials_internal
    '.kube/config', path_candidate, key_filename=ssh_key_file)
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/command_modules/acs/acs_client.py", line 70, in secure_copy
    ssh.load_system_host_keys()
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/paramiko/client.py", line 102, in load_system_host_keys
    self._system_host_keys.load(filename)
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/paramiko/hostkeys.py", line 97, in load
    e = HostKeyEntry.from_line(line, lineno)
  File "/home/kuba/lib/azure-cli/local/lib/python2.7/site-packages/paramiko/hostkeys.py", line 366, in from_line
    raise InvalidHostKey(line, e)
InvalidHostKey: ('|1|bssRIVCpG+vfNtdM4RAwH6zUCW8=|7AFIFRTmvoqO12bTZ0CyTgTqKdw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBaXNnBKKBlQ1WDqy90c1zNjklBL7zXqDIB', Error('Incorrect padding',))