mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-10-22 08:19:04 +00:00
解决jperm key dir 和 ansible api问题
This commit is contained in:
@@ -4,7 +4,7 @@ import random
|
||||
import os.path
|
||||
|
||||
from paramiko.rsakey import RSAKey
|
||||
from os import chmod, mkdir
|
||||
from os import chmod, makedirs
|
||||
from uuid import uuid4
|
||||
|
||||
from jumpserver.settings import KEY_DIR
|
||||
@@ -45,8 +45,8 @@ def gen_keys():
|
||||
:return: 返回目录名(uuid)
|
||||
"""
|
||||
key_basename = "key-" + uuid4().hex
|
||||
key_path_dir = os.path.join(KEY_DIR, key_basename)
|
||||
mkdir(key_path_dir, 0700)
|
||||
key_path_dir = os.path.join(KEY_DIR, 'role_key', key_basename)
|
||||
makedirs(key_path_dir, 0775)
|
||||
|
||||
key = RSAKey.generate(2048)
|
||||
private_key = os.path.join(key_path_dir, 'id_rsa')
|
||||
@@ -62,8 +62,6 @@ def gen_keys():
|
||||
return key_path_dir
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print gen_keys()
|
||||
|
||||
|
Reference in New Issue
Block a user