jumpserver 修改源码实现密钥+密码

###背景

云主机登录  密钥+密码, jumpserver登录只能配置自动登录,或者手动登录不能满足

 

### 修改

如果设置密码为chongzhi 就必须重新录入密码

vi /opt/coco/coco/proxy.py

39行修改前
 if self.system_user.login_mode == MANUAL_LOGIN \
                or (not password and not private_key):
            prompt = "{}'s password: ".format(self.system_user.username)
            password = net_input(self.client, prompt=prompt, sensitive=True)
private_key = None

修改后

if self.system_user.login_mode == MANUAL_LOGIN:
    private_key = None
    prompt = "{}'s password: ".format(self.system_user.username)
    password = net_input(self.client, prompt=prompt, sensitive=True)
if self.system_user.login_mode <> MANUAL_LOGIN and password == "chongzhi":
    prompt = "{}'s password: ".format(self.system_user.username)
    password = net_input(self.client, prompt=prompt, sensitive=True)
    

 

你可能感兴趣的:(jumpserver,jumpserver,密钥+密码)