Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

从docker换到物理机的php7.3之后,配置相同的情况下,自带的邮件发送失败,quericy_sign_mail插件发送正常 #167

Open
Weltolk opened this issue May 24, 2022 · 9 comments

Comments

@Weltolk
Copy link
Contributor

Weltolk commented May 24, 2022

报错

自带的邮件发送测试邮件时报的错:

邮件发送失败,发件日志:
Trying to ssl://smtp.qq.com:465
Connected to relay host ssl://smtp.qq.com
Error: Remote host returned "502 Invalid input from xxx.xxx.xxx.xxx to newxmesmtplogicsvrszb6.qq.com"
Error: Cannot send email to [ [email protected] ] (Step 2)
Error: Error occurred while sending DATA command

自带的邮件发送的配置:

image

quericy_sign_mail插件的配置:

image

程序的运行环境:

debian 10 + php-fpm7.3 + nginx 1.21.6 + 百度贴吧云签到 V4.97

系统版本:

root@VM-0-7-debian:/var/www/tieba# cat /proc/version 
Linux version 4.19.0-11-amd64 ([email protected]) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.146-1 (2020-09-17)
root@VM-0-7-debian:/var/www/tieba# cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

php-fpm版本:

root@VM-0-7-debian:~# php-fpm7.3 -v
PHP 7.3.33-1+0~20211119.91+debian10~1.gbp618351 (fpm-fcgi) (built: Nov 19 2021 06:39:58)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.33-1+0~20211119.91+debian10~1.gbp618351, Copyright (c) 1999-2018, by Zend Technologies

nginx版本:

root@VM-0-7-debian:~# nginx -V
nginx version: nginx/1.21.6
built by gcc 8.3.0 (Debian 8.3.0-6) 
built with OpenSSL 1.1.1d  10 Sep 2019 (running with OpenSSL 1.1.1n  15 Mar 2022)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.21.6/debian/debuild-base/nginx-1.21.6=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

百度贴吧云签到版本:

百度贴吧云签到 V4.97

程序相关的配置文件:

程序所在的位置:

root@VM-0-7-debian:~# ls -al /var/www/tieba/
total 160
drwxr-xr-x 10 www-data www-data  4096 May 23 17:51 .
drwxr-xr-x  8 root     root      4096 May 23 21:04 ..
-rw-r--r--  1 www-data www-data 11417 May 23 17:46 ajax.php
-rw-r--r--  1 www-data www-data   894 May 23 17:51 config.php
drwxr-xr-x  3 www-data www-data  4096 May 23 17:46 docker
-rw-r--r--  1 www-data www-data  1977 May 23 17:46 do.php
-rw-r--r--  1 www-data www-data 15086 May 23 17:46 favicon.ico
drwxr-xr-x  8 www-data www-data  4096 May 23 17:46 .git
drwxr-xr-x  3 www-data www-data  4096 May 23 17:46 .github
-rw-r--r--  1 www-data www-data    54 May 23 17:46 .gitignore
-rw-r--r--  1 www-data www-data  2908 May 23 17:46 index.php
-rw-r--r--  1 www-data www-data  3382 May 23 17:46 init.php
drwxr-xr-x  2 www-data www-data  4096 May 23 17:46 lib
-rw-r--r--  1 www-data www-data 30839 May 23 17:46 license.html
drwxr-xr-x  8 www-data www-data  4096 May 23 17:47 plugins
-rw-r--r--  1 www-data www-data  4753 May 23 17:46 README.md
-rw-r--r--  1 www-data www-data   236 May 23 17:46 robots.txt
-rw-r--r--  1 www-data www-data 25717 May 23 17:46 setting.php
drwxr-xr-x  2 www-data www-data  4096 May 23 23:22 setup
drwxr-xr-x  6 www-data www-data  4096 May 23 17:46 source
drwxr-xr-x  2 www-data www-data  4096 May 23 17:46 templates

config.php:

签到以及一些其他的功能我测试可以正常使用,config.php应该没问题

root@VM-0-7-debian:~# cat /var/www/tieba/config.php 
<?php 

