bugfix(登录初始化) 避免登录时ctrl+c进入系统内部

此bug信息见 #72
1. 修改思路 重命名zzjumpserver.sh,并移动到外层
2. 服务器添加用户时指定shell为 some_dir/jumpserver/init.sh

升级修复方案:
1. 删除/etc/profile.d/zzjumpserver.sh
2. git pull 更新
3. vim编辑 /etc/passwd,把之前建的用户的sh改为 some_dir/jumpserver/init.sh

终
Closes #72
closes #31
pull/134/head
ibuler 2016-02-23 17:40:33 +08:00
parent 9fa7f8762e
commit 6be7003ac2
3 changed files with 12 additions and 15 deletions

10
init.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
#
trap '' SIGINT
base_dir=$(dirname $0)
export LANG='zh_CN.UTF-8'
python $base_dir/connect.py
exit

View File

@ -1,13 +0,0 @@
#!/bin/bash
export LANG='zh_CN.UTF-8'
if [ "$USER" != "admin" ] && [ "$USER" != "root" ];then
python /opt/jumpserver/connect.py
if [ $USER == 'guanghongwei' ];then
echo
else
exit 3
echo
fi
fi

View File

@ -151,8 +151,8 @@ def server_add_user(username, password, ssh_key_pwd='', ssh_key_login_need=True)
add a system user in jumpserver add a system user in jumpserver
在jumpserver服务器上添加一个用户 在jumpserver服务器上添加一个用户
""" """
bash("useradd '%s'; echo '%s'; echo '%s:%s' | chpasswd " % bash("useradd -s '%s' '%s'; echo '%s'; echo '%s:%s' | chpasswd " %
(username, password, username, password)) (os.path.join(BASE_DIR, 'init.sh'), username, password, username, password))
if ssh_key_login_need: if ssh_key_login_need:
gen_ssh_key(username, ssh_key_pwd) gen_ssh_key(username, ssh_key_pwd)