Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 534

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/plugins/system/t4/src/t4/MVC/Router/T4.php on line 388
十一、启用Postfix SSL配置 - bluetooth蓝牙技术
Support us and view this ad

可选:点击以支持我们的网站

免费文章

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/components/com_comprofiler/plugin/user/plug_cbjdownloads/cbjdownloads.php on line 49

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/components/com_comprofiler/plugin/user/plug_cbblogs/cbblogs.php on line 48

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/components/com_comprofiler/plugin/user/plug_cbarticles/cbarticles.php on line 47

步骤1:首先检查SSL证书   echo "=== 检查SSL证书 ===" # 1. 检查证书是否存在if [ -f /etc/postfix/ssl/smtpd.cert ] && [ -f /etc/postfix/ssl/smtpd.key ]; thenecho "✅ SSL证书已存在"echo "证书文件:"ls -la /etc/postfix/ssl/echo -e "\n证书信息:"sudo openssl x509 -in /etc/postfix/ssl/smtpd.cert -noout -subject -dateselseecho "⚠️ SSL证书不存在,重新生成..."sudo mkdir -p /etc/postfix/sslsudo openssl req -new -x509 -days 3650 -nodes \-out /etc/postfix/ssl/smtpd.cert \-keyout /etc/postfix/ssl/smtpd.key \-subj "/C=CN/ST=Beijing/L=Beijing/O=Company/CN=localhost" \-addext "subjectAltName = DNS:localhost, IP:127.0.0.1"sudo chmod 600 /etc/postfix/ssl/smtpd.keysudo chmod 644 /etc/postfix/ssl/smtpd.certfi 步骤2:启用SSL配置 #!/bin/bashecho "=== 启用Postfix SSL配置 ===" # 1. 备份当前配置echo "1. 备份当前配置..."sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.backup.before_sslsudo cp /etc/postfix/master.cf /etc/postfix/master.cf.backup.before_ssl # 2. 在main.cf中添加SSL配置echo "2. 添加SSL配置到main.cf..."sudo tee -a /etc/postfix/main.cf << 'EOF' # ========== SSL/TLS 配置 ==========# 启用TLS支持smtpd_use_tls = yessmtpd_tls_security_level = maysmtp_tls_security_level = may # SSL证书路径smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.certsmtpd_tls_key_file = /etc/postfix/ssl/smtpd.key # TLS协议和加密设置smtpd_tls_protocols = !SSLv2, !SSLv3smtpd_tls_ciphers = medium # 启用465端口(SMTPS)smtpd_tls_wrappermode = yessmtpd_tls_received_header = yes # 会话缓存smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scachesmtp_tls_session_cache_database = btree:${data_directory}/smtp_scacheEOF # 3. 在master.cf中启用smtps服务echo "3. 在master.cf中启用smtps服务..."# 首先删除现有的smtps配置(如果有)sudo sed -i '/^smtps/d' /etc/postfix/master.cf # 添加smtps服务配置sudo tee -a /etc/postfix/master.cf << 'EOF' # SMTPS (SSL on port 465)smtps inet n - y - - smtpd-o syslog_name=postfix/smtps-o smtpd_tls_wrappermode=yes-o smtpd_tls_auth_only=yes-o smtpd_client_restrictions=-o smtpd_helo_restrictions=-o smtpd_sender_restrictions=-o smtpd_recipient_restrictions=permit_mynetworks,reject_unauth_destination-o smtpd_relay_restrictions=permit_mynetworks,reject_unauth_destinationEOF # 4. 检查配置语法echo "4. 检查配置语法..."if sudo postfix check; thenecho "✅ 配置文件语法正确"elseecho "❌ 配置文件有错误"sudo postfix checkexit 1fi # 5. 重新加载Postfix配置echo "5. 重新加载Postfix..."sudo postfix reloadsudo systemctl reload postfix # 6. 检查端口监听echo "6. 检查端口监听状态..."sleep 2echo "端口25 (SMTP):"sudo netstat -tlnp | grep :25echo -e "\n端口465 (SMTPS):"sudo netstat -tlnp | grep :465 || echo "端口465未监听" # 7. 测试SSL连接echo "7. 测试SSL连接..."echo "使用openssl测试SSL连接:"timeout 5 openssl s_client -connect localhost:465 -quiet 2>&1 | head -10 || echo "SSL连接测试失败" echo "=== SSL配置完成 ===" 步骤3:测试SSL邮件发送 #!/bin/bashecho "=== 测试SSL邮件功能 ===" # 1. 测试普通邮件(25端口)echo "1. 测试普通SMTP (25端口)..."echo "普通邮件测试 $(date)" | mail -s "普通SMTP测试" root 2>&1if [ $? -eq 0 ]; thenecho "✅ 普通邮件发送成功"elseecho "❌ 普通邮件发送失败"fi # 2. 测试SSL邮件发送(使用mail命令)echo -e "\n2. 测试SSL邮件发送..."# mail命令默认使用25端口,我们需要测试465端口# 创建一个测试脚本cat > /tmp/test_ssl_mail.sh << 'EOF'#!...

继续阅读完整内容

支持我们的网站,请点击查看下方广告

正在加载广告...

FaLang translation system by Faboba

登陆


Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/src/Menu/AbstractMenu.php on line 164

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 217

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 219

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 227

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 231

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 234

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100
mysqli object is already closed (500 Whoops, looks like something went wrong.)

Error

HTTP 500 Whoops, looks like something went wrong.

mysqli object is already closed

Exception

Error

  1. */
  2. public function disconnect()
  3. {
  4. // Close the connection.
  5. if (\is_callable([$this->connection, 'close'])) {
  6. $this->connection->close();
  7. }
  8. parent::disconnect();
  9. }
  1. */
  2. public function disconnect()
  3. {
  4. // Close the connection.
  5. if (\is_callable([$this->connection, 'close'])) {
  6. $this->connection->close();
  7. }
  8. parent::disconnect();
  9. }
  1. *
  2. * @since 2.0.0
  3. */
  4. public function __destruct()
  5. {
  6. $this->disconnect();
  7. }
  8. /**
  9. * Alter database's character set.
  10. *
DatabaseDriver->__destruct()

Stack Trace

Error
Error:
mysqli object is already closed

  at /var/www/html/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:318
  at mysqli->close()
     (/var/www/html/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:318)
  at Joomla\Database\Mysqli\MysqliDriver->disconnect()
     (/var/www/html/libraries/vendor/joomla/database/src/DatabaseDriver.php:496)
  at Joomla\Database\DatabaseDriver->__destruct()                

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100