//特别警告:禁止使用记事本编辑!

////////////////////////////以下选项只需在使用MySQL时填写////////////////////////////
//MySQL 数据库地址,普通主机一般为localhost
define('DB_HOST','127.0.0.7:3306');
//MySQL 数据库用户名
define('DB_USER','root');
//MySQL 数据库密码
define('DB_PASSWD','xxxx');
//MySQL 数据库名称
define('DB_NAME','tiebacloud');

////////////////////////////以下选项使用任何数据库都需填写////////////////////////////
//数据库前缀,建议保持默认
define('DB_PREFIX','tc_');

///////////////////////////////////////其他设置///////////////////////////////////////
//停用CSRF防御
//说明在 http://git.oschina.net/kenvix/Tieba-Cloud-Sign/wikis/关于云签到CSRF防御
define('ANTI_CSRF',true);

//加密用盐,留空为不使用
define('SYSTEM_SALT','');

nginx相关的配置:

location ~ \.php$ {
        root html;
        # fastcgi_pass 127.0.0.1:9000;
        fastcgi_pass unix:/run/php/php8.1-fpm-tieba.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/tieba$fastcgi_script_name;
        include fastcgi_params;
    }

php-fpm相关的配置:

php-fpm用的配置文件的路径:

root@VM-0-7-debian:~# ps -ef|grep php-fpm
root     15234 22961  0 09:34 pts/28   00:00:00 grep php-fpm
root     27222     1  0 08:46 ?        00:00:00 php-fpm: master process (/etc/php/7.3/fpm/php-fpm.conf)

/etc/php/7.3/fpm/php-fpm.conf:

[global]
pid = /run/php/php7.3-fpm.pid
error_log = /var/log/php7.3-fpm.log
include=/etc/php/7.3/fpm/pool.d/*.conf

www.conf:

/etc/php/7.3/fpm/pool.d/www.conf:

[tieba]
user = www-data
group = www-data
listen = /run/php/php7.3-fpm-tieba.sock
listen.owner = nginx
listen.group = nginx
pm = ondemand
pm.max_children = 75
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /var/www

除此之外还配了两个php-fpm,不过都是另外的套接字文件,应该没什么影响

php的相关配置:

php用的配置文件的路径:

root@VM-0-7-debian:~# php -i | grep php.ini
PHP Warning:  Module 'curl' already loaded in Unknown on line 0
Configuration File (php.ini) Path => /etc/php/7.3/cli
Loaded Configuration File => /etc/php/7.3/cli/php.ini

/etc/php/7.3/cli/php.ini:
比较长,就不贴了,是从docker里复制来的配置文件,没有任何修改

相关的日志文件:

/var/log/php7.3-fpm.log:

无相关信息

/var/log/nginx/access.log:

root@VM-0-7-debian:~# cat /var/log/nginx/access.log|tail|grep testmail
111.16.59.6 - - [24/May/2022:09:55:41 +0800] "GET /setting.php?mod=admin:testmail HTTP/1.1" 200 1443 "https://tieba.xxxx.cn/index.php?mod=admin:set" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.53" "-"

/var/log/nginx/error.log:

root@VM-0-7-debian:~# cat /var/log/nginx/error.log|tail
2022/05/24 09:38:44 [notice] 15371#15371: using the "epoll" event method
2022/05/24 09:38:44 [notice] 15371#15371: nginx/1.21.6
2022/05/24 09:38:44 [notice] 15371#15371: built by gcc 8.3.0 (Debian 8.3.0-6) 
2022/05/24 09:38:44 [notice] 15371#15371: OS: Linux 4.19.0-11-amd64
2022/05/24 09:38:44 [notice] 15371#15371: getrlimit(RLIMIT_NOFILE): 1024:524288
2022/05/24 09:38:44 [notice] 15372#15372: start worker processes
2022/05/24 09:38:44 [notice] 15372#15372: start worker process 15373
2022/05/24 09:56:33 [error] 15373#15373: *319 open() "/var/www/tieba/source/fonts/glyphicons-halflings-regular.woff2" failed (2: No such file or directory), client: 000.000.000.000, server: tieba.xxxx.cn, request: "GET /source/fonts/glyphicons-halflings-regular.woff2 HTTP/1.1", host: "tieba.xxxx.cn", referrer: "https://tieba.xxxx.cn/source/css/bootstrap.min.css"
2022/05/24 09:56:34 [error] 15373#15373: *319 open() "/var/www/tieba/source/fonts/glyphicons-halflings-regular.woff2" failed (2: No such file or directory), client: 000.000.000.000, server: tieba.xxxx.cn, request: "GET /source/fonts/glyphicons-halflings-regular.woff2 HTTP/1.1", host: "tieba.xxxx.cn", referrer: "https://tieba.xxxx.cn/source/css/bootstrap.min.css"
2022/05/24 09:58:20 [error] 15373#15373: *337 open() "/var/www/tieba/source/fonts/glyphicons-halflings-regular.woff2" failed (2: No such file or directory), client: 000.000.000.000, server: tieba.xxxx.cn, request: "GET /source/fonts/glyphicons-halflings-regular.woff2 HTTP/1.1", host: "tieba.xxxx.cn", referrer: "https://tieba.xxxx.cn/source/css/bootstrap.min.css"

我对比着https://github.com/MoeNetwork/Tieba-Cloud-Sign/blob/master/docker/Dockerfile这个文件,配置的物理机的环境,唯一不同的就是时区,上述文件的时区是Shanghai,物理机的时区是Hong Kong,但是都是东8区,可能没问题

@n0099
Copy link
Collaborator

n0099 commented May 24, 2022

cc @BANKA2017

@BANKA2017
Copy link
Collaborator

BANKA2017 commented May 24, 2022

cc @BANKA2017

没有qq邮箱,对收发邮件这部分也不熟悉


刚才看成issue讲的是插件问题,不过对这玩意不熟悉是真的

@Weltolk
Copy link
Contributor Author

Weltolk commented May 24, 2022

cc @BANKA2017

没有qq邮箱,对收发邮件这部分也不熟悉

刚才看成issue讲的是插件问题,不过对这玩意不熟悉是真的

我测试了一下,有以下几种情况:
1.同样的设置,quericy_sign_mail插件可以成功发送邮件,Tieba-Cloud-Sign自带的邮件发送失败
2.把Tieba-Cloud-Sign自带的邮件发送的配置换成在自己的vps上搭建的邮件服务器可以正常的发邮件

@kenvix
Copy link
Member

kenvix commented May 24, 2022

换用其他邮件服务商是否仍有问题?怀疑邮件的SSL实现可能有问题

@Rakau
Copy link

Rakau commented May 27, 2022

试试TLS

@Weltolk
Copy link
Contributor Author

Weltolk commented May 27, 2022

试试TLS

谢谢,tls试过了,也会报错失败,但是没有具体的错误信息

@Weltolk
Copy link
Contributor Author

Weltolk commented May 28, 2022

换用其他邮件服务商是否仍有问题?怀疑邮件的SSL实现可能有问题

测试了网易的163邮箱,可以正常发送邮件

@kenvix
Copy link
Member

kenvix commented May 28, 2022

综合考虑,可能是QQ邮箱的风控导致了此问题。

@Weltolk
Copy link
Contributor Author

Weltolk commented May 28, 2022

综合考虑,可能是QQ邮箱的风控导致了此问题。

啊...还有风控的吗?
我是在docker里正常挂了几个月(每天发两封邮件,一直可以正常发送)然后转移到宿主机的,转移的前一天在docker里还能正常发送邮件
而且转移到宿主机后同样的邮箱用quericy_sign_mail插件就可以正常发送,最近几天一直可以正常发送(前几天刚转移到宿主机的时候短时间内连发了四五个测试邮件都没问题)
而且我测试了另一个qq邮箱,也是不能使用项目自带的邮件发送发邮件,但是可以使用quericy_sign_mail插件发邮件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants