apt update && apt upgrade
,安装最新安全补丁。/etc/sysctl.conf
,增加文件描述符限制(如fs.file-max = 65535
)、优化TCP窗口大小(如net.core.wmem_max = 12582912
),启用BBR算法(net.ipv4.tcp_congestion_control = bbr
)。/etc/postfix/main.cf
中调整message_size_limit
(如设为10MB)、smtpd_recipient_restrictions
(集成SpamAssassin过滤垃圾邮件)。/etc/dovecot/dovecot.conf
中的mail_location
(如使用Maildir格式)和protocols
(仅启用必要协议)。/etc/ssh/sshd_config
中PermitRootLogin no
)。postfix
的smtpd_milters
配置)和ClamAV,设置灰名单(Postgrey)减少垃圾邮件。htop
、vmstat
、iostat
等工具实时监控资源使用,定期清理日志文件(如/var/log/mail.log
)。quota
工具)限制用户存储空间。/tmp
),归档旧日志,更新软件包(apt autoremove
)。/var/mail
)和配置文件,存储至异地或云存储。操作前建议:备份所有配置文件和邮件数据,测试环境验证配置后再应用到生产环境。
参考来源: