creditease-sec/insight

注册使用QQ邮箱转发邮件,已正常配置

byr0nchan opened this issue · 1 comments

具体配置如下:


1、部署配置文件修改:

      srcpm/config.py 配置文件:

17 #公司邮箱后缀限制,只能使用公司邮箱注册账号。
18 CORP_MAIL = '@qq.com'
...
...
51 # 平台发邮件账号设置
52 SRCPM_MAIL_SENDER = '安全部 3xxx24xxx@qq.com'
53
54 # 发送邮件的服务器设置,账号密码由系统变量中读取
55 MAIL_SERVER = 'smtp.qq.com'
56 MAIL_PORT = 587
57 MAIL_USE_TLS = True
58 MAIL_USERNAME = os.environ.get(
59 'MAIL_USERNAME') or '3xxx24xxx@qq.com'
60 MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD') or ''
...
...
70 # 平台发邮件账号设置
71 SRCPM_MAIL_SENDER = '安全部 3xxx24xxx@qq.com'
72
73 # 发送邮件的服务器设置,账号密码由系统变量中读取
74 MAIL_SERVER = 'smtp.qq.com'
75 MAIL_PORT = 25
76 MAIL_USE_TLS = False
77 MAIL_USERNAME = os.environ.get(
78 'MAIL_USERNAME') or '3xxx24xxx@qq.com'
79 MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD') or ''

     修改定时周期邮件 mail_sender.py 的配置:

50 #主机名设置
51 SERVER_NAME = 'insight.lxxxxo.com'

...
120 # 平台发邮件账号设置
121 SRCPM_MAIL_SENDER = '安全部 3xxx24xxx@qq.com'
122
123 # 发送邮件的服务器设置,账号密码由系统变量中读取
124 MAIL_SERVER = 'smtp.qq.com'
125 MAIL_PORT = 25
126 MAIL_USE_TLS = False
127 MAIL_USERNAME = os.environ.get(
128 'MAIL_USERNAME') or '3xxx24xxx@qq.com'
129 MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD') or ''

2、QQ邮箱设置:

1)给 【安全部 3xxx24xxx@qq.com】邮箱设置一个邮箱独立密码
image

image
2)开启QQ邮箱转发功能,并生成用于第三方登录的授权码
image

3、启动容器的命令:

docker run -d -p 10.10.10.2:9000:5000 \ ###此处是你的主机IP

--link open_source_mysqldb:db
--name open_source_srcpm
-v $PWD/srcpm:/opt/webapp/srcpm
-e DEV_DATABASE_URL='mysql://vuluser:vulpassword@db/vuldb'
-e SrcPM_CONFIG=development
-e MAIL_PASSWORD='fievppjzjhlebeec' \ ###注意此处是你的QQ邮箱的授权码
daocloud.io/liusheng/vulpm_docker:latest
sh -c 'supervisord -c srcpm/supervisor.conf && supervisorctl -c srcpm/supervisor.conf start all && tail -f srcpm/log/gunicorn.err && tail -f srcpm/log/mail_sender.err'


注:还有一种网上的绕过邮箱验证的方法:
https://note.youdao.com/share/index.html?id=885afcf3ceece652749bc1d9a55f722e&type=note#/

修改配置文件:
[root@insight insight]# vim srcpm/app/auth/views.py

添加 flash(u'srcpm/auth/confirm/{}'.format(token))

image
image

点击这个的时候,激活的链接会直接显示在当前页面上

image

复制粘贴这个链接,到你应用的路径后,访问,这个账号就激活了

直接访问:
http://10.151.138.130:9000/srcpm/auth/confirm/eyJhbGciOiJIUzI1NiIsImV4cCI6MTUyNDIxNjI2MCwiaWF0IjoxNTI0MjEyNjYwfQ.eyJjb25maXJtIjoxN30.Bya7QYZ-bFKC-aYq-SBnoKXJ8Jq4CmnzaW4gw3a4S2M
激活成功。

腾讯企业邮箱怎么设置,总是提示:[2018-05-07 08:14:42 +0000] [30] [INFO] Booting worker with pid: 30
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib64/python2.7/threading.py", line 812, in __bootstrap_inner
self.run()
File "/usr/lib64/python2.7/threading.py", line 765, in run
self.__target(*self.__args, **self.__kwargs)
File "/opt/webapp/srcpm/app/email.py", line 23, in send_async_email
mail.send(msg)
File "/usr/lib/python2.7/site-packages/flask_mail.py", line 491, in send
with self.connect() as connection:
File "/usr/lib/python2.7/site-packages/flask_mail.py", line 144, in enter
self.host = self.configure_host()
File "/usr/lib/python2.7/site-packages/flask_mail.py", line 156, in configure_host
host = smtplib.SMTP_SSL(self.mail.server, self.mail.port)
File "/usr/lib64/python2.7/smtplib.py", line 789, in init
SMTP.init(self, host, port, local_hostname, timeout)
File "/usr/lib64/python2.7/smtplib.py", line 255, in init
(code, msg) = self.connect(host, port)
File "/usr/lib64/python2.7/smtplib.py", line 315, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib64/python2.7/smtplib.py", line 794, in _get_socket
new_socket = socket.create_connection((host, port), timeout)
File "/usr/lib64/python2.7/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known