ssh-add:密钥长度无效

时间:2018-01-02 02:42:27

标签: ssh

我的mac自动升级后,尝试ssh-add fail:

import MySQLdb
from configdb import DB_HOST, DB_PASS, DB_USER, DB_DATABASE_NAME

db = MySQLdb.connect(host=DB_HOST,    # your host, usually localhost
                     user=DB_USER,         # your username
                     passwd=DB_PASS,  # your password
                     db=DB_DATABASE_NAME)        # name of the data base

cur = db.cursor()

PATH_TO_FILE = "db-testcases.sql"

fullLine = ''

for line in open(PATH_TO_FILE):
  tempLine = line.strip()

  # Skip empty lines.
  # However, it seems "strip" doesn't remove every sort of whitespace.
  # So, we also catch the "Query was empty" error below.
  if len(tempLine) == 0:
    continue

  # Skip comments
  if tempLine[0] == '#':
    continue

  fullLine += line

  if not ';' in line:
    continue

  # You can remove this. It's for debugging purposes.
  print "[line] ", fullLine, "[/line]"

  try:
    cur.execute(fullLine)
  except MySQLdb.OperationalError as e:
    if e[1] == 'Query was empty':
      continue

    raise e

  fullLine = ''

db.close()

但我该如何解决这个问题呢?

谢谢!

2 个答案:

答案 0 :(得分:13)

根据OpenSSH 7.6的release notes

Refuse RSA keys <1024 bits in length and improve reporting
for keys that do not meet this requirement.

因此,您尝试导入的密钥可能太短(弱)。您最好的选择是生成一个新密钥。

答案 1 :(得分:0)

这里有一个4096位密钥,该密钥不能太短。

$ ssh -V
OpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n  7 Dec 2017