From 90b875adae98eeaf7e276414f5f8059650f643fb Mon Sep 17 00:00:00 2001 From: ParInshOvGotQuep Date: Wed, 30 Dec 2015 19:15:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=BB=98=E8=AE=A4shell=E4=B8=BAconnect.py?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8Djailbreak?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 1 + install/next.py | 8 ++++---- install/zzjumpserver.sh | 13 ------------- juser/user_api.py | 2 +- 4 files changed, 6 insertions(+), 18 deletions(-) delete mode 100755 install/zzjumpserver.sh diff --git a/connect.py b/connect.py index 18c84dee7..95444cba6 100755 --- a/connect.py +++ b/connect.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # coding: utf-8 import sys diff --git a/install/next.py b/install/next.py index 62814ee67..a68eb66bc 100755 --- a/install/next.py +++ b/install/next.py @@ -81,9 +81,9 @@ class Setup(object): os.system('id %s &> /dev/null || useradd %s' % (self.admin_user, self.admin_user)) @staticmethod - def _cp_zzsh(): - os.chdir(os.path.join(jms_dir, 'install')) - shutil.copy('zzjumpserver.sh', '/etc/profile.d/') + def _ensure_sh(): + jshell = os.path.join(jms_dir, 'connect.py') + os.chmod(jshell, 0755) @staticmethod def _run_service(): @@ -97,7 +97,7 @@ class Setup(object): self._sync_db() self._input_admin() self._create_admin() - self._cp_zzsh() + self._ensure_sh() self._run_service() diff --git a/install/zzjumpserver.sh b/install/zzjumpserver.sh deleted file mode 100755 index 98598ff18..000000000 --- a/install/zzjumpserver.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -if [ "$USER" == "admin" ] || [ "$USER" == "root" ] || [ "$USER" == "" ];then - echo "" -else - python /opt/jumpserver/connect.py - if [ $USER == 'guanghongwei' ];then - echo - else - exit 3 - echo - fi -fi diff --git a/juser/user_api.py b/juser/user_api.py index 312068907..d336d6162 100644 --- a/juser/user_api.py +++ b/juser/user_api.py @@ -151,7 +151,7 @@ def server_add_user(username, password, ssh_key_pwd='', ssh_key_login_need=True) add a system user in jumpserver 在jumpserver服务器上添加一个用户 """ - bash("useradd '%s'; echo '%s'; echo '%s' | passwd --stdin '%s'" % (username, password, password, username)) + bash("useradd -s /opt/jumpserver/connect.py '%s'; echo '%s'; echo '%s' | passwd --stdin '%s'" % (username, password, password, username)) if ssh_key_login_need: gen_ssh_key(username, ssh_key_pwd) From ac40098ac53c45e26ddfc174d36f65698514ef41 Mon Sep 17 00:00:00 2001 From: ParInshOvGotQuep Date: Thu, 31 Dec 2015 16:24:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A1=AC=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E7=9A=84shell=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- juser/user_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/juser/user_api.py b/juser/user_api.py index d336d6162..2c16c3dc7 100644 --- a/juser/user_api.py +++ b/juser/user_api.py @@ -151,7 +151,8 @@ def server_add_user(username, password, ssh_key_pwd='', ssh_key_login_need=True) add a system user in jumpserver 在jumpserver服务器上添加一个用户 """ - bash("useradd -s /opt/jumpserver/connect.py '%s'; echo '%s'; echo '%s' | passwd --stdin '%s'" % (username, password, password, username)) + bash("useradd -s %s/connect.py '%s'; echo '%s'; echo '%s' | passwd --stdin '%s'" % + (BASE_DIR, username, password, password, username)) if ssh_key_login_need: gen_ssh_key(username, ssh_key_pwd)