Skip to content

Commit

Permalink
登录失败等安全相关 支持配置
Browse files Browse the repository at this point in the history
  • Loading branch information
gaowei committed Feb 1, 2018
1 parent cb3e9c4 commit 47a4f50
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions archer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
MAIL_REVIEW_FROM_ADDR='[email protected]' #发件人,也是登录SMTP server需要提供的用户名
MAIL_REVIEW_FROM_PASSWORD='' #发件人邮箱密码,如果为空则不需要login SMTP server
MAIL_REVIEW_DBA_ADDR=['[email protected]', '[email protected]'] #DBA地址,执行完毕会发邮件给DBA,以list形式保存
MAIL_REVIEW_SECURE_ADDR=['[email protected]', '[email protected]'] #登录失败,等安全相关发送地址
#是否过滤【DROP DATABASE】|【DROP TABLE】|【TRUNCATE PARTITION】|【TRUNCATE TABLE】等高危DDL操作:
#on是开,会首先用正则表达式匹配sqlContent,如果匹配到高危DDL操作,则判断为“自动审核不通过”;off是关,直接将所有的SQL语句提交给inception,对于上述高危DDL操作,只备份元数据
CRITICAL_DDL_ON_OFF='off'
1 change: 1 addition & 0 deletions sql/sendmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(self):
self.MAIL_REVIEW_FROM_ADDR = getattr(settings, 'MAIL_REVIEW_FROM_ADDR')
self.MAIL_REVIEW_FROM_PASSWORD = getattr(settings, 'MAIL_REVIEW_FROM_PASSWORD')
self.MAIL_REVIEW_DBA_ADDR = getattr(settings, 'MAIL_REVIEW_DBA_ADDR')
self.MAIL_REVIEW_SECURE_ADDR = getattr(settings, 'MAIL_REVIEW_SECURE_ADDR')

except AttributeError as a:
print("Error: %s" % a)
Expand Down
2 changes: 1 addition & 1 deletion sql/views_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
def log_mail_record(login_failed_message):
mail_title = 'login inception'
logger.warning(login_failed_message)
mailSender.sendEmail(mail_title, login_failed_message, getattr(settings, 'MAIL_REVIEW_DBA_ADDR'))
mailSender.sendEmail(mail_title, login_failed_message, getattr(settings, 'MAIL_REVIEW_SECURE_ADDR'))

#ajax接口,登录页面调用,用来验证用户名密码
@csrf_exempt
Expand Down

0 comments on commit 47a4f50

Please sign in to comment.