diff --git a/jumpserver.conf b/jumpserver.conf index c1e035757..b313ae32e 100644 --- a/jumpserver.conf +++ b/jumpserver.conf @@ -27,8 +27,8 @@ web_socket_host = 192.168.20.209:3000 [mail] -email_host = smtp.exmail.qq.com +email_host = smtp.qq.com email_port = 25 -email_host_user = noreply@jumpserver.org -email_host_password = jumpserver123 +email_host_user = xxxx@qq.com +email_host_password = qqpasswd email_use_tls = False diff --git a/juser/views.py b/juser/views.py index 0fd6ee4c0..054de5e49 100644 --- a/juser/views.py +++ b/juser/views.py @@ -69,7 +69,6 @@ def db_add_user(**kwargs): def db_update_user(**kwargs): - print kwargs groups_post = kwargs.pop('groups') user_id = kwargs.pop('user_id') user = User.objects.filter(id=user_id) @@ -640,7 +639,7 @@ def user_add(request): 您的部门: %s 您的角色: %s 您的web登录密码: %s - 您的ssh登录密码: %s + 您的ssh密钥文件密码: %s 密钥下载地址: http://%s:%s/juser/down_key/?id=%s 说明: 请登陆后再下载密钥! """ % (name, username, dept.name, user_role.get(role_post, ''), @@ -722,12 +721,11 @@ def user_add_adm(request): 您的部门: %s 您的角色: %s 您的web登录密码: %s - 您的ssh登录密码: %s + 您的ssh密钥文件密码: %s 密钥下载地址: http://%s:%s/juser/down_key/?id=%s 说明: 请登陆后再下载密钥! """ % (name, username, dept.name, '普通用户', password, ssh_key_pwd, SEND_IP, SEND_PORT, user.id) - print MAIL_FROM send_mail(mail_title, mail_msg, MAIL_FROM, [email], fail_silently=False) msg = u'添加用户 %s 成功! 用户密码已发送到 %s 邮箱!' % (username, email) diff --git a/service.sh b/service.sh index 69873375e..65cd3b67a 100644 --- a/service.sh +++ b/service.sh @@ -1,24 +1,112 @@ #!/bin/bash +# jumpserver Startup script for the jumpserver Server +# +# chkconfig: - 85 12 +# description: Open source detecting system +# processname: jumpserver # Date: 2015-04-12 # Version: 2.0.0 # Site: http://www.jumpserver.org # Author: jumpserver group . /etc/init.d/functions +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin base_dir=$(dirname $0) -case $1 in -start) - python $base_dir/manage.py runserver 0.0.0.0:80 & - python $base_dir/log_handler.py & - cd $base_dir/websocket/; node index.js & - ;; +PROC_NAME="jumpsever" +lockfile=/var/lock/subsys/${PROC_NAME} + + +start() { + jump_start=$"Starting ${PROC_NAME} service:" + + if [ -f $lockfile ];then + echo "jumpserver is running..." + success "$jump_start" + else + daemon python $base_dir/manage.py runserver 0.0.0.0:80 &>> /tmp/jumpserver.log 2>&1 & + daemon python $base_dir/log_handler.py &> /dev/null 2>&1 & + cd $base_dir/websocket/;daemon node index.js &> /dev/null 2>&1 & + sleep 1 + + echo "$jump_start" + nums=0 + for i in manage.py log_handler.py index.js;do + ps aux | grep "$i" | grep -v 'grep' && let nums+=1 &> /dev/null + done + + if [ "x$nums" = "x4" ];then + success "$jump_start" + touch "$lockfile" + echo + else + failure "$jump_start" + echo + fi + + fi + + +} + + +stop() { + + echo -n $"Stopping ${PROC_NAME} service:" + + if [ -e $lockfile ];then + ps aux | grep -E 'manage.py|log_handler.py|index.js' | grep -v grep | awk '{print $2}' | xargs kill -9 &> /dev/null + ret=$? + + if [ $ret -eq 0 ]; then + echo_success + echo + rm -f "$lockfile" + else + echo_failure + echo + fi + else + echo_success + echo + + fi + + + +} + + + +restart(){ + stop + start +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + + restart) + restart + ;; + + *) + echo $"Usage: $0 {start|stop|restart}" + exit 2 +esac + + + + + + + -stop) - pkill -15 runserver - pkill -15 log_handler.py - pkill -15 node - ;; -esac diff --git a/templates/jasset/group_add.html b/templates/jasset/group_add.html index be6c7b91d..b198e005a 100644 --- a/templates/jasset/group_add.html +++ b/templates/jasset/group_add.html @@ -73,7 +73,7 @@
@@ -151,12 +151,12 @@