修改connect方法

This commit is contained in:
ibuler
2015-11-18 15:15:08 +08:00
parent 42745c52df
commit cf8e366ae1
3 changed files with 99 additions and 41 deletions

View File

@@ -4,7 +4,7 @@ import random
import os.path
from paramiko.rsakey import RSAKey
from os import chmod, mkdir
from jumpserver.api import mkdir
from uuid import uuid4
from jumpserver.settings import KEY_DIR
@@ -46,7 +46,7 @@ def gen_keys():
"""
key_basename = "key-" + uuid4().hex
key_path_dir = os.path.join(KEY_DIR, key_basename)
mkdir(key_path_dir, 0700)
mkdir(key_path_dir, 0755)
key = RSAKey.generate(2048)
private_key = os.path.join(key_path_dir, 'id_rsa')
@@ -61,9 +61,6 @@ def gen_keys():
content_file.write(data)
return key_path_dir
if __name__ == "__main__":
print gen_keys()