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 _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)
|
||||
request.session['visit'] = request.session.get('visit', 1) + 1
|
||||
request.session.set_expiry(300)
|
||||
|
@ -495,6 +496,11 @@ def defend_attack(func):
|
|||
return _deco
|
||||
|
||||
|
||||
def get_mac_address():
|
||||
node = uuid.getnode()
|
||||
mac = uuid.UUID(int=node).hex[-12:]
|
||||
return mac
|
||||
|
||||
|
||||
CRYPTOR = PyCrypt(KEY)
|
||||
logger = set_log(LOG_LEVEL)
|
||||
|
|
|
@ -137,7 +137,7 @@ def gen_ssh_key(username, password='',
|
|||
|
||||
if authorized_keys:
|
||||
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')
|
||||
with open(private_key_file+'.pub') as pub_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())
|
||||
|
||||
|
||||
@require_role('user')
|
||||
@defend_attack
|
||||
def reset_password(request):
|
||||
uuid_r = request.GET.get('uuid', '')
|
||||
timestamp = request.GET.get('timestamp', '')
|
||||
|
|
|
@ -189,7 +189,8 @@
|
|||
<div>
|
||||
<div class="text-left">
|
||||
<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>
|
||||
<tr>
|
||||
<th class="text-center">
|
||||
|
@ -322,6 +323,15 @@
|
|||
});
|
||||
var url = '/jperm/role/push/?id={{ role.id }}&asset_id=' + check_array.join(',');
|
||||
$(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() {
|
||||
sudo_file=$1
|
||||
{% for sudo_name, sudo_cmd in sudo_alias.items %}
|
||||
{% if sudo_name != 'ALL' %}
|
||||
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}
|
||||
else
|
||||
echo "Cmnd_Alias {{ sudo_name }} = {{ sudo_cmd }}" >> ${sudo_file}
|
||||
fi
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<a><i class="fa fa-inbox"></i> <span class="nav-label">资产管理</span><span class="fa arrow"></span></a>
|
||||
<ul class="nav nav-second-level">
|
||||
<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>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue