Commit 6ff03084 authored by ibuler's avatar ibuler

Merge branch 'sh1' into sh

parents a12e401f 90b875ad
#!/usr/bin/env python
# coding: utf-8 # coding: utf-8
import sys import sys
......
...@@ -81,9 +81,9 @@ class Setup(object): ...@@ -81,9 +81,9 @@ class Setup(object):
os.system('id %s &> /dev/null || useradd %s' % (self.admin_user, self.admin_user)) os.system('id %s &> /dev/null || useradd %s' % (self.admin_user, self.admin_user))
@staticmethod @staticmethod
def _cp_zzsh(): def _ensure_sh():
os.chdir(os.path.join(jms_dir, 'install')) jshell = os.path.join(jms_dir, 'connect.py')
shutil.copy('zzjumpserver.sh', '/etc/profile.d/') os.chmod(jshell, 0755)
@staticmethod @staticmethod
def _run_service(): def _run_service():
...@@ -97,7 +97,7 @@ class Setup(object): ...@@ -97,7 +97,7 @@ class Setup(object):
self._sync_db() self._sync_db()
self._input_admin() self._input_admin()
self._create_admin() self._create_admin()
self._cp_zzsh() self._ensure_sh()
self._run_service() self._run_service()
......
#!/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
...@@ -151,7 +151,7 @@ def server_add_user(username, password, ssh_key_pwd='', ssh_key_login_need=True) ...@@ -151,7 +151,7 @@ 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' | 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: if ssh_key_login_need:
gen_ssh_key(username, ssh_key_pwd) gen_ssh_key(username, ssh_key_pwd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment