mirror of https://github.com/jumpserver/jumpserver
bug fix
parent
014d0935ba
commit
34cbb13b8a
|
@ -487,7 +487,8 @@ def get_tmp_dir():
|
||||||
|
|
||||||
def defend_attack(func):
|
def defend_attack(func):
|
||||||
def _deco(request, *args, **kwargs):
|
def _deco(request, *args, **kwargs):
|
||||||
if int(request.session.get('visit', 1)) > 5:
|
if int(request.session.get('visit', 1)) > 10:
|
||||||
|
logger.debug('请求次数: %s' % request.session.get('visit', 1))
|
||||||
return HttpResponse('Forbidden', status=403)
|
return HttpResponse('Forbidden', status=403)
|
||||||
request.session['visit'] = request.session.get('visit', 1) + 1
|
request.session['visit'] = request.session.get('visit', 1) + 1
|
||||||
request.session.set_expiry(300)
|
request.session.set_expiry(300)
|
||||||
|
@ -495,6 +496,11 @@ def defend_attack(func):
|
||||||
return _deco
|
return _deco
|
||||||
|
|
||||||
|
|
||||||
|
def get_mac_address():
|
||||||
|
node = uuid.getnode()
|
||||||
|
mac = uuid.UUID(int=node).hex[-12:]
|
||||||
|
return mac
|
||||||
|
|
||||||
|
|
||||||
CRYPTOR = PyCrypt(KEY)
|
CRYPTOR = PyCrypt(KEY)
|
||||||
logger = set_log(LOG_LEVEL)
|
logger = set_log(LOG_LEVEL)
|
||||||
|
|
|
@ -137,7 +137,7 @@ def gen_ssh_key(username, password='',
|
||||||
|
|
||||||
if authorized_keys:
|
if authorized_keys:
|
||||||
auth_key_dir = os.path.join(home, username, '.ssh')
|
auth_key_dir = os.path.join(home, username, '.ssh')
|
||||||
mkdir(auth_key_dir, mode=0700)
|
mkdir(auth_key_dir, username=username , mode=0700)
|
||||||
authorized_key_file = os.path.join(auth_key_dir, 'authorized_keys')
|
authorized_key_file = os.path.join(auth_key_dir, 'authorized_keys')
|
||||||
with open(private_key_file+'.pub') as pub_f:
|
with open(private_key_file+'.pub') as pub_f:
|
||||||
with open(authorized_key_file, 'w') as auth_f:
|
with open(authorized_key_file, 'w') as auth_f:
|
||||||
|
|
|
@ -302,7 +302,7 @@ def forget_password(request):
|
||||||
return render_to_response('juser/forget_password.html', locals())
|
return render_to_response('juser/forget_password.html', locals())
|
||||||
|
|
||||||
|
|
||||||
@require_role('user')
|
@defend_attack
|
||||||
def reset_password(request):
|
def reset_password(request):
|
||||||
uuid_r = request.GET.get('uuid', '')
|
uuid_r = request.GET.get('uuid', '')
|
||||||
timestamp = request.GET.get('timestamp', '')
|
timestamp = request.GET.get('timestamp', '')
|
||||||
|
|
|
@ -189,7 +189,8 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="text-left">
|
<div class="text-left">
|
||||||
<table class="table table-striped" id="ugedit" >
|
<table class="table table-striped" id="ugedit" >
|
||||||
<a class="btn btn-xs btn-danger del_muti"> 删除 </a>
|
<a class="btn btn-xs btn-danger del_muti"> 删除 </a><span> </span>
|
||||||
|
<a class="btn btn-xs btn-primary re_push"> 重新推送 </a>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
|
@ -322,6 +323,15 @@
|
||||||
});
|
});
|
||||||
var url = '/jperm/role/push/?id={{ role.id }}&asset_id=' + check_array.join(',');
|
var url = '/jperm/role/push/?id={{ role.id }}&asset_id=' + check_array.join(',');
|
||||||
$(this).attr('href', url)
|
$(this).attr('href', url)
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.re_push').click(function(){
|
||||||
|
var check_array = [];
|
||||||
|
$(".gradeX input[name='asset_id']:checked").each(function() {
|
||||||
|
check_array.push($(this).attr("value"))
|
||||||
|
});
|
||||||
|
var url = '/jperm/role/push/?id={{ role.id }}&asset_id=' + check_array.join(',');
|
||||||
|
$(this).attr('href', url)
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,11 +11,13 @@ cp ${sudo_file} ${sudo_file_bak}
|
||||||
add_cmd_alias() {
|
add_cmd_alias() {
|
||||||
sudo_file=$1
|
sudo_file=$1
|
||||||
{% for sudo_name, sudo_cmd in sudo_alias.items %}
|
{% for sudo_name, sudo_cmd in sudo_alias.items %}
|
||||||
|
{% if sudo_name != 'ALL' %}
|
||||||
if $(grep '^Cmnd_Alias {{ sudo_name }}' ${sudo_file} &> /dev/null); then
|
if $(grep '^Cmnd_Alias {{ sudo_name }}' ${sudo_file} &> /dev/null); then
|
||||||
sed -i 's@^Cmnd_Alias.*{{ sudo_name }}.*@Cmnd_Alias {{ sudo_name }} = {{ sudo_cmd }}@g' ${sudo_file}
|
sed -i 's@^Cmnd_Alias.*{{ sudo_name }}.*@Cmnd_Alias {{ sudo_name }} = {{ sudo_cmd }}@g' ${sudo_file}
|
||||||
else
|
else
|
||||||
echo "Cmnd_Alias {{ sudo_name }} = {{ sudo_cmd }}" >> ${sudo_file}
|
echo "Cmnd_Alias {{ sudo_name }} = {{ sudo_cmd }}" >> ${sudo_file}
|
||||||
fi
|
fi
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<a><i class="fa fa-inbox"></i> <span class="nav-label">资产管理</span><span class="fa arrow"></span></a>
|
<a><i class="fa fa-inbox"></i> <span class="nav-label">资产管理</span><span class="fa arrow"></span></a>
|
||||||
<ul class="nav nav-second-level">
|
<ul class="nav nav-second-level">
|
||||||
<li class="group_list group_detail group_edit"><a href="/jasset/group_list/">查看资产组</a></li>
|
<li class="group_list group_detail group_edit"><a href="/jasset/group_list/">查看资产组</a></li>
|
||||||
<li class="asset_list asset_detail asset_edit asset_add"><a href="/jasset/asset_list/">查看资产<span class="label label-info pull-right">{{ host_active_num }}/{{ host_total_num}}</span></a></li>
|
<li class="asset_list asset_detail asset_edit asset_add asset_add_batch"><a href="/jasset/asset_list/">查看资产<span class="label label-info pull-right">{{ host_active_num }}/{{ host_total_num}}</span></a></li>
|
||||||
<li class="idc_list idc_detail idc_edit"><a href="/jasset/idc_list/">查看机房</a></li>
|
<li class="idc_list idc_detail idc_edit"><a href="/jasset/idc_list/">查看机房</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue