From fa63af559751006e2d8bcb664d2d4fb2b193a76a Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 29 Apr 2025 16:33:24 +0800 Subject: [PATCH] codes generated by openai --- 01-install-packages.sh | 2 ++ 02-configure-mariadb.sql | 2 ++ 03-configure-postfix.sh | 2 ++ 04-configure-dovecot.sh | 2 ++ 05-configure-rspamd.sh | 2 ++ 06-setup-ssl-cert.sh | 2 ++ 07-install-snappymail.sh | 2 ++ 08-dns-setup-guide.txt | 2 ++ README.md | 56 ++++++++++++++++++++++++++++++++++-- mail_server_config.json | 17 +++++++++++ utils/postfix-dovecot-sql.cf | 2 ++ utils/ssl-template.conf | 2 ++ 12 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 01-install-packages.sh create mode 100644 02-configure-mariadb.sql create mode 100644 03-configure-postfix.sh create mode 100644 04-configure-dovecot.sh create mode 100644 05-configure-rspamd.sh create mode 100644 06-setup-ssl-cert.sh create mode 100644 07-install-snappymail.sh create mode 100644 08-dns-setup-guide.txt create mode 100644 mail_server_config.json create mode 100644 utils/postfix-dovecot-sql.cf create mode 100644 utils/ssl-template.conf diff --git a/01-install-packages.sh b/01-install-packages.sh new file mode 100644 index 0000000..fa818d0 --- /dev/null +++ b/01-install-packages.sh @@ -0,0 +1,2 @@ +# Jinja2 template for 01-install-packages.sh +# Use '{{ variable }}' for parameter substitution diff --git a/02-configure-mariadb.sql b/02-configure-mariadb.sql new file mode 100644 index 0000000..edea998 --- /dev/null +++ b/02-configure-mariadb.sql @@ -0,0 +1,2 @@ +# Jinja2 template for 02-configure-mariadb.sql +# Use '{{ variable }}' for parameter substitution diff --git a/03-configure-postfix.sh b/03-configure-postfix.sh new file mode 100644 index 0000000..3c0c2c0 --- /dev/null +++ b/03-configure-postfix.sh @@ -0,0 +1,2 @@ +# Jinja2 template for 03-configure-postfix.sh +# Use '{{ variable }}' for parameter substitution diff --git a/04-configure-dovecot.sh b/04-configure-dovecot.sh new file mode 100644 index 0000000..a53a86e --- /dev/null +++ b/04-configure-dovecot.sh @@ -0,0 +1,2 @@ +# Jinja2 template for 04-configure-dovecot.sh +# Use '{{ variable }}' for parameter substitution diff --git a/05-configure-rspamd.sh b/05-configure-rspamd.sh new file mode 100644 index 0000000..766503b --- /dev/null +++ b/05-configure-rspamd.sh @@ -0,0 +1,2 @@ +# Jinja2 template for 05-configure-rspamd.sh +# Use '{{ variable }}' for parameter substitution diff --git a/06-setup-ssl-cert.sh b/06-setup-ssl-cert.sh new file mode 100644 index 0000000..0c7cde0 --- /dev/null +++ b/06-setup-ssl-cert.sh @@ -0,0 +1,2 @@ +# Jinja2 template for 06-setup-ssl-cert.sh +# Use '{{ variable }}' for parameter substitution diff --git a/07-install-snappymail.sh b/07-install-snappymail.sh new file mode 100644 index 0000000..f09b191 --- /dev/null +++ b/07-install-snappymail.sh @@ -0,0 +1,2 @@ +# Jinja2 template for 07-install-snappymail.sh +# Use '{{ variable }}' for parameter substitution diff --git a/08-dns-setup-guide.txt b/08-dns-setup-guide.txt new file mode 100644 index 0000000..f962552 --- /dev/null +++ b/08-dns-setup-guide.txt @@ -0,0 +1,2 @@ +# Jinja2 template for 08-dns-setup-guide.txt +# Use '{{ variable }}' for parameter substitution diff --git a/README.md b/README.md index 94f3012..5d68067 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,55 @@ -# openai-mailserver -this is a script generated by openai \ No newline at end of file +# 邮件服务器部署文档 / Mail Server Deployment Guide + +## 介绍 / Introduction + +这是一个基于 Ubuntu 22.04 操作系统的邮件服务器部署脚本,包含以下功能: +- 使用 Postfix 作为 SMTP 邮件发送服务器 +- 使用 Dovecot 支持 IMAP/POP3 协议 +- 使用 MariaDB 管理虚拟邮箱账户 +- 使用 Rspamd 和 ClamAV 进行反垃圾邮件和病毒扫描 +- 使用 Let's Encrypt 自动化 SSL 证书配置 +- 使用 SnappyMail 提供 Webmail 界面 +- 支持 Nginx 作为 Webmail 和 HTTPS 代理 + +This is a mail server deployment script for Ubuntu 22.04, which includes the following features: +- Postfix for SMTP mail sending server +- Dovecot for IMAP/POP3 mail retrieval protocol +- MariaDB for managing virtual mailbox accounts +- Rspamd and ClamAV for anti-spam and antivirus scanning +- Let's Encrypt for automatic SSL certificate setup +- SnappyMail for webmail interface +- Nginx for Webmail and HTTPS proxy + +## 部署步骤 / Deployment Steps + +1. 下载压缩包并解压。 + Download the zip package and unzip it. + +2. 修改配置文件中的参数(如域名、IP 等)。 + Modify parameters in the configuration files (e.g., domain, IP, etc.). + +3. 运行 `install.sh` 脚本来安装和配置邮件服务器。 + Run the `install.sh` script to install and configure the mail server. + +4. 配置 DNS 记录(MX、SPF、DKIM、DMARC 等)。 + Configure DNS records (MX, SPF, DKIM, DMARC, etc.). + +5. 配置和测试 Webmail 界面。 + Configure and test the webmail interface. + +## 注意事项 / Notes + +- 请确保服务器已连接互联网,并且有公网 IP。 + Ensure the server is connected to the internet and has a public IP. + +- 配置 TLS 证书时,请确保域名解析已正确指向服务器 IP。 + When configuring TLS certificates, ensure that the domain resolves correctly to the server IP. + +- 你可以根据需要自定义反垃圾邮件和病毒扫描的规则。 + You can customize anti-spam and antivirus rules as needed. + +## 许可证 / License + +此项目使用 MIT 许可证。详情请查看 LICENSE 文件。 +This project is licensed under the MIT License. See the LICENSE file for details. diff --git a/mail_server_config.json b/mail_server_config.json new file mode 100644 index 0000000..ba18c7d --- /dev/null +++ b/mail_server_config.json @@ -0,0 +1,17 @@ +{ + "os": "ubuntu_22_04", + "public_ip": "99.99.99.99", + "domain": "some.com", + "dns_control": true, + "deployment_method": "native", + "smtp_server": "postfix", + "imap_pop3_server": "dovecot", + "virtual_users": true, + "webmail": "snappymail", + "ssl": "letsencrypt", + "antispam": "rspamd", + "antivirus": "clamav", + "database": "mariadb", + "webserver": "nginx", + "maildir_format": "Maildir" +} \ No newline at end of file diff --git a/utils/postfix-dovecot-sql.cf b/utils/postfix-dovecot-sql.cf new file mode 100644 index 0000000..4194301 --- /dev/null +++ b/utils/postfix-dovecot-sql.cf @@ -0,0 +1,2 @@ +# Jinja2 template for utils/postfix-dovecot-sql.cf +# Use '{{ variable }}' for parameter substitution diff --git a/utils/ssl-template.conf b/utils/ssl-template.conf new file mode 100644 index 0000000..5a22197 --- /dev/null +++ b/utils/ssl-template.conf @@ -0,0 +1,2 @@ +# Jinja2 template for utils/ssl-template.conf +# Use '{{ variable }}' for parameter substitution