Repository: Billionmail/BillionMail Branch: dev Commit: 7916aea198d1 Files: 1286 Total size: 34.5 MB Directory structure: gitextract_35lf4k5g/ ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── 00-bug.yaml │ │ ├── 01-enhancement.yaml │ │ ├── 02-documentation.yaml │ │ └── 03-question.yaml │ └── PULL_REQUEST_TEMPLATE.MD ├── .gitignore ├── Dockerfiles/ │ ├── core/ │ │ ├── Dockerfile │ │ ├── core.sh │ │ ├── fail2ban.conf │ │ ├── repositories │ │ ├── restart_fail2ban.sh │ │ ├── stop-supervisor.sh │ │ └── supervisord.conf │ ├── dovecot/ │ │ ├── Dockerfile │ │ ├── debian.sources │ │ ├── dovecot.sh │ │ ├── report-ham.sieve │ │ ├── report-spam.sieve │ │ ├── rotate_log.sh │ │ ├── sa-learn-ham.sh │ │ ├── sa-learn-spam.sh │ │ ├── spam-to-folder.sieve │ │ ├── stop-supervisor.sh │ │ └── supervisord.conf │ ├── postfix/ │ │ ├── Dockerfile │ │ ├── debian.sources │ │ ├── postfix.sh │ │ ├── rotate_log.sh │ │ ├── stop-supervisor.sh │ │ └── supervisord.conf │ └── rspamd/ │ ├── Dockerfile │ ├── debian.sources │ ├── rotate_log.sh │ ├── rspamd.sh │ ├── stop-supervisor.sh │ └── supervisord.conf ├── LICENSE ├── README-ja.md ├── README-tr.md ├── README-zh_CN.md ├── README.md ├── SECURITY.md ├── bm.sh ├── conf/ │ ├── core/ │ │ └── fail2ban_init/ │ │ ├── filter.d/ │ │ │ ├── core-limit-filter.conf │ │ │ └── roundcube-limit-filter.conf │ │ └── jail.d/ │ │ ├── core-accesslimit.conf │ │ └── roundcube-accesslimit.conf │ ├── dovecot/ │ │ ├── conf.d/ │ │ │ ├── 10-auth.conf │ │ │ ├── 10-director.conf │ │ │ ├── 10-logging.conf │ │ │ ├── 10-mail.conf │ │ │ ├── 10-master.conf │ │ │ ├── 10-ssl.conf │ │ │ ├── 10-tcpwrapper.conf │ │ │ ├── 15-lda.conf │ │ │ ├── 15-mailboxes.conf │ │ │ ├── 20-imap.conf │ │ │ ├── 20-lmtp.conf │ │ │ ├── 20-pop3.conf │ │ │ ├── 90-acl.conf │ │ │ ├── 90-plugin.conf │ │ │ ├── 90-quota.conf │ │ │ ├── 90-sieve-extprograms.conf │ │ │ ├── 90-sieve.conf │ │ │ ├── 90-sieve_rspamd.conf │ │ │ ├── auth-checkpassword.conf.ext │ │ │ ├── auth-deny.conf.ext │ │ │ ├── auth-dict.conf.ext │ │ │ ├── auth-ldap.conf.ext │ │ │ ├── auth-master.conf.ext │ │ │ ├── auth-passwdfile.conf.ext │ │ │ ├── auth-sql.conf.ext │ │ │ ├── auth-static.conf.ext │ │ │ └── auth-system.conf.ext │ │ ├── dovecot.conf │ │ └── rsyslog.conf │ ├── php/ │ │ ├── pear.conf │ │ ├── php/ │ │ │ └── conf.d/ │ │ │ ├── docker-fpm.ini │ │ │ ├── docker-php-ext-exif.ini │ │ │ ├── docker-php-ext-gd.ini │ │ │ ├── docker-php-ext-imagick.ini │ │ │ ├── docker-php-ext-intl.ini │ │ │ ├── docker-php-ext-ldap.ini │ │ │ ├── docker-php-ext-opcache.ini │ │ │ ├── docker-php-ext-pdo_mysql.ini │ │ │ ├── docker-php-ext-pdo_pgsql.ini │ │ │ ├── docker-php-ext-pspell.ini │ │ │ ├── docker-php-ext-redis.ini │ │ │ ├── docker-php-ext-sodium.ini │ │ │ ├── docker-php-ext-zip.ini │ │ │ └── roundcube-defaults.ini │ │ ├── php-fpm.conf │ │ ├── php-fpm.conf.default │ │ └── php-fpm.d/ │ │ ├── docker.conf │ │ ├── www.conf │ │ └── www.conf.default │ ├── postfix/ │ │ ├── main.cf │ │ ├── master.cf │ │ └── rsyslog.conf │ ├── redis/ │ │ └── redis-conf.sh │ ├── rspamd/ │ │ ├── local.d/ │ │ │ └── milter_headers.conf │ │ ├── rspamd.conf │ │ └── statistic.conf │ ├── supplier/ │ │ └── template/ │ │ ├── Anthropic/ │ │ │ ├── config.json │ │ │ ├── embedding.json │ │ │ └── models.json │ │ ├── DeepSeek/ │ │ │ ├── config.json │ │ │ ├── embedding.json │ │ │ └── models.json │ │ ├── Gemini/ │ │ │ ├── config.json │ │ │ ├── embedding.json │ │ │ └── models.json │ │ ├── Grok/ │ │ │ ├── config.json │ │ │ ├── embedding.json │ │ │ └── models.json │ │ ├── Kimi/ │ │ │ ├── config.json │ │ │ ├── embedding.json │ │ │ └── models.json │ │ └── OpenAI/ │ │ ├── config.json │ │ ├── embedding.json │ │ └── models.json │ └── webmail/ │ ├── custom.inc.php │ └── mime.types ├── core/ │ ├── .gitattributes │ ├── .gitignore │ ├── Makefile │ ├── README.MD │ ├── api/ │ │ ├── abnormal_recipient/ │ │ │ ├── abnormal_recipient.go │ │ │ └── v1/ │ │ │ └── abnormal_recipient.go │ │ ├── askai/ │ │ │ ├── askai.go │ │ │ └── v1/ │ │ │ ├── chat.go │ │ │ ├── project.go │ │ │ └── supplier.go │ │ ├── batch_mail/ │ │ │ ├── batch_mail.go │ │ │ └── v1/ │ │ │ ├── api_mail.go │ │ │ ├── batch_mail.go │ │ │ ├── task_executor.go │ │ │ └── unsubscribe.go │ │ ├── campaign/ │ │ │ ├── campaign.go │ │ │ └── v1/ │ │ │ └── subscription.go │ │ ├── contact/ │ │ │ ├── contact.go │ │ │ └── v1/ │ │ │ └── contact.go │ │ ├── dockerapi/ │ │ │ ├── dockerapi.go │ │ │ └── v1/ │ │ │ └── dockerapi.go │ │ ├── domains/ │ │ │ ├── domains.go │ │ │ └── v1/ │ │ │ ├── domain_blocklist.go │ │ │ ├── domains.go │ │ │ ├── multi_ip_domain.go │ │ │ └── ssl.go │ │ ├── email_template/ │ │ │ ├── email_template.go │ │ │ └── v1/ │ │ │ └── email_template.go │ │ ├── files/ │ │ │ ├── files.go │ │ │ └── v1/ │ │ │ └── files.go │ │ ├── languages/ │ │ │ ├── languages.go │ │ │ └── v1/ │ │ │ └── languages.go │ │ ├── mail_boxes/ │ │ │ ├── mail_boxes.go │ │ │ └── v1/ │ │ │ └── mailboxes.go │ │ ├── mail_services/ │ │ │ ├── mail_services.go │ │ │ └── v1/ │ │ │ ├── common.go │ │ │ ├── mail_bcc.go │ │ │ ├── mail_forward.go │ │ │ └── postfix_queue.go │ │ ├── operation_log/ │ │ │ ├── operation_log.go │ │ │ └── v1/ │ │ │ └── operation_log.go │ │ ├── overview/ │ │ │ ├── overview.go │ │ │ └── v1/ │ │ │ └── overview.go │ │ ├── rbac/ │ │ │ ├── rbac.go │ │ │ └── v1/ │ │ │ ├── account.go │ │ │ ├── auth.go │ │ │ ├── permission.go │ │ │ └── role.go │ │ ├── relay/ │ │ │ ├── relay.go │ │ │ └── v1/ │ │ │ └── relay.go │ │ ├── settings/ │ │ │ ├── settings.go │ │ │ └── v1/ │ │ │ └── settings.go │ │ ├── subscribe_list/ │ │ │ ├── subscribe_list.go │ │ │ └── v1/ │ │ │ └── subscribe_list.go │ │ └── tags/ │ │ ├── tags.go │ │ └── v1/ │ │ └── tags.go │ ├── cmd/ │ │ └── acme/ │ │ ├── Makefile │ │ └── main.go │ ├── frontend/ │ │ ├── .eslintrc-auto-import.json │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── .prettierrc │ │ ├── README.md │ │ ├── build/ │ │ │ ├── config.ts │ │ │ └── utils.ts │ │ ├── build-for-git.js │ │ ├── eslint.config.mjs │ │ ├── git-pull.js │ │ ├── index.html │ │ ├── package.json │ │ ├── public/ │ │ │ └── static/ │ │ │ └── plugin/ │ │ │ └── monaco/ │ │ │ ├── base/ │ │ │ │ └── worker/ │ │ │ │ └── workerMain.js │ │ │ ├── basic-languages/ │ │ │ │ ├── abap/ │ │ │ │ │ └── abap.js │ │ │ │ ├── apex/ │ │ │ │ │ └── apex.js │ │ │ │ ├── azcli/ │ │ │ │ │ └── azcli.js │ │ │ │ ├── bat/ │ │ │ │ │ └── bat.js │ │ │ │ ├── bicep/ │ │ │ │ │ └── bicep.js │ │ │ │ ├── cameligo/ │ │ │ │ │ └── cameligo.js │ │ │ │ ├── clojure/ │ │ │ │ │ └── clojure.js │ │ │ │ ├── coffee/ │ │ │ │ │ └── coffee.js │ │ │ │ ├── cpp/ │ │ │ │ │ └── cpp.js │ │ │ │ ├── csharp/ │ │ │ │ │ └── csharp.js │ │ │ │ ├── csp/ │ │ │ │ │ └── csp.js │ │ │ │ ├── css/ │ │ │ │ │ └── css.js │ │ │ │ ├── cypher/ │ │ │ │ │ └── cypher.js │ │ │ │ ├── dart/ │ │ │ │ │ └── dart.js │ │ │ │ ├── dockerfile/ │ │ │ │ │ └── dockerfile.js │ │ │ │ ├── ecl/ │ │ │ │ │ └── ecl.js │ │ │ │ ├── elixir/ │ │ │ │ │ └── elixir.js │ │ │ │ ├── flow9/ │ │ │ │ │ └── flow9.js │ │ │ │ ├── freemarker2/ │ │ │ │ │ └── freemarker2.js │ │ │ │ ├── fsharp/ │ │ │ │ │ └── fsharp.js │ │ │ │ ├── go/ │ │ │ │ │ └── go.js │ │ │ │ ├── graphql/ │ │ │ │ │ └── graphql.js │ │ │ │ ├── handlebars/ │ │ │ │ │ └── handlebars.js │ │ │ │ ├── hcl/ │ │ │ │ │ └── hcl.js │ │ │ │ ├── html/ │ │ │ │ │ └── html.js │ │ │ │ ├── ini/ │ │ │ │ │ └── ini.js │ │ │ │ ├── java/ │ │ │ │ │ └── java.js │ │ │ │ ├── javascript/ │ │ │ │ │ └── javascript.js │ │ │ │ ├── julia/ │ │ │ │ │ └── julia.js │ │ │ │ ├── kotlin/ │ │ │ │ │ └── kotlin.js │ │ │ │ ├── less/ │ │ │ │ │ └── less.js │ │ │ │ ├── lexon/ │ │ │ │ │ └── lexon.js │ │ │ │ ├── liquid/ │ │ │ │ │ └── liquid.js │ │ │ │ ├── lua/ │ │ │ │ │ └── lua.js │ │ │ │ ├── m3/ │ │ │ │ │ └── m3.js │ │ │ │ ├── markdown/ │ │ │ │ │ └── markdown.js │ │ │ │ ├── mdx/ │ │ │ │ │ └── mdx.js │ │ │ │ ├── mips/ │ │ │ │ │ └── mips.js │ │ │ │ ├── msdax/ │ │ │ │ │ └── msdax.js │ │ │ │ ├── mysql/ │ │ │ │ │ └── mysql.js │ │ │ │ ├── objective-c/ │ │ │ │ │ └── objective-c.js │ │ │ │ ├── pascal/ │ │ │ │ │ └── pascal.js │ │ │ │ ├── pascaligo/ │ │ │ │ │ └── pascaligo.js │ │ │ │ ├── perl/ │ │ │ │ │ └── perl.js │ │ │ │ ├── pgsql/ │ │ │ │ │ └── pgsql.js │ │ │ │ ├── php/ │ │ │ │ │ └── php.js │ │ │ │ ├── pla/ │ │ │ │ │ └── pla.js │ │ │ │ ├── postiats/ │ │ │ │ │ └── postiats.js │ │ │ │ ├── powerquery/ │ │ │ │ │ └── powerquery.js │ │ │ │ ├── powershell/ │ │ │ │ │ └── powershell.js │ │ │ │ ├── protobuf/ │ │ │ │ │ └── protobuf.js │ │ │ │ ├── pug/ │ │ │ │ │ └── pug.js │ │ │ │ ├── python/ │ │ │ │ │ └── python.js │ │ │ │ ├── qsharp/ │ │ │ │ │ └── qsharp.js │ │ │ │ ├── r/ │ │ │ │ │ └── r.js │ │ │ │ ├── razor/ │ │ │ │ │ └── razor.js │ │ │ │ ├── redis/ │ │ │ │ │ └── redis.js │ │ │ │ ├── redshift/ │ │ │ │ │ └── redshift.js │ │ │ │ ├── restructuredtext/ │ │ │ │ │ └── restructuredtext.js │ │ │ │ ├── ruby/ │ │ │ │ │ └── ruby.js │ │ │ │ ├── rust/ │ │ │ │ │ └── rust.js │ │ │ │ ├── sb/ │ │ │ │ │ └── sb.js │ │ │ │ ├── scala/ │ │ │ │ │ └── scala.js │ │ │ │ ├── scheme/ │ │ │ │ │ └── scheme.js │ │ │ │ ├── scss/ │ │ │ │ │ └── scss.js │ │ │ │ ├── shell/ │ │ │ │ │ └── shell.js │ │ │ │ ├── solidity/ │ │ │ │ │ └── solidity.js │ │ │ │ ├── sophia/ │ │ │ │ │ └── sophia.js │ │ │ │ ├── sparql/ │ │ │ │ │ └── sparql.js │ │ │ │ ├── sql/ │ │ │ │ │ └── sql.js │ │ │ │ ├── st/ │ │ │ │ │ └── st.js │ │ │ │ ├── swift/ │ │ │ │ │ └── swift.js │ │ │ │ ├── systemverilog/ │ │ │ │ │ └── systemverilog.js │ │ │ │ ├── tcl/ │ │ │ │ │ └── tcl.js │ │ │ │ ├── twig/ │ │ │ │ │ └── twig.js │ │ │ │ ├── typescript/ │ │ │ │ │ └── typescript.js │ │ │ │ ├── typespec/ │ │ │ │ │ └── typespec.js │ │ │ │ ├── vb/ │ │ │ │ │ └── vb.js │ │ │ │ ├── wgsl/ │ │ │ │ │ └── wgsl.js │ │ │ │ ├── xml/ │ │ │ │ │ └── xml.js │ │ │ │ └── yaml/ │ │ │ │ └── yaml.js │ │ │ ├── editor/ │ │ │ │ ├── editor.main.css │ │ │ │ └── editor.main.js │ │ │ ├── language/ │ │ │ │ ├── css/ │ │ │ │ │ ├── cssMode.js │ │ │ │ │ └── cssWorker.js │ │ │ │ ├── html/ │ │ │ │ │ ├── htmlMode.js │ │ │ │ │ └── htmlWorker.js │ │ │ │ ├── json/ │ │ │ │ │ ├── jsonMode.js │ │ │ │ │ └── jsonWorker.js │ │ │ │ └── typescript/ │ │ │ │ ├── tsMode.js │ │ │ │ └── tsWorker.js │ │ │ ├── loader.js │ │ │ ├── nls.messages.de.js │ │ │ ├── nls.messages.es.js │ │ │ ├── nls.messages.fr.js │ │ │ ├── nls.messages.it.js │ │ │ ├── nls.messages.ja.js │ │ │ ├── nls.messages.ko.js │ │ │ ├── nls.messages.ru.js │ │ │ ├── nls.messages.zh-cn.js │ │ │ └── nls.messages.zh-tw.js │ │ ├── rsbuild.config.ts │ │ ├── src/ │ │ │ ├── App.vue │ │ │ ├── api/ │ │ │ │ ├── index.ts │ │ │ │ └── modules/ │ │ │ │ ├── api.ts │ │ │ │ ├── contacts/ │ │ │ │ │ ├── group.ts │ │ │ │ │ ├── subscribers.ts │ │ │ │ │ └── suspend.ts │ │ │ │ ├── domain.ts │ │ │ │ ├── mailbox.ts │ │ │ │ ├── market/ │ │ │ │ │ ├── task.ts │ │ │ │ │ └── template.ts │ │ │ │ ├── overview.ts │ │ │ │ ├── public.ts │ │ │ │ ├── settings/ │ │ │ │ │ ├── bcc.ts │ │ │ │ │ ├── common.ts │ │ │ │ │ └── forward.ts │ │ │ │ ├── settings.ts │ │ │ │ ├── smtp.ts │ │ │ │ └── user.ts │ │ │ ├── components/ │ │ │ │ ├── base/ │ │ │ │ │ ├── bt-charts/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-close-btn/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-code/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-editor/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-file-upload/ │ │ │ │ │ │ ├── UploadError.vue │ │ │ │ │ │ ├── UploadProgress.vue │ │ │ │ │ │ ├── UploadPrompt.vue │ │ │ │ │ │ ├── UploadSuccess.vue │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-help/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-logs/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-more/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-preview/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-route-tabs/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-search/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-table-batch/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-table-help/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-table-layout/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-table-password/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-time/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-time-range/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ └── bt-tips/ │ │ │ │ │ └── index.vue │ │ │ │ ├── ui/ │ │ │ │ │ ├── bt-config-provider/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-form/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-modal/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── bt-table-page/ │ │ │ │ │ │ └── index.vue │ │ │ │ │ └── bt-tabs/ │ │ │ │ │ └── index.vue │ │ │ │ └── utils/ │ │ │ │ ├── confirm/ │ │ │ │ │ ├── interface.ts │ │ │ │ │ └── method.tsx │ │ │ │ └── message/ │ │ │ │ ├── animation.scss │ │ │ │ ├── index.module.scss │ │ │ │ ├── index.tsx │ │ │ │ ├── interface.ts │ │ │ │ ├── message-list.tsx │ │ │ │ └── method.ts │ │ │ ├── config/ │ │ │ │ └── loadingBar.ts │ │ │ ├── features/ │ │ │ │ └── EmailEditor/ │ │ │ │ ├── components/ │ │ │ │ │ ├── config/ │ │ │ │ │ │ ├── Button.vue │ │ │ │ │ │ ├── Columns.vue │ │ │ │ │ │ ├── Divider.vue │ │ │ │ │ │ ├── Header.vue │ │ │ │ │ │ ├── Image.vue │ │ │ │ │ │ ├── Link.vue │ │ │ │ │ │ ├── Menu.vue │ │ │ │ │ │ ├── None.vue │ │ │ │ │ │ ├── Text.vue │ │ │ │ │ │ ├── columns/ │ │ │ │ │ │ │ ├── ColumnPropertiesPanel.vue │ │ │ │ │ │ │ ├── ColumnsPanel.vue │ │ │ │ │ │ │ └── RowPropertiesPanel.vue │ │ │ │ │ │ └── menu/ │ │ │ │ │ │ ├── Item.vue │ │ │ │ │ │ └── List.vue │ │ │ │ │ ├── elements/ │ │ │ │ │ │ ├── Button.vue │ │ │ │ │ │ ├── Copyright.vue │ │ │ │ │ │ ├── Divider.vue │ │ │ │ │ │ ├── Header.vue │ │ │ │ │ │ ├── Image.vue │ │ │ │ │ │ ├── Link.vue │ │ │ │ │ │ ├── Menu.vue │ │ │ │ │ │ └── Text.vue │ │ │ │ │ ├── layout/ │ │ │ │ │ │ ├── Canvas.vue │ │ │ │ │ │ ├── Cell.vue │ │ │ │ │ │ ├── Columns.vue │ │ │ │ │ │ ├── Section.vue │ │ │ │ │ │ └── Toolbar.vue │ │ │ │ │ ├── menu/ │ │ │ │ │ │ ├── block.vue │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── shared/ │ │ │ │ │ │ ├── Collapse.vue │ │ │ │ │ │ ├── Editor.vue │ │ │ │ │ │ └── None.vue │ │ │ │ │ ├── sidebar/ │ │ │ │ │ │ ├── ConfigTabs.vue │ │ │ │ │ │ ├── Content.vue │ │ │ │ │ │ └── Page.vue │ │ │ │ │ ├── style/ │ │ │ │ │ │ ├── BaseBorder.vue │ │ │ │ │ │ ├── BaseContainer.vue │ │ │ │ │ │ ├── BaseLabel.vue │ │ │ │ │ │ ├── BaseNumber.vue │ │ │ │ │ │ ├── Border.vue │ │ │ │ │ │ ├── Color.vue │ │ │ │ │ │ ├── ContentText.vue │ │ │ │ │ │ ├── FontSize.vue │ │ │ │ │ │ ├── FontWeight.vue │ │ │ │ │ │ ├── Head.vue │ │ │ │ │ │ ├── Image.vue │ │ │ │ │ │ ├── Layout.vue │ │ │ │ │ │ ├── LetterSpacing.vue │ │ │ │ │ │ ├── Line.vue │ │ │ │ │ │ ├── LineHeight.vue │ │ │ │ │ │ ├── Link.vue │ │ │ │ │ │ ├── MoreOptions.vue │ │ │ │ │ │ ├── Padding.vue │ │ │ │ │ │ ├── Rounded.vue │ │ │ │ │ │ ├── TextAlign.vue │ │ │ │ │ │ ├── Title.vue │ │ │ │ │ │ ├── Width.vue │ │ │ │ │ │ ├── WidthAuto.vue │ │ │ │ │ │ ├── WidthNumber.vue │ │ │ │ │ │ └── useNormalForm.tsx │ │ │ │ │ └── toolbar/ │ │ │ │ │ └── index.vue │ │ │ │ ├── config/ │ │ │ │ │ ├── addData.ts │ │ │ │ │ └── config.ts │ │ │ │ ├── containers/ │ │ │ │ │ ├── Editor.vue │ │ │ │ │ ├── EditorMenu.vue │ │ │ │ │ ├── EditorProvider.vue │ │ │ │ │ └── EditorSidebar.vue │ │ │ │ ├── hooks/ │ │ │ │ │ ├── useConfig.ts │ │ │ │ │ ├── useContext.ts │ │ │ │ │ ├── useHtml.ts │ │ │ │ │ ├── useSetData.ts │ │ │ │ │ ├── useStyle.ts │ │ │ │ │ └── useVersion.ts │ │ │ │ ├── index.vue │ │ │ │ ├── store/ │ │ │ │ │ └── index.ts │ │ │ │ ├── types/ │ │ │ │ │ └── base.ts │ │ │ │ └── utils/ │ │ │ │ └── index.ts │ │ │ ├── hooks/ │ │ │ │ ├── modal/ │ │ │ │ │ ├── interface.ts │ │ │ │ │ └── useModal.tsx │ │ │ │ ├── useCopy.ts │ │ │ │ ├── useDataTable.ts │ │ │ │ ├── useFormModal.ts │ │ │ │ └── useTableData.ts │ │ │ ├── i18n/ │ │ │ │ ├── index.ts │ │ │ │ └── lang/ │ │ │ │ ├── en.json │ │ │ │ ├── ja.json │ │ │ │ └── zh.json │ │ │ ├── index.ts │ │ │ ├── layout/ │ │ │ │ ├── components/ │ │ │ │ │ ├── AppHeader.vue │ │ │ │ │ ├── AppMain.vue │ │ │ │ │ ├── Sidebar.vue │ │ │ │ │ └── index.ts │ │ │ │ └── index.vue │ │ │ ├── router/ │ │ │ │ ├── constant.ts │ │ │ │ ├── index.ts │ │ │ │ ├── modules/ │ │ │ │ │ ├── api.ts │ │ │ │ │ ├── automation.ts │ │ │ │ │ ├── contacts.ts │ │ │ │ │ ├── domain.ts │ │ │ │ │ ├── logs.ts │ │ │ │ │ ├── mailbox.ts │ │ │ │ │ ├── market.ts │ │ │ │ │ ├── overview.ts │ │ │ │ │ ├── settings.ts │ │ │ │ │ ├── smtp.ts │ │ │ │ │ └── template.ts │ │ │ │ └── router.ts │ │ │ ├── store/ │ │ │ │ ├── index.ts │ │ │ │ └── modules/ │ │ │ │ ├── global.ts │ │ │ │ ├── menu.ts │ │ │ │ ├── theme.ts │ │ │ │ └── user.ts │ │ │ ├── styles/ │ │ │ │ ├── index.scss │ │ │ │ ├── naive.scss │ │ │ │ ├── reset.scss │ │ │ │ └── variables.scss │ │ │ ├── types/ │ │ │ │ └── chart.ts │ │ │ ├── utils/ │ │ │ │ ├── base.ts │ │ │ │ ├── data.ts │ │ │ │ ├── index.ts │ │ │ │ ├── is.ts │ │ │ │ ├── storage.ts │ │ │ │ └── time.ts │ │ │ └── views/ │ │ │ ├── api/ │ │ │ │ ├── components/ │ │ │ │ │ ├── ApiForm.vue │ │ │ │ │ ├── ApiKey.vue │ │ │ │ │ ├── ApiTest.vue │ │ │ │ │ └── Overview.vue │ │ │ │ ├── index.vue │ │ │ │ └── types/ │ │ │ │ └── base.ts │ │ │ ├── automation/ │ │ │ │ └── index.vue │ │ │ ├── contacts/ │ │ │ │ ├── group/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── GroupAdd.vue │ │ │ │ │ │ └── GroupRename.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ ├── temp.vue │ │ │ │ │ └── types/ │ │ │ │ │ └── base.ts │ │ │ │ ├── index.vue │ │ │ │ ├── settings/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── Code.vue │ │ │ │ │ │ ├── Editor.vue │ │ │ │ │ │ ├── SubscribeForm.vue │ │ │ │ │ │ ├── SubscribeSettings.vue │ │ │ │ │ │ └── UnsubscribeSettings.vue │ │ │ │ │ ├── hooks/ │ │ │ │ │ │ └── useContext.ts │ │ │ │ │ ├── index.vue │ │ │ │ │ └── types/ │ │ │ │ │ └── base.ts │ │ │ │ ├── subscribers/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── ActiveSelect.vue │ │ │ │ │ │ ├── BatchSetTag.vue │ │ │ │ │ │ ├── GroupMultipleSelect.vue │ │ │ │ │ │ ├── GroupSelect.vue │ │ │ │ │ │ ├── SubscriberEdit.vue │ │ │ │ │ │ ├── SubscriberImport.vue │ │ │ │ │ │ ├── SubscriberTrends.vue │ │ │ │ │ │ └── TagSelect.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ └── interface.ts │ │ │ │ ├── suspend/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── Scan.vue │ │ │ │ │ │ └── ScanLogs.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ └── types/ │ │ │ │ │ └── base.ts │ │ │ │ └── tags/ │ │ │ │ ├── components/ │ │ │ │ │ ├── GroupSelect.vue │ │ │ │ │ ├── TagBulk.vue │ │ │ │ │ ├── TagForm.vue │ │ │ │ │ └── TagSelect.vue │ │ │ │ ├── index.vue │ │ │ │ ├── service/ │ │ │ │ │ └── index.ts │ │ │ │ └── types/ │ │ │ │ └── index.ts │ │ │ ├── domain/ │ │ │ │ ├── components/ │ │ │ │ │ ├── BlacklistDetection.vue │ │ │ │ │ ├── CheckLogs.vue │ │ │ │ │ ├── DomainDns.vue │ │ │ │ │ ├── DomainForm.vue │ │ │ │ │ ├── DomainIpSet.vue │ │ │ │ │ ├── DomainSelect.vue │ │ │ │ │ ├── DomainSsl/ │ │ │ │ │ │ ├── OtherCert.vue │ │ │ │ │ │ └── index.vue │ │ │ │ │ ├── IpStatus.vue │ │ │ │ │ ├── NotSpam.vue │ │ │ │ │ └── WaitAndCheckDomainStatus.vue │ │ │ │ ├── index.vue │ │ │ │ ├── interface.ts │ │ │ │ └── pages/ │ │ │ │ └── editDomain/ │ │ │ │ ├── components/ │ │ │ │ │ ├── AISettings.vue │ │ │ │ │ ├── CompanyProfile.vue │ │ │ │ │ ├── DomainConfiguration.vue │ │ │ │ │ ├── FooterSettings.vue │ │ │ │ │ ├── ProjectDetails.vue │ │ │ │ │ ├── Sitemap.vue │ │ │ │ │ ├── Styling.vue │ │ │ │ │ ├── Typography.vue │ │ │ │ │ └── mixin.scss │ │ │ │ ├── controller/ │ │ │ │ │ ├── aiSettings.controller.ts │ │ │ │ │ ├── companyProfile.controller.ts │ │ │ │ │ ├── domainConfiguration.controller.ts │ │ │ │ │ ├── footerSettings.controller.ts │ │ │ │ │ ├── projectDetail.controller.ts │ │ │ │ │ ├── sitemap.controller.ts │ │ │ │ │ ├── styling.controller.ts │ │ │ │ │ └── typography.controller.ts │ │ │ │ ├── dto/ │ │ │ │ │ └── index.ts │ │ │ │ ├── index.vue │ │ │ │ └── store/ │ │ │ │ └── index.ts │ │ │ ├── login/ │ │ │ │ └── index.vue │ │ │ ├── logs/ │ │ │ │ ├── error/ │ │ │ │ │ ├── controller/ │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── index.vue │ │ │ │ ├── index.vue │ │ │ │ └── operate/ │ │ │ │ ├── controller/ │ │ │ │ │ └── index.ts │ │ │ │ ├── index.vue │ │ │ │ └── types/ │ │ │ │ └── index.ts │ │ │ ├── mailbox/ │ │ │ │ ├── components/ │ │ │ │ │ ├── DomainSelect.vue │ │ │ │ │ ├── MailboxBatchAdd.vue │ │ │ │ │ ├── MailboxExport.vue │ │ │ │ │ ├── MailboxForm.vue │ │ │ │ │ └── MailboxImport.vue │ │ │ │ ├── index.vue │ │ │ │ └── interface.ts │ │ │ ├── market/ │ │ │ │ ├── index.vue │ │ │ │ ├── task/ │ │ │ │ │ ├── analytics.vue │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── CreateGroup.vue │ │ │ │ │ │ ├── FromSelect.vue │ │ │ │ │ │ ├── GroupSelect.vue │ │ │ │ │ │ ├── TagSelect.vue │ │ │ │ │ │ ├── TaskDetail.vue │ │ │ │ │ │ ├── TaskStatus.vue │ │ │ │ │ │ ├── TaskStatusDetails.vue │ │ │ │ │ │ └── TemplateSelect.vue │ │ │ │ │ ├── edit.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ └── interface.ts │ │ │ │ └── template/ │ │ │ │ ├── components/ │ │ │ │ │ ├── TemplateAdd.vue │ │ │ │ │ ├── TemplateForm.vue │ │ │ │ │ └── TemplatePreview.vue │ │ │ │ ├── edit.vue │ │ │ │ ├── index.vue │ │ │ │ └── interface.ts │ │ │ ├── overview/ │ │ │ │ ├── components/ │ │ │ │ │ ├── BarChart.vue │ │ │ │ │ ├── FilterBar.vue │ │ │ │ │ ├── LineChart.vue │ │ │ │ │ ├── MetricCard.vue │ │ │ │ │ ├── ProviderTable.vue │ │ │ │ │ ├── RateChartPanel.vue │ │ │ │ │ ├── SendFailDetails.vue │ │ │ │ │ └── SendTodayStats.vue │ │ │ │ ├── index.vue │ │ │ │ └── types/ │ │ │ │ └── index.ts │ │ │ ├── settings/ │ │ │ │ ├── ai-model/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── AddModel.vue │ │ │ │ │ │ ├── AddProvider.vue │ │ │ │ │ │ └── ModelManager.vue │ │ │ │ │ ├── controller/ │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── dto/ │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── index.vue │ │ │ │ │ └── store/ │ │ │ │ │ └── index,.ts │ │ │ │ ├── bcc/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ └── BccForm.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ └── type/ │ │ │ │ │ └── base.ts │ │ │ │ ├── common/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── ApiSettings.vue │ │ │ │ │ │ ├── Command.vue │ │ │ │ │ │ ├── DomainSettings.vue │ │ │ │ │ │ ├── IpWhitelistSettings.vue │ │ │ │ │ │ ├── NetworkSettings.vue │ │ │ │ │ │ ├── Notify/ │ │ │ │ │ │ │ ├── AlarmSettings.vue │ │ │ │ │ │ │ ├── AutoCheckSettings.vue │ │ │ │ │ │ │ ├── BlacklistSetting.vue │ │ │ │ │ │ │ └── NotifySettings.vue │ │ │ │ │ │ ├── PasswordSettings.vue │ │ │ │ │ │ ├── PasswordStrengthIndicator.vue │ │ │ │ │ │ ├── PortSettings.vue │ │ │ │ │ │ ├── ProxySettings.vue │ │ │ │ │ │ ├── SSLSettings.vue │ │ │ │ │ │ ├── SecurityPathSettings.vue │ │ │ │ │ │ ├── SecuritySettings.vue │ │ │ │ │ │ ├── System/ │ │ │ │ │ │ │ └── RetentionTime.vue │ │ │ │ │ │ ├── SystemSettings.vue │ │ │ │ │ │ ├── TimezoneSettings.vue │ │ │ │ │ │ └── UsernameSettings.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ ├── store/ │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── types/ │ │ │ │ │ └── base.ts │ │ │ │ ├── forward/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ └── ForwardForm.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ └── types/ │ │ │ │ │ └── base.ts │ │ │ │ ├── index.vue │ │ │ │ ├── rspamd/ │ │ │ │ │ └── index.vue │ │ │ │ ├── send-queue/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── param-config.vue │ │ │ │ │ │ └── queue-logs.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ └── types/ │ │ │ │ │ └── index.ts │ │ │ │ └── service/ │ │ │ │ ├── components/ │ │ │ │ │ ├── ServiceConfig.vue │ │ │ │ │ └── SettingsService.vue │ │ │ │ ├── index.vue │ │ │ │ └── types/ │ │ │ │ └── common.ts │ │ │ ├── smtp/ │ │ │ │ ├── components/ │ │ │ │ │ ├── SmtpCard.vue │ │ │ │ │ ├── SmtpDns.vue │ │ │ │ │ ├── SmtpForm.vue │ │ │ │ │ ├── SmtpLoading.vue │ │ │ │ │ └── SmtpStatus.vue │ │ │ │ ├── index.vue │ │ │ │ └── types/ │ │ │ │ └── base.ts │ │ │ ├── template/ │ │ │ │ ├── components/ │ │ │ │ │ ├── CreateTplModal.vue │ │ │ │ │ ├── TemplateAdd.vue │ │ │ │ │ ├── TemplateForm.vue │ │ │ │ │ └── TemplatePreview.vue │ │ │ │ ├── controller/ │ │ │ │ │ └── index.ts │ │ │ │ ├── dto/ │ │ │ │ │ └── index.ts │ │ │ │ ├── edit.vue │ │ │ │ ├── index.vue │ │ │ │ ├── index.vue.bak │ │ │ │ ├── interface.ts │ │ │ │ ├── mixin.scss │ │ │ │ ├── pages/ │ │ │ │ │ └── AITemplate/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ └── MarkdownRender.vue │ │ │ │ │ ├── controller/ │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── dto/ │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── highlight.theme.css │ │ │ │ │ ├── index.vue │ │ │ │ │ └── store/ │ │ │ │ │ └── index.ts │ │ │ │ └── store/ │ │ │ │ └── index.ts │ │ │ └── test/ │ │ │ └── index.vue │ │ ├── tsconfig.json │ │ ├── types/ │ │ │ ├── auto-import.d.ts │ │ │ ├── components.d.ts │ │ │ └── env.d.ts │ │ └── uno.config.ts │ ├── go-build.sh │ ├── go.mod │ ├── go.sum │ ├── hack/ │ │ ├── config.yaml │ │ ├── hack-cli.mk │ │ └── hack.mk │ ├── internal/ │ │ ├── cmd/ │ │ │ └── cmd.go │ │ ├── consts/ │ │ │ ├── consts.go │ │ │ ├── log_type.go │ │ │ └── mail_providers.go │ │ ├── controller/ │ │ │ ├── abnormal_recipient/ │ │ │ │ ├── abnormal_recipient.go │ │ │ │ ├── abnormal_recipient_new.go │ │ │ │ ├── abnormal_recipient_v1_abnormal_switch.go │ │ │ │ ├── abnormal_recipient_v1_add_abnormal_recipient.go │ │ │ │ ├── abnormal_recipient_v1_check_group.go │ │ │ │ ├── abnormal_recipient_v1_clearabnormal_recipient.go │ │ │ │ ├── abnormal_recipient_v1_delete_abnormal_recipient.go │ │ │ │ ├── abnormal_recipient_v1_get_scan_log.go │ │ │ │ ├── abnormal_recipient_v1_list_abnormal_recipient.go │ │ │ │ └── abnormal_recipient_v1_set_abnormal_switch.go │ │ │ ├── askai/ │ │ │ │ ├── askai.go │ │ │ │ ├── askai_new.go │ │ │ │ ├── askai_v1_chat.go │ │ │ │ ├── askai_v1_project.go │ │ │ │ └── askai_v1_supplier.go │ │ │ ├── batch_mail/ │ │ │ │ ├── batch_mail.go │ │ │ │ ├── batch_mail_new.go │ │ │ │ ├── batch_mail_v1_api_mail_batch_send.go │ │ │ │ ├── batch_mail_v1_api_mail_send.go │ │ │ │ ├── batch_mail_v1_api_overview_stats.go │ │ │ │ ├── batch_mail_v1_api_templates_create.go │ │ │ │ ├── batch_mail_v1_api_templates_delete.go │ │ │ │ ├── batch_mail_v1_api_templates_list.go │ │ │ │ ├── batch_mail_v1_api_templates_update.go │ │ │ │ ├── batch_mail_v1_create_task.go │ │ │ │ ├── batch_mail_v1_delete_task.go │ │ │ │ ├── batch_mail_v1_get_task_mail_logs.go │ │ │ │ ├── batch_mail_v1_get_task_send_count.go │ │ │ │ ├── batch_mail_v1_get_user_groups.go │ │ │ │ ├── batch_mail_v1_list_tasks.go │ │ │ │ ├── batch_mail_v1_pause_task.go │ │ │ │ ├── batch_mail_v1_resume_task.go │ │ │ │ ├── batch_mail_v1_send_test_email.go │ │ │ │ ├── batch_mail_v1_task_info.go │ │ │ │ ├── batch_mail_v1_task_mail_provider_stat.go │ │ │ │ ├── batch_mail_v1_task_overview.go │ │ │ │ ├── batch_mail_v1_task_stat_chart.go │ │ │ │ ├── batch_mail_v1_unsubscribe.go │ │ │ │ ├── batch_mail_v1_unsubscribe_new.go │ │ │ │ ├── batch_mail_v1_update_task_info.go │ │ │ │ └── batch_mail_v1_update_task_speed.go │ │ │ ├── campaign/ │ │ │ │ ├── campaign.go │ │ │ │ ├── campaign_new.go │ │ │ │ └── campaign_v1_form.go │ │ │ ├── contact/ │ │ │ │ ├── contact.go │ │ │ │ ├── contact_new.go │ │ │ │ ├── contact_v1_batch_tag_contacts.go │ │ │ │ ├── contact_v1_create_group.go │ │ │ │ ├── contact_v1_delete_contacts.go │ │ │ │ ├── contact_v1_delete_contacts_ndp.go │ │ │ │ ├── contact_v1_delete_group.go │ │ │ │ ├── contact_v1_edit_contacts.go │ │ │ │ ├── contact_v1_edit_contacts_ndp.go │ │ │ │ ├── contact_v1_export_contacts.go │ │ │ │ ├── contact_v1_get_contacts_trend.go │ │ │ │ ├── contact_v1_get_group_contact_count.go │ │ │ │ ├── contact_v1_get_group_info.go │ │ │ │ ├── contact_v1_get_single_group_tag_contact_count.go │ │ │ │ ├── contact_v1_import_contacts.go │ │ │ │ ├── contact_v1_list_contacts.go │ │ │ │ ├── contact_v1_list_contacts_groups.go │ │ │ │ ├── contact_v1_list_contacts_ndp.go │ │ │ │ ├── contact_v1_list_groups.go │ │ │ │ ├── contact_v1_merge_contacts_groups.go │ │ │ │ ├── contact_v1_update_contacts_group.go │ │ │ │ ├── contact_v1_update_group.go │ │ │ │ └── contact_v1_update_group_unsubscribe.go │ │ │ ├── dockerapi/ │ │ │ │ ├── dockerapi.go │ │ │ │ ├── dockerapi_new.go │ │ │ │ ├── dockerapi_v1_container_state.go │ │ │ │ ├── dockerapi_v1_list_container.go │ │ │ │ └── dockerapi_v1_restart_container.go │ │ │ ├── domains/ │ │ │ │ ├── domains.go │ │ │ │ ├── domains_new.go │ │ │ │ ├── domains_v1_add_domain.go │ │ │ │ ├── domains_v1_apply_cert.go │ │ │ │ ├── domains_v1_apply_multi_ip_domain_config.go │ │ │ │ ├── domains_v1_check_blacklist.go │ │ │ │ ├── domains_v1_console_apply_cert.go │ │ │ │ ├── domains_v1_delete_domain.go │ │ │ │ ├── domains_v1_fresh_dns_records.go │ │ │ │ ├── domains_v1_get_blocklist_check_logs.go │ │ │ │ ├── domains_v1_get_cert_list.go │ │ │ │ ├── domains_v1_get_domain.go │ │ │ │ ├── domains_v1_get_domain_all.go │ │ │ │ ├── domains_v1_get_ssl.go │ │ │ │ ├── domains_v1_set_default_domain.go │ │ │ │ ├── domains_v1_set_ssl.go │ │ │ │ ├── domains_v1_test_multi_ip_domain_config.go │ │ │ │ ├── domains_v1_update_domain.go │ │ │ │ └── domains_v1_update_domain_brandinfo.go │ │ │ ├── email_template/ │ │ │ │ ├── email_template.go │ │ │ │ ├── email_template_new.go │ │ │ │ ├── email_template_v1_check_email_content.go │ │ │ │ ├── email_template_v1_copy_template.go │ │ │ │ ├── email_template_v1_create_template.go │ │ │ │ ├── email_template_v1_delete_template.go │ │ │ │ ├── email_template_v1_get_all_templates.go │ │ │ │ ├── email_template_v1_get_template.go │ │ │ │ ├── email_template_v1_list_templates.go │ │ │ │ └── email_template_v1_update_template.go │ │ │ ├── files/ │ │ │ │ ├── files.go │ │ │ │ ├── files_new.go │ │ │ │ ├── files_v1_download_file.go │ │ │ │ └── files_v1_read_file.go │ │ │ ├── languages/ │ │ │ │ ├── languages.go │ │ │ │ ├── languages_new.go │ │ │ │ ├── languages_v1_get_language.go │ │ │ │ └── languages_v1_set_language.go │ │ │ ├── mail_boxes/ │ │ │ │ ├── mail_boxes.go │ │ │ │ ├── mail_boxes_new.go │ │ │ │ ├── mail_boxes_v1_add_mailbox.go │ │ │ │ ├── mail_boxes_v1_batch_add_mailbox.go │ │ │ │ ├── mail_boxes_v1_delete_mailbox.go │ │ │ │ ├── mail_boxes_v1_export_mailbox.go │ │ │ │ ├── mail_boxes_v1_get_all_email.go │ │ │ │ ├── mail_boxes_v1_get_all_mailbox.go │ │ │ │ ├── mail_boxes_v1_get_mailbox.go │ │ │ │ ├── mail_boxes_v1_import_mailbox.go │ │ │ │ └── mail_boxes_v1_update_mailbox.go │ │ │ ├── mail_services/ │ │ │ │ ├── mail_services.go │ │ │ │ ├── mail_services_new.go │ │ │ │ ├── mail_services_v1_add_bcc.go │ │ │ │ ├── mail_services_v1_add_mail_forward.go │ │ │ │ ├── mail_services_v1_delete_all_deferred_queue.go │ │ │ │ ├── mail_services_v1_delete_bcc.go │ │ │ │ ├── mail_services_v1_delete_mail_forward.go │ │ │ │ ├── mail_services_v1_delete_postfix_queue_by_id.go │ │ │ │ ├── mail_services_v1_edit_bcc.go │ │ │ │ ├── mail_services_v1_edit_mail_forward.go │ │ │ │ ├── mail_services_v1_flush_postfix_queue.go │ │ │ │ ├── mail_services_v1_flush_postfix_queue_by_id.go │ │ │ │ ├── mail_services_v1_get_bcc_list.go │ │ │ │ ├── mail_services_v1_get_config_file.go │ │ │ │ ├── mail_services_v1_get_mail_forward_list.go │ │ │ │ ├── mail_services_v1_get_postfix_config.go │ │ │ │ ├── mail_services_v1_get_postfix_queue_info.go │ │ │ │ ├── mail_services_v1_get_postfix_queue_list.go │ │ │ │ ├── mail_services_v1_save_config_file.go │ │ │ │ ├── mail_services_v1_set_all_postfix_config.go │ │ │ │ └── mail_services_v1_set_postfix_config.go │ │ │ ├── middleware/ │ │ │ │ └── ip_whitelist.go │ │ │ ├── operation_log/ │ │ │ │ ├── operation_log.go │ │ │ │ ├── operation_log_new.go │ │ │ │ ├── operation_log_v1_get_latest_output_log.go │ │ │ │ ├── operation_log_v1_get_operation_log.go │ │ │ │ ├── operation_log_v1_get_operation_type.go │ │ │ │ └── operation_log_v1_get_output_log.go │ │ │ ├── overview/ │ │ │ │ ├── overview.go │ │ │ │ ├── overview_new.go │ │ │ │ ├── overview_v1_failed_list.go │ │ │ │ └── overview_v1_overview.go │ │ │ ├── rbac/ │ │ │ │ ├── rbac.go │ │ │ │ ├── rbac_new.go │ │ │ │ ├── rbac_v1_auth.go │ │ │ │ └── rbac_v1_get_validate_code.go │ │ │ ├── relay/ │ │ │ │ ├── relay.go │ │ │ │ ├── relay_new.go │ │ │ │ ├── relay_v1_create_relay_config.go │ │ │ │ ├── relay_v1_delete_relay_config.go │ │ │ │ ├── relay_v1_get_unbound_domains.go │ │ │ │ ├── relay_v1_list_relay_configs.go │ │ │ │ ├── relay_v1_test_smtp_connection.go │ │ │ │ └── relay_v1_update_relay_config.go │ │ │ ├── settings/ │ │ │ │ ├── settings.go │ │ │ │ ├── settings_new.go │ │ │ │ ├── settings_v1_add_ip_whitelist.go │ │ │ │ ├── settings_v1_delete_ip_whitelist.go │ │ │ │ ├── settings_v1_delete_reverse_proxy_domain.go │ │ │ │ ├── settings_v1_get_system_config.go │ │ │ │ ├── settings_v1_get_time_zone_list.go │ │ │ │ ├── settings_v1_get_version.go │ │ │ │ ├── settings_v1_regenerate_api_token.go │ │ │ │ ├── settings_v1_set_api_doc_swagger.go │ │ │ │ ├── settings_v1_set_blacklist_alert.go │ │ │ │ ├── settings_v1_set_blacklist_alert_settings.go │ │ │ │ ├── settings_v1_set_blacklist_auto_scan.go │ │ │ │ ├── settings_v1_set_ip_whitelist.go │ │ │ │ ├── settings_v1_set_reverse_proxy_domain.go │ │ │ │ ├── settings_v1_set_ssl_config.go │ │ │ │ ├── settings_v1_set_system_config.go │ │ │ │ └── settings_v1_set_system_config_key.go │ │ │ ├── subscribe_list/ │ │ │ │ ├── subscribe_list.go │ │ │ │ ├── subscribe_list_new.go │ │ │ │ ├── subscribe_list_v1_subscribe_confirm.go │ │ │ │ └── subscribe_list_v1_subscribe_submit.go │ │ │ └── tags/ │ │ │ ├── tags.go │ │ │ ├── tags_new.go │ │ │ ├── tags_v1_batch_tag_contacts.go │ │ │ ├── tags_v1_tag_all.go │ │ │ ├── tags_v1_tag_create.go │ │ │ ├── tags_v1_tag_delete.go │ │ │ ├── tags_v1_tag_list.go │ │ │ └── tags_v1_tag_update.go │ │ ├── dao/ │ │ │ └── .gitkeep │ │ ├── logic/ │ │ │ └── .gitkeep │ │ ├── model/ │ │ │ ├── .gitkeep │ │ │ ├── blacklist.go │ │ │ ├── do/ │ │ │ │ ├── .gitkeep │ │ │ │ ├── account.go │ │ │ │ ├── permission.go │ │ │ │ └── role.go │ │ │ ├── entity/ │ │ │ │ ├── .gitkeep │ │ │ │ ├── account.go │ │ │ │ ├── account_role.go │ │ │ │ ├── alias.go │ │ │ │ ├── alias_domain.go │ │ │ │ ├── batch_mail.go │ │ │ │ ├── bm_bcc.go │ │ │ │ ├── bm_relay.go │ │ │ │ ├── bm_relay_config.go │ │ │ │ ├── bm_relay_domain_mapping.go │ │ │ │ ├── domain.go │ │ │ │ ├── letsencrypt.go │ │ │ │ ├── mailbox.go │ │ │ │ ├── operation_log.go │ │ │ │ ├── permission.go │ │ │ │ ├── role.go │ │ │ │ ├── role_permission.go │ │ │ │ └── sender_ip_warmup_models.go │ │ │ └── rbac.go │ │ ├── packed/ │ │ │ └── packed.go │ │ └── service/ │ │ ├── .gitkeep │ │ ├── abnormal_recipient/ │ │ │ └── abnormal_recipient.go │ │ ├── acme/ │ │ │ ├── acme.go │ │ │ ├── cli.go │ │ │ ├── cmd.go │ │ │ └── renew.go │ │ ├── askai/ │ │ │ ├── chat.go │ │ │ ├── openai.go │ │ │ ├── project.go │ │ │ ├── prompts.go │ │ │ └── supplier.go │ │ ├── batch_mail/ │ │ │ ├── api_mail_send.go │ │ │ ├── batch_mail.go │ │ │ ├── jwt.go │ │ │ ├── simple_rate_controller.go │ │ │ ├── spintax.go │ │ │ ├── stat_service.go │ │ │ ├── task_executor.go │ │ │ └── template_render.go │ │ ├── collect/ │ │ │ └── collect.go │ │ ├── compress/ │ │ │ ├── gzip.go │ │ │ ├── rar.go │ │ │ └── zip.go │ │ ├── contact/ │ │ │ └── contact.go │ │ ├── contact_activity/ │ │ │ └── contact_activity.go │ │ ├── database_initialization/ │ │ │ ├── batch_mail.go │ │ │ ├── database_initialization.go │ │ │ ├── letsencrypty.go │ │ │ ├── mail_serv.go │ │ │ ├── maillog_stat.go │ │ │ ├── multi_ip_domain.go │ │ │ ├── operation_log.go │ │ │ ├── options.go │ │ │ ├── rbac.go │ │ │ ├── sender_ip_warmup.go │ │ │ ├── smtp_relay.go │ │ │ └── utils.go │ │ ├── dockerapi/ │ │ │ └── dockerapi.go │ │ ├── domains/ │ │ │ ├── baseurl.go │ │ │ ├── blacklist.go │ │ │ ├── dns.go │ │ │ ├── domains.go │ │ │ └── ssl.go │ │ ├── email_template/ │ │ │ └── email_template.go │ │ ├── fail2ban/ │ │ │ └── access_log_detection.go │ │ ├── log_maintenance/ │ │ │ └── core_log.go │ │ ├── mail_boxes/ │ │ │ ├── check_quota_alerts.go │ │ │ ├── init_quota_plugin.go │ │ │ ├── mail_boxes.go │ │ │ └── update_used_space.go │ │ ├── mail_service/ │ │ │ ├── bcc.go │ │ │ ├── certificate.go │ │ │ ├── fix.go │ │ │ └── sending.go │ │ ├── maillog_stat/ │ │ │ ├── aggregate.go │ │ │ ├── encryption.go │ │ │ ├── encryption_test.go │ │ │ ├── maillog_stat.go │ │ │ ├── overview.go │ │ │ ├── tracker.go │ │ │ └── tracker_test.go │ │ ├── middlewares/ │ │ │ ├── HandleApiResponse.go │ │ │ └── rbac.go │ │ ├── multi_ip_domain/ │ │ │ ├── config_manager.go │ │ │ └── multi_ip_domain.go │ │ ├── phpfpm/ │ │ │ └── phpfpm.go │ │ ├── public/ │ │ │ ├── common.go │ │ │ ├── mail_stat_helpers.go │ │ │ ├── operation_log.go │ │ │ ├── options_mgr.go │ │ │ ├── self_signed_cert.go │ │ │ └── validator.go │ │ ├── rbac/ │ │ │ ├── account.go │ │ │ ├── jwt.go │ │ │ ├── permission.go │ │ │ ├── rbac.go │ │ │ ├── role.go │ │ │ ├── service.go │ │ │ ├── validate_code.go │ │ │ └── validate_code_test.go │ │ ├── redis_initialization/ │ │ │ └── redis_initialization.go │ │ ├── relay/ │ │ │ ├── config_sync.go │ │ │ └── smtp_connection_helper.go │ │ ├── rspamd/ │ │ │ └── worker_controller.go │ │ ├── settings/ │ │ │ └── billionmail_hostname.go │ │ ├── timers/ │ │ │ └── timers.go │ │ └── warmup/ │ │ ├── rate_limiter.go │ │ ├── sender_ip_mail_provider.go │ │ ├── sender_ip_warmup.go │ │ ├── warmup_daily_upstairs.go │ │ └── warmup_with_campaigns.go │ ├── languages/ │ │ ├── all/ │ │ │ ├── de.json │ │ │ ├── en.json │ │ │ ├── ja.json │ │ │ ├── tr.json │ │ │ └── zh.json │ │ ├── de/ │ │ │ └── server.json │ │ ├── en/ │ │ │ └── server.json │ │ ├── ja/ │ │ │ └── server.json │ │ ├── settings.json │ │ ├── tr/ │ │ │ └── server.json │ │ └── zh/ │ │ └── server.json │ ├── main.go │ ├── manifest/ │ │ ├── deploy/ │ │ │ └── kustomize/ │ │ │ ├── base/ │ │ │ │ ├── deployment.yaml │ │ │ │ ├── kustomization.yaml │ │ │ │ └── service.yaml │ │ │ └── overlays/ │ │ │ └── develop/ │ │ │ ├── configmap.yaml │ │ │ ├── deployment.yaml │ │ │ └── kustomization.yaml │ │ ├── docker/ │ │ │ ├── Dockerfile │ │ │ └── docker.sh │ │ ├── i18n/ │ │ │ └── .gitkeep │ │ └── protobuf/ │ │ └── .keep-if-necessary │ ├── public/ │ │ ├── dist/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ ├── css/ │ │ │ │ ├── async/ │ │ │ │ │ ├── 1095.b0c2adf5.css │ │ │ │ │ ├── 1565.8f8d53c0.css │ │ │ │ │ ├── 2103.5843b2d6.css │ │ │ │ │ ├── 2364.b852af68.css │ │ │ │ │ ├── 2559.0376b199.css │ │ │ │ │ ├── 3324.7fea3ced.css │ │ │ │ │ ├── 3535.3a6dc340.css │ │ │ │ │ ├── 3635.fafa0516.css │ │ │ │ │ ├── 3643.895949a5.css │ │ │ │ │ ├── 3800.8611c02d.css │ │ │ │ │ ├── 4602.3a6dc340.css │ │ │ │ │ ├── 4904.e7c58895.css │ │ │ │ │ ├── 5410.bfbdc7d0.css │ │ │ │ │ ├── 5779.4e44ff7b.css │ │ │ │ │ ├── 5854.8fdd9416.css │ │ │ │ │ ├── 6463.e30f898f.css │ │ │ │ │ ├── 6969.3a6dc340.css │ │ │ │ │ ├── 7704.98be8394.css │ │ │ │ │ ├── 7907.62c62088.css │ │ │ │ │ ├── 7981.58f07aaf.css │ │ │ │ │ ├── 8013.f0e0f9ae.css │ │ │ │ │ ├── 8441.114b87b8.css │ │ │ │ │ ├── 85.2d8f30c3.css │ │ │ │ │ ├── 8749.468a6685.css │ │ │ │ │ ├── 8813.174c369e.css │ │ │ │ │ ├── 8838.1a1519ba.css │ │ │ │ │ ├── 9207.db2f1c3e.css │ │ │ │ │ ├── 9234.ccfe1ed4.css │ │ │ │ │ ├── 9252.4733345f.css │ │ │ │ │ ├── 9380.c59177f7.css │ │ │ │ │ ├── 9468.3a6dc340.css │ │ │ │ │ ├── 9673.0376b199.css │ │ │ │ │ ├── 9767.02f21d25.css │ │ │ │ │ └── 9926.fd2f892d.css │ │ │ │ └── index.bf8a188f.css │ │ │ ├── js/ │ │ │ │ ├── 7445.eedfb53a.js │ │ │ │ ├── 7445.eedfb53a.js.LICENSE.txt │ │ │ │ ├── async/ │ │ │ │ │ ├── 1069.4c61d773.js │ │ │ │ │ ├── 1095.4072569d.js │ │ │ │ │ ├── 1565.1299bf75.js │ │ │ │ │ ├── 1799.82bcc179.js │ │ │ │ │ ├── 2017.ed71b520.js │ │ │ │ │ ├── 2103.f9529831.js │ │ │ │ │ ├── 2137.31d4654f.js │ │ │ │ │ ├── 2364.90458e25.js │ │ │ │ │ ├── 243.cc15c5a2.js │ │ │ │ │ ├── 2559.56abb865.js │ │ │ │ │ ├── 2564.1229e8c7.js │ │ │ │ │ ├── 2823.47af3d18.js │ │ │ │ │ ├── 2880.9a653202.js │ │ │ │ │ ├── 2890.69346f76.js │ │ │ │ │ ├── 3126.4f62a4e3.js │ │ │ │ │ ├── 3221.496ab585.js │ │ │ │ │ ├── 3324.fd04b5cf.js │ │ │ │ │ ├── 3354.af31be73.js │ │ │ │ │ ├── 3444.11a922bb.js │ │ │ │ │ ├── 3535.b0ca7292.js │ │ │ │ │ ├── 3606.c5bd7813.js │ │ │ │ │ ├── 3635.93c2a49b.js │ │ │ │ │ ├── 3643.85a80c4b.js │ │ │ │ │ ├── 3697.9e630381.js │ │ │ │ │ ├── 3697.9e630381.js.LICENSE.txt │ │ │ │ │ ├── 37.d902cb7a.js │ │ │ │ │ ├── 3800.4a4d937c.js │ │ │ │ │ ├── 424.a8b4d687.js │ │ │ │ │ ├── 424.a8b4d687.js.LICENSE.txt │ │ │ │ │ ├── 4317.78a8cfe0.js │ │ │ │ │ ├── 4485.54eed143.js │ │ │ │ │ ├── 4528.13437601.js │ │ │ │ │ ├── 4602.42684ca4.js │ │ │ │ │ ├── 4636.a6e49596.js │ │ │ │ │ ├── 4904.46e3c77d.js │ │ │ │ │ ├── 5293.1b74ca02.js │ │ │ │ │ ├── 5410.7031af32.js │ │ │ │ │ ├── 5461.31057e0f.js │ │ │ │ │ ├── 5498.56da57d8.js │ │ │ │ │ ├── 5529.b849ba4d.js │ │ │ │ │ ├── 5530.ddd3c262.js │ │ │ │ │ ├── 5701.0a022844.js │ │ │ │ │ ├── 5757.1953a93d.js │ │ │ │ │ ├── 5779.23b65101.js │ │ │ │ │ ├── 579.f4df1ad3.js │ │ │ │ │ ├── 5854.90a82cfb.js │ │ │ │ │ ├── 5867.127e2faf.js │ │ │ │ │ ├── 6061.0e2ac705.js │ │ │ │ │ ├── 6194.9d546878.js │ │ │ │ │ ├── 6366.11e68ac4.js │ │ │ │ │ ├── 6463.9ef25a0c.js │ │ │ │ │ ├── 6646.81304560.js │ │ │ │ │ ├── 6803.12301c63.js │ │ │ │ │ ├── 69.07f369ca.js │ │ │ │ │ ├── 6969.10c6c9cf.js │ │ │ │ │ ├── 7222.4834acb2.js │ │ │ │ │ ├── 7235.c4aee453.js │ │ │ │ │ ├── 7303.1f99ded4.js │ │ │ │ │ ├── 7331.d476ee5b.js │ │ │ │ │ ├── 7704.651d709f.js │ │ │ │ │ ├── 7718.1e6ed6c1.js │ │ │ │ │ ├── 7907.f2482293.js │ │ │ │ │ ├── 7981.51ac0ce2.js │ │ │ │ │ ├── 8013.4cc8e47f.js │ │ │ │ │ ├── 8072.b1d94d7d.js │ │ │ │ │ ├── 8072.b1d94d7d.js.LICENSE.txt │ │ │ │ │ ├── 8128.36b52987.js │ │ │ │ │ ├── 8324.54f4183a.js │ │ │ │ │ ├── 8396.b4461a1b.js │ │ │ │ │ ├── 8441.d03d41cd.js │ │ │ │ │ ├── 85.b5140808.js │ │ │ │ │ ├── 8559.9eb2b019.js │ │ │ │ │ ├── 8634.1021226f.js │ │ │ │ │ ├── 8749.38674ba6.js │ │ │ │ │ ├── 8813.ba11c92d.js │ │ │ │ │ ├── 8838.f2be7192.js │ │ │ │ │ ├── 8943.81a21695.js │ │ │ │ │ ├── 8953.7c602bac.js │ │ │ │ │ ├── 9207.2c09dce2.js │ │ │ │ │ ├── 9234.3eaec856.js │ │ │ │ │ ├── 9252.33108600.js │ │ │ │ │ ├── 9372.19031b29.js │ │ │ │ │ ├── 9380.2af01083.js │ │ │ │ │ ├── 9468.bae2140e.js │ │ │ │ │ ├── 9602.03559ada.js │ │ │ │ │ ├── 9673.f8b256f7.js │ │ │ │ │ ├── 9767.613d0426.js │ │ │ │ │ ├── 9780.7a1639df.js │ │ │ │ │ ├── 9812.a87bb1d1.js │ │ │ │ │ └── 9926.7c24cd6e.js │ │ │ │ ├── index.bc6e5fe9.js │ │ │ │ ├── lib-axios.a492ca1d.js │ │ │ │ ├── lib-router.1d9495fc.js │ │ │ │ ├── lib-router.1d9495fc.js.LICENSE.txt │ │ │ │ ├── lib-vue.1514baec.js │ │ │ │ └── lib-vue.1514baec.js.LICENSE.txt │ │ │ └── plugin/ │ │ │ └── monaco/ │ │ │ ├── base/ │ │ │ │ └── worker/ │ │ │ │ └── workerMain.js │ │ │ ├── basic-languages/ │ │ │ │ ├── abap/ │ │ │ │ │ └── abap.js │ │ │ │ ├── apex/ │ │ │ │ │ └── apex.js │ │ │ │ ├── azcli/ │ │ │ │ │ └── azcli.js │ │ │ │ ├── bat/ │ │ │ │ │ └── bat.js │ │ │ │ ├── bicep/ │ │ │ │ │ └── bicep.js │ │ │ │ ├── cameligo/ │ │ │ │ │ └── cameligo.js │ │ │ │ ├── clojure/ │ │ │ │ │ └── clojure.js │ │ │ │ ├── coffee/ │ │ │ │ │ └── coffee.js │ │ │ │ ├── cpp/ │ │ │ │ │ └── cpp.js │ │ │ │ ├── csharp/ │ │ │ │ │ └── csharp.js │ │ │ │ ├── csp/ │ │ │ │ │ └── csp.js │ │ │ │ ├── css/ │ │ │ │ │ └── css.js │ │ │ │ ├── cypher/ │ │ │ │ │ └── cypher.js │ │ │ │ ├── dart/ │ │ │ │ │ └── dart.js │ │ │ │ ├── dockerfile/ │ │ │ │ │ └── dockerfile.js │ │ │ │ ├── ecl/ │ │ │ │ │ └── ecl.js │ │ │ │ ├── elixir/ │ │ │ │ │ └── elixir.js │ │ │ │ ├── flow9/ │ │ │ │ │ └── flow9.js │ │ │ │ ├── freemarker2/ │ │ │ │ │ └── freemarker2.js │ │ │ │ ├── fsharp/ │ │ │ │ │ └── fsharp.js │ │ │ │ ├── go/ │ │ │ │ │ └── go.js │ │ │ │ ├── graphql/ │ │ │ │ │ └── graphql.js │ │ │ │ ├── handlebars/ │ │ │ │ │ └── handlebars.js │ │ │ │ ├── hcl/ │ │ │ │ │ └── hcl.js │ │ │ │ ├── html/ │ │ │ │ │ └── html.js │ │ │ │ ├── ini/ │ │ │ │ │ └── ini.js │ │ │ │ ├── java/ │ │ │ │ │ └── java.js │ │ │ │ ├── javascript/ │ │ │ │ │ └── javascript.js │ │ │ │ ├── julia/ │ │ │ │ │ └── julia.js │ │ │ │ ├── kotlin/ │ │ │ │ │ └── kotlin.js │ │ │ │ ├── less/ │ │ │ │ │ └── less.js │ │ │ │ ├── lexon/ │ │ │ │ │ └── lexon.js │ │ │ │ ├── liquid/ │ │ │ │ │ └── liquid.js │ │ │ │ ├── lua/ │ │ │ │ │ └── lua.js │ │ │ │ ├── m3/ │ │ │ │ │ └── m3.js │ │ │ │ ├── markdown/ │ │ │ │ │ └── markdown.js │ │ │ │ ├── mdx/ │ │ │ │ │ └── mdx.js │ │ │ │ ├── mips/ │ │ │ │ │ └── mips.js │ │ │ │ ├── msdax/ │ │ │ │ │ └── msdax.js │ │ │ │ ├── mysql/ │ │ │ │ │ └── mysql.js │ │ │ │ ├── objective-c/ │ │ │ │ │ └── objective-c.js │ │ │ │ ├── pascal/ │ │ │ │ │ └── pascal.js │ │ │ │ ├── pascaligo/ │ │ │ │ │ └── pascaligo.js │ │ │ │ ├── perl/ │ │ │ │ │ └── perl.js │ │ │ │ ├── pgsql/ │ │ │ │ │ └── pgsql.js │ │ │ │ ├── php/ │ │ │ │ │ └── php.js │ │ │ │ ├── pla/ │ │ │ │ │ └── pla.js │ │ │ │ ├── postiats/ │ │ │ │ │ └── postiats.js │ │ │ │ ├── powerquery/ │ │ │ │ │ └── powerquery.js │ │ │ │ ├── powershell/ │ │ │ │ │ └── powershell.js │ │ │ │ ├── protobuf/ │ │ │ │ │ └── protobuf.js │ │ │ │ ├── pug/ │ │ │ │ │ └── pug.js │ │ │ │ ├── python/ │ │ │ │ │ └── python.js │ │ │ │ ├── qsharp/ │ │ │ │ │ └── qsharp.js │ │ │ │ ├── r/ │ │ │ │ │ └── r.js │ │ │ │ ├── razor/ │ │ │ │ │ └── razor.js │ │ │ │ ├── redis/ │ │ │ │ │ └── redis.js │ │ │ │ ├── redshift/ │ │ │ │ │ └── redshift.js │ │ │ │ ├── restructuredtext/ │ │ │ │ │ └── restructuredtext.js │ │ │ │ ├── ruby/ │ │ │ │ │ └── ruby.js │ │ │ │ ├── rust/ │ │ │ │ │ └── rust.js │ │ │ │ ├── sb/ │ │ │ │ │ └── sb.js │ │ │ │ ├── scala/ │ │ │ │ │ └── scala.js │ │ │ │ ├── scheme/ │ │ │ │ │ └── scheme.js │ │ │ │ ├── scss/ │ │ │ │ │ └── scss.js │ │ │ │ ├── shell/ │ │ │ │ │ └── shell.js │ │ │ │ ├── solidity/ │ │ │ │ │ └── solidity.js │ │ │ │ ├── sophia/ │ │ │ │ │ └── sophia.js │ │ │ │ ├── sparql/ │ │ │ │ │ └── sparql.js │ │ │ │ ├── sql/ │ │ │ │ │ └── sql.js │ │ │ │ ├── st/ │ │ │ │ │ └── st.js │ │ │ │ ├── swift/ │ │ │ │ │ └── swift.js │ │ │ │ ├── systemverilog/ │ │ │ │ │ └── systemverilog.js │ │ │ │ ├── tcl/ │ │ │ │ │ └── tcl.js │ │ │ │ ├── twig/ │ │ │ │ │ └── twig.js │ │ │ │ ├── typescript/ │ │ │ │ │ └── typescript.js │ │ │ │ ├── typespec/ │ │ │ │ │ └── typespec.js │ │ │ │ ├── vb/ │ │ │ │ │ └── vb.js │ │ │ │ ├── wgsl/ │ │ │ │ │ └── wgsl.js │ │ │ │ ├── xml/ │ │ │ │ │ └── xml.js │ │ │ │ └── yaml/ │ │ │ │ └── yaml.js │ │ │ ├── editor/ │ │ │ │ ├── editor.main.css │ │ │ │ └── editor.main.js │ │ │ ├── language/ │ │ │ │ ├── css/ │ │ │ │ │ ├── cssMode.js │ │ │ │ │ └── cssWorker.js │ │ │ │ ├── html/ │ │ │ │ │ ├── htmlMode.js │ │ │ │ │ └── htmlWorker.js │ │ │ │ ├── json/ │ │ │ │ │ ├── jsonMode.js │ │ │ │ │ └── jsonWorker.js │ │ │ │ └── typescript/ │ │ │ │ ├── tsMode.js │ │ │ │ └── tsWorker.js │ │ │ ├── loader.js │ │ │ ├── nls.messages.de.js │ │ │ ├── nls.messages.es.js │ │ │ ├── nls.messages.fr.js │ │ │ ├── nls.messages.it.js │ │ │ ├── nls.messages.ja.js │ │ │ ├── nls.messages.ko.js │ │ │ ├── nls.messages.ru.js │ │ │ ├── nls.messages.zh-cn.js │ │ │ └── nls.messages.zh-tw.js │ │ └── html/ │ │ ├── .gitkeep │ │ ├── already_subscribed.html │ │ ├── subscribe_confirm.html │ │ ├── subscribe_form.html │ │ ├── subscribe_success.html │ │ ├── unsubscribe.html │ │ ├── unsubscribe_new.html │ │ └── unsubscribe_success.html │ ├── resource/ │ │ ├── public/ │ │ │ ├── html/ │ │ │ │ └── .gitkeep │ │ │ ├── plugin/ │ │ │ │ └── .gitkeep │ │ │ └── resource/ │ │ │ ├── css/ │ │ │ │ └── .gitkeep │ │ │ ├── image/ │ │ │ │ └── .gitkeep │ │ │ └── js/ │ │ │ └── .gitkeep │ │ └── template/ │ │ └── .gitkeep │ ├── run_dev.go │ ├── run_dev.sh │ ├── template/ │ │ ├── .gitkeep │ │ ├── default_confirm_email/ │ │ │ ├── confirm_email.html │ │ │ └── confirm_email.txt │ │ ├── default_unsubscribe_email/ │ │ │ ├── unsubscribe_email.html │ │ │ └── unsubscribe_email.txt │ │ ├── default_welcome_email/ │ │ │ ├── welcome_email.html │ │ │ └── welcome_email.txt │ │ ├── subscribe_form_code.html │ │ ├── subscription_form.html │ │ └── subscription_success.html │ └── utility/ │ ├── .gitkeep │ └── types/ │ └── api_v1/ │ └── common.go ├── data/ │ ├── example_recipients.csv │ └── example_recipients.txt ├── docker-compose.yml ├── env_init ├── init.sql ├── install.sh ├── ssl-self-signed/ │ └── dh.pem └── update.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ conf/* merge=ours Dockerfiles/* merge=ours ssl-self-signed/* merge=ours docker-compose.yml merge=ours ================================================ FILE: .github/ISSUE_TEMPLATE/00-bug.yaml ================================================ # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#creating-issue-forms # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema name: Bugs description: Report a bug to help us improve title: "Bug title" labels: - bug body: - type: markdown attributes: value: | Thanks for helping us improve! 🙏 Please answer these questions and provide as much information as possible about your problem. # 1. Environment Information (Structured) - type: dropdown id: os attributes: label: Operating System description: Select or specify the exact distribution options: - Windows - macOS - Linux - Other validations: required: true - type: input id: os_version attributes: label: OS Version placeholder: e.g., "Ubuntu 22.04 LTS" or "Windows 11 23H2" validations: required: true - type: dropdown id: arch attributes: label: System Architecture options: - x86_64 - ARM64 - Other validations: required: true # 2. Docker Environment - type: input id: docker_version attributes: label: Docker Version placeholder: Output of `docker --version` validations: required: true - type: input id: compose_version attributes: label: Docker Compose Version placeholder: Output of `docker-compose --version` validations: required: false - type: dropdown id: reproduce_latest attributes: label: Reproducible in Latest Version? options: - "Yes, occurs in the latest stable release" - "No, only in older versions (specify version)" validations: required: true # 3. Core Bug Description (Required) - type: textarea id: steps attributes: label: Reproduction Steps description: Clear sequence to trigger the bug (commands/operations) placeholder: | 1. Run `docker-compose up -d` 2. Access http://localhost:8080 3. ... validations: required: true - type: textarea id: observed attributes: label: Observed Behavior description: Error logs, screenshots, or unexpected behavior placeholder: | - Container logs show `ERROR: Permission denied` - Service returns 500 error with headers... validations: required: true - type: textarea id: expected attributes: label: Expected Behavior description: Correct behavior or suggested fix placeholder: "Service should return 200 status with JSON output" validations: required: true # 4. Additional Context (Optional) - type: textarea id: additional attributes: label: Supplemental Information placeholder: Relevant config snippets, stack traces, etc. render: markdown validations: required: false ================================================ FILE: .github/ISSUE_TEMPLATE/01-enhancement.yaml ================================================ # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#creating-issue-forms # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema name: Enhancement description: Suggest an idea for this project title: "A good idea" labels: - Enhancement body: - type: markdown attributes: value: | Thanks for helping us improve! 🙏 Please answer these questions and provide as much information as possible about your problem. - type: dropdown id: is-problem attributes: label: Is your feature request related to a problem? options: - Option Yes - Option No validations: required: true - type: textarea id: description-solution attributes: label: "Describe the solution you'd like" validations: required: true - type: textarea id: description-considered attributes: label: "Describe alternatives you've considered" validations: required: true - type: textarea id: additional attributes: label: "Additional" validations: required: false ================================================ FILE: .github/ISSUE_TEMPLATE/02-documentation.yaml ================================================ # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#creating-issue-forms # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema name: Documentation description: Suggest improvements or additions to our documentation title: "A good idea" labels: - documentation body: - type: markdown attributes: value: | Thanks for helping us improve! 🙏 Please answer these questions and provide as much information as possible about your problem. - type: textarea id: description attributes: label: "Description" description: "Please describe your idea in detail." validations: required: true - type: textarea id: additional attributes: label: "Additional" validations: required: false ================================================ FILE: .github/ISSUE_TEMPLATE/03-question.yaml ================================================ # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#creating-issue-forms # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema name: Questions description: I want to ask a question title: "Question title" labels: - question body: - type: markdown attributes: value: | Please read the document carefully. - type: textarea id: ask attributes: label: "What do you want to ask?" description: "Please describe the details of your questions." validations: required: true ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.MD ================================================ # BillionMail Pull Request Template ## PR Title Format `(): ` **Examples**: - `fix(smtp): handle connection timeout during bulk send` - `feat(campaign-ui): add A/B testing template selector` ### Type Guidelines ``` fix : Bug fixes (e.g., `fix(auth): prevent login loop`) feat : New features (e.g., `feat(analytics): add real-time dashboard`) build : Build system changes (Docker/dependencies) ci : CI/CD workflows (GitHub Actions) docs : Documentation updates style : Code formatting (non-functional changes) refactor : Code restructuring (no functionality change) perf : Performance improvements test : Test-related changes chore : Maintenance/tooling changes ``` **Rules**: - **Scope**: Specify module (e.g., `smtp`) or layer (e.g., `frontend`) - **Description**: - Use **present tense verbs** (e.g., `add` not `added`) - No ending punctuation, max 76 chars --- ## Linked Issues Add one of these at the PR description's start: - `Fixes #1234` → Complete resolution - `Updates #1234` → Partial fix/related update --- ## Branch Management ### Frontend Specific - **Target Branch**: `dev-frontend` (All frontend PRs must use this) - **Naming Convention**: ```bash # Feature development feat/[description] # e.g., feat/ab-test-ui # Bug fixes fix/[issue-id]-[desc] # e.g., fix/4567-template-render ``` ### Backend/Core - **Target Branch**: `main` - **Naming Convention**: ```bash # Mail engine smtp/[feature] # e.g., smtp/rate-limit # Infrastructure infra/[change] # e.g., infra/redis-cluster ``` --- ## PR Description Template ```markdown ### Purpose ### Implementation ### Testing - [ ] Unit tests passed (`npm test`/`go test`) - [ ] Manual steps: ~~~bash # Example: Test bulk send bm send --campaign test --list 1000 ~~~ - [ ] Impact analysis (e.g., template compatibility/sending rate) ### Additional Context ``` --- ## Automation Integration 1. **Commit Validation**: Use `husky` + `commitlint` to enforce conventions: ```javascript // commitlint.config.js module.exports = { extends: ['@commitlint/config-conventional'] }; ``` 2. **PR Title Check**: Add GitHub Action to validate PR titles: ```yaml # .github/workflows/pr-check.yml uses: amannn/action-semantic-pull-request@v5 ``` > **Tip**: For mail-sending logic changes, verify SPF/DKIM signing ``` ### Key Features - **Frontend Isolation**: Explicit `dev-frontend` branch for frontend changes - **Modular Scopes**: Clear module boundaries (e.g., `smtp`, `analytics`) for automated changelogs - **Compliance Ready**: GDPR/SPF checks emphasized for critical components This template can be saved to `.github/PULL_REQUEST_TEMPLATE.md` for automatic application. ================================================ FILE: .gitignore ================================================ # IntelliJ project files *.iml .idea/ idea/* .vscode/* .cursor/ test/* config/* temp/ ssl/* bm .env billionmail.conf DBPASS_file.pl logs/ backup/ vmail-data/ postfix-data/ rspamd-data/ postgresql-data/ postgresql-socket/ redis-data/ php-sock/ webmail-data/ core-data/ conf/postfix/conf/vmail_ssl.map conf/postfix/conf/vmail_ssl.map.db conf/postfix/conf/extra.cf conf/postfix/sql/ conf/core/fail2ban/ conf/dovecot/conf.d/dovecot-sql.conf.ext conf/dovecot/conf.d/extra.cf conf/rspamd/local.d/dkim_signing.conf conf/rspamd/local.d/redis.conf ssl-self-signed/cert.pem ssl-self-signed/key.pem core/billionmail* ================================================ FILE: Dockerfiles/core/Dockerfile ================================================ FROM alpine:3.20 LABEL maintainer="https://github.com/aaPanel/BillionMail" # Set environment variables ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 # Platform-specific binary copy ARG TARGETARCH COPY core/billionmail-${TARGETARCH} /opt/billionmail/core/billionmail COPY core/manifest /opt/billionmail/core/manifest COPY core/languages /opt/billionmail/core/languages COPY core/public /opt/billionmail/core/public COPY core/resource /opt/billionmail/core/resource COPY core/template /opt/billionmail/core/template # Copy file # COPY repositories /etc/apk/repositories COPY stop-supervisor.sh /stop-supervisor.sh COPY core.sh /core.sh COPY restart_fail2ban.sh /restart_fail2ban.sh # Install dependencies (using Alpine's apk package manager) RUN apk add --no-cache \ bash \ ca-certificates \ curl \ supervisor \ rsyslog \ tzdata \ busybox-extras \ postgresql-client \ fail2ban \ iptables \ ipset \ && rm -rf /var/cache/apk/* \ && chmod +x /stop-supervisor.sh /core.sh /restart_fail2ban.sh /opt/billionmail/core/billionmail # Copy file COPY supervisord.conf /etc/supervisor/supervisord.conf COPY fail2ban.conf /etc/fail2ban/fail2ban.conf ENTRYPOINT ["/core.sh"] CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] ================================================ FILE: Dockerfiles/core/core.sh ================================================ #!/bin/bash if [ -f "/opt/billionmail/.env" ]; then if ! grep -q "ADMIN_USERNAME" /opt/billionmail/.env; then ADMIN_USERNAME=$(LC_ALL=C /dev/null | head -c 8) # Default administrator account password echo "ADMIN_USERNAME=${ADMIN_USERNAME}" >> /opt/billionmail/.env fi if ! grep -q "ADMIN_PASSWORD" /opt/billionmail/.env; then ADMIN_PASSWORD=$(LC_ALL=C /dev/null | head -c 8) # Default administrator account password echo "ADMIN_PASSWORD=${ADMIN_PASSWORD}" >> /opt/billionmail/.env fi fi # Generate DH params if [ ! -f "/etc/ssl/mail/dh.pem" ]; then cp -d -n /etc/ssl/ssl-self-signed/* /etc/ssl/mail/ fi # # Generate DH params # if [ ! -f "/etc/ssl/mail/dh.pem" ]; then # openssl dhparam -out /etc/ssl/mail/dh.pem 2048 # fi # Remove defaults-debian.conf if [ -f "/etc/fail2ban/jail.d/defaults-debian.conf" ]; then rm -f /etc/fail2ban/jail.d/defaults-debian.conf fi ## Initialize fail2ban when y, otherwise delete the rule # Enable fail2ban Access restrictions, specify that the IP exceeds the access limit if [[ ${FAIL2BAN_INIT} == "y" ]]; then ## Copy fail2ban Jail cp -rf /opt/billionmail/conf/core/fail2ban_init/jail.d/*-accesslimit.conf /etc/fail2ban/jail.d/ if ! grep -q "restart_fail2ban.sh" /var/spool/cron/crontabs/root; then chmod +x /restart_fail2ban.sh echo "02 0,12 * * * bash /restart_fail2ban.sh" >> /var/spool/cron/crontabs/root chmod 600 /var/spool/cron/crontabs/root chown root:crontab /var/spool/cron/crontabs/root pkill -9 crond fi bash /restart_fail2ban.sh else rm -f /etc/fail2ban/jail.d/*-accesslimit.conf echo -e "fail2ban: delete the rule" fi ## Copy fail2ban Filter # if [ ! -f "/etc/fail2ban/filter.d/core-limit-filter.conf" ]; then # cp -f /opt/billionmail/conf/core/fail2ban_init/filter.d/core-limit-filter.conf /etc/fail2ban/filter.d/core-limit-filter.conf # fi cp -rf /opt/billionmail/conf/core/fail2ban_init/filter.d/*.conf /etc/fail2ban/filter.d/ if [ ! -d "/opt/billionmail/core/template/" ]; then mkdir /opt/billionmail/core/template fi if [ ! -d "/opt/billionmail/core/logs/" ]; then mkdir /opt/billionmail/core/logs fi if [ ! -f "/opt/billionmail/core/logs/access-$(date -u +"%Y%m%d").log" ]; then touch /opt/billionmail/core/logs/access-$(date -u +"%Y%m%d").log fi cd /opt/billionmail/core/ chmod +x billionmail exec "$@" ================================================ FILE: Dockerfiles/core/fail2ban.conf ================================================ # Fail2Ban main configuration file # # Comments: use '#' for comment lines and ';' (following a space) for inline comments # # Changes: in most of the cases you should not modify this # file, but provide customizations in fail2ban.local file, e.g.: # # [DEFAULT] # loglevel = DEBUG # [DEFAULT] # Option: loglevel # Notes.: Set the log level output. # CRITICAL # ERROR # WARNING # NOTICE # INFO # DEBUG # Values: [ LEVEL ] Default: INFO # loglevel = INFO # Option: logtarget # Notes.: Set the log target. This could be a file, SYSTEMD-JOURNAL, SYSLOG, STDERR or STDOUT. # Only one log target can be specified. # If you change logtarget from the default value and you are # using logrotate -- also adjust or disable rotation in the # corresponding configuration file # (e.g. /etc/logrotate.d/fail2ban on Debian systems) # Values: [ STDOUT | STDERR | SYSLOG | SYSOUT | SYSTEMD-JOURNAL | FILE ] Default: STDERR # logtarget = /var/log/fail2ban/fail2ban.log # Option: syslogsocket # Notes: Set the syslog socket file. Only used when logtarget is SYSLOG # auto uses platform.system() to determine predefined paths # Values: [ auto | FILE ] Default: auto syslogsocket = auto # Option: socket # Notes.: Set the socket file. This is used to communicate with the daemon. Do # not remove this file when Fail2ban runs. It will not be possible to # communicate with the server afterwards. # Values: [ FILE ] Default: /var/run/fail2ban/fail2ban.sock # socket = /var/run/fail2ban/fail2ban.sock # Option: pidfile # Notes.: Set the PID file. This is used to store the process ID of the # fail2ban server. # Values: [ FILE ] Default: /var/run/fail2ban/fail2ban.pid # pidfile = /var/run/fail2ban/fail2ban.pid # Option: allowipv6 # Notes.: Allows IPv6 interface: # Default: auto # Values: [ auto yes (on, true, 1) no (off, false, 0) ] Default: auto #allowipv6 = auto # Options: dbfile # Notes.: Set the file for the fail2ban persistent data to be stored. # A value of ":memory:" means database is only stored in memory # and data is lost when fail2ban is stopped. # A value of "None" disables the database. # Values: [ None :memory: FILE ] Default: /var/lib/fail2ban/fail2ban.sqlite3 dbfile = /var/lib/fail2ban/fail2ban.sqlite3 # Options: dbpurgeage # Notes.: Sets age at which bans should be purged from the database # Values: [ SECONDS ] Default: 86400 (24hours) dbpurgeage = 1d # Options: dbmaxmatches # Notes.: Number of matches stored in database per ticket (resolvable via # tags / in actions) # Values: [ INT ] Default: 10 dbmaxmatches = 10 [Definition] [Thread] # Options: stacksize # Notes.: Specifies the stack size (in KiB) to be used for subsequently created threads, # and must be 0 or a positive integer value of at least 32. # Values: [ SIZE ] Default: 0 (use platform or configured default) #stacksize = 0 ================================================ FILE: Dockerfiles/core/repositories ================================================ https://mirrors.ustc.edu.cn/alpine/v3.20/main https://mirrors.ustc.edu.cn/alpine/v3.20/community ================================================ FILE: Dockerfiles/core/restart_fail2ban.sh ================================================ #!/bin/bash if [[ ${FAIL2BAN_INIT} == "y" ]]; then /usr/bin/fail2ban-client reload core-accesslimit /usr/bin/fail2ban-client reload roundcube-accesslimit fi ================================================ FILE: Dockerfiles/core/stop-supervisor.sh ================================================ #!/bin/bash printf "Start\n"; while read line; do echo "PROCESS event: $line" >&2; kill -3 $(cat "/var/run/supervisord.pid") done < /dev/stdin ================================================ FILE: Dockerfiles/core/supervisord.conf ================================================ [supervisord] nodaemon=true logfile=/dev/stdout logfile_maxbytes=0 pidfile=/var/run/supervisord.pid user=root [program:core] command=/opt/billionmail/core/billionmail directory=/opt/billionmail/core/ autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 user=root startsecs=10 priority=100 [program:fail2ban] command=/usr/bin/fail2ban-server -xf start autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 user=root startsecs=10 priority=200 [program:crond] command=/usr/sbin/crond -f autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 user=root [eventlistener:processes] command=/stop-supervisor.sh events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL [supervisorctl] serverurl=unix:///var/run/supervisord.sock [unix_http_server] file=/var/run/supervisord.sock chmod=0700 [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface ================================================ FILE: Dockerfiles/dovecot/Dockerfile ================================================ FROM debian:bookworm-slim LABEL maintainer="https://github.com/aaPanel/BillionMail" ARG DEBIAN_FRONTEND=noninteractive ENV LC_ALL=C ## Copy file COPY stop-supervisor.sh /stop-supervisor.sh COPY dovecot.sh /dovecot.sh COPY rotate_log.sh /rotate_log.sh # COPY debian.sources /etc/apt/sources.list.d/debian.sources # install dovecot RUN apt-get update && apt-get install -y --no-install-recommends --allow-downgrades --allow-remove-essential --allow-change-held-packages \ dovecot-core \ dovecot-dev \ dovecot-pop3d \ dovecot-imapd \ dovecot-lmtpd \ dovecot-pgsql \ dovecot-sieve \ dovecot-ldap \ sasl2-bin \ libsasl2-modules \ postgresql-client \ ca-certificates \ curl \ sudo \ supervisor \ rsyslog \ tzdata \ telnet \ cron \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && mkdir -p /usr/lib/dovecot/sieve \ && chmod +x /stop-supervisor.sh /dovecot.sh /rotate_log.sh ## Copy the supervisord configuration file COPY supervisord.conf /etc/supervisor/supervisord.conf COPY spam-to-folder.sieve /usr/lib/dovecot/sieve/spam-to-folder.sieve COPY report-spam.sieve /usr/lib/dovecot/sieve/report-spam.sieve COPY report-ham.sieve /usr/lib/dovecot/sieve/report-ham.sieve COPY sa-learn-spam.sh /usr/lib/dovecot/sieve/sa-learn-spam.sh COPY sa-learn-ham.sh /usr/lib/dovecot/sieve/sa-learn-ham.sh ENTRYPOINT ["/dovecot.sh"] # EXPOSE 110 143 993 995 CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] ================================================ FILE: Dockerfiles/dovecot/debian.sources ================================================ Types: deb URIs: http://mirrors.ustc.edu.cn/debian Suites: bookworm bookworm-updates Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg Types: deb URIs: http://mirrors.ustc.edu.cn/debian-security Suites: bookworm-security Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg ================================================ FILE: Dockerfiles/dovecot/dovecot.sh ================================================ #!/bin/bash id vmail || useradd -r -u 150 -g mail -d /var/vmail -s /sbin/nologin -c "Virtual Mail User" vmail chown -R vmail:mail /var/vmail if [ ! -f "/etc/ssl/mail/dh.pem" ] || [ ! -f "/etc/ssl/mail/cert.pem" ] || [ ! -f "/etc/ssl/mail/key.pem" ]; then cp -d -n /etc/ssl/ssl-self-signed/* /etc/ssl/mail/ fi if ! grep -q "rotate_log.sh" /var/spool/cron/crontabs/root; then chmod +x /rotate_log.sh echo "05 00 * * * bash /rotate_log.sh >> /var/log/mail/rotate_log.log 2>&1" >> /var/spool/cron/crontabs/root chmod 600 /var/spool/cron/crontabs/root chown root:crontab /var/spool/cron/crontabs/root /usr/bin/supervisorctl restart cron fi cat < /etc/dovecot/conf.d/dovecot-sql.conf.ext driver = pgsql connect = host=pgsql dbname=${DBNAME} user=${DBUSER} password=${DBPASS} default_pass_scheme = MD5-CRYPT user_query = SELECT '/var/vmail/%d/%n' as home, 'maildir:/var/vmail/%d/%n' as mail, 150 AS uid, 8 AS gid, 'maildir:storage=' || quota AS quota FROM mailbox WHERE username = '%u' AND active = 1 password_query = SELECT username as user, password, '/var/vmail/%d/%n' as userdb_home, 'maildir:/var/vmail/%d/%n' as userdb_mail, 150 as userdb_uid, 8 as userdb_gid FROM mailbox WHERE username = '%u' AND active = 1 EOF chmod +x /usr/lib/dovecot/sieve/sa-learn-spam.sh chmod +x /usr/lib/dovecot/sieve/sa-learn-ham.sh sievec /usr/lib/dovecot/sieve/spam-to-folder.sieve sievec /usr/lib/dovecot/sieve/report-spam.sieve sievec /usr/lib/dovecot/sieve/report-ham.sieve exec "$@" ================================================ FILE: Dockerfiles/dovecot/report-ham.sieve ================================================ require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"]; if environment :matches "imap.mailbox" "*" { set "mailbox" "${1}"; } if string "${mailbox}" "Trash" { stop; } if environment :matches "imap.user" "*" { set "username" "${1}"; } pipe :copy "sa-learn-ham.sh" [ "${username}" ]; ================================================ FILE: Dockerfiles/dovecot/report-spam.sieve ================================================ require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"]; if environment :matches "imap.user" "*" { set "username" "${1}"; } pipe :copy "sa-learn-spam.sh" [ "${username}" ]; ================================================ FILE: Dockerfiles/dovecot/rotate_log.sh ================================================ #!/bin/bash echo " ---- $(date) START ----" LOG_DIR="/var/log/mail" LOG_FILE="${LOG_DIR}/mail.log" DATE=$(date +%Y%m%d) BACKUP_FILE="${LOG_DIR}/mail-${DATE}.log" # Retention days RETENTION_DAYS=${RETENTION_DAYS:-7} # echo "Retention days: ${RETENTION_DAYS}" # backup log if [ -f "${LOG_FILE}" ]; then echo "Backup log: ${LOG_FILE}" mv "${LOG_FILE}" "${BACKUP_FILE}" # Restart rsyslog if [ -f "/var/run/rsyslogd.pid" ]; then kill -HUP $(cat /var/run/rsyslogd.pid) >/dev/null 2>&1 if [ $? -ne 0 ]; then echo "Restart rsyslogd" /usr/bin/supervisorctl restart rsyslog fi else /usr/bin/supervisorctl restart rsyslog fi else echo "The log file does not exist: ${LOG_FILE}" echo "" exit 1 fi # sleep 2 # CHECK_RSYSLOG=$(/usr/bin/supervisorctl status rsyslog|grep RUNNING) # if [ -z "${CHECK_RSYSLOG}" ]; then # echo "rsyslog is not running, Starting..." # /usr/bin/supervisorctl restart rsyslog # fi # CHECK_dovecot=$(/usr/bin/supervisorctl status dovecot|grep RUNNING) # if [ -z "${CHECK_dovecot}" ]; then # echo "dovecot is not running, Starting..." # /usr/bin/supervisorctl restart dovecot # fi # Compress backup files if [ -f "${BACKUP_FILE}.gz" ]; then mv "${BACKUP_FILE}.gz" "${BACKUP_FILE}_1.gz" fi echo "Compressing: "${BACKUP_FILE}"" gzip "${BACKUP_FILE}" # Clean up expiration logs echo "Cleaning up expiration logs:" find "${LOG_DIR}" -name "mail-*.log.gz" -type f -mtime +${RETENTION_DAYS} -print -delete echo " ---- $(date) END ----" echo "" # 10MB in bytes SIZE_THRESHOLD=$((10 * 1024 * 1024)) TARGET_LOG="${LOG_DIR}/rotate_log.log" GZIP_LOG="${LOG_DIR}/rotate_log-${DATE}.log" # Check whether the target log file exceeds 10 m, if so, compress if [ -f "${TARGET_LOG}" ]; then FILE_SIZE=$(stat -c %s "${TARGET_LOG}") if [ ${FILE_SIZE} -gt ${SIZE_THRESHOLD} ]; then echo "Log file ${TARGET_LOG} exceeds 10M, compress..." mv "${TARGET_LOG}" "${GZIP_LOG}" gzip "${GZIP_LOG}" fi fi find "${LOG_DIR}" -name "rotate_log-*.gz" -type f -mtime +${RETENTION_DAYS} -delete ================================================ FILE: Dockerfiles/dovecot/sa-learn-ham.sh ================================================ #!/bin/sh # exec /usr/bin/rspamc -h rspamd:11334 learn_ham USERNAME="$1" echo "$USERNAME" >> /tmp/learnham /usr/bin/curl -X POST --data-binary @- --unix-socket /var/lib/rspamd/rspamd.sock http://rspamd:11334/learnham ================================================ FILE: Dockerfiles/dovecot/sa-learn-spam.sh ================================================ #!/bin/sh # exec /usr/bin/rspamc -h rspamd:11334 learn_spam USERNAME="$1" echo "$USERNAME" >> /tmp/learnspam /usr/bin/curl -X POST --data-binary @- --unix-socket /var/lib/rspamd/rspamd.sock http://rspamd:11334/learnspam ================================================ FILE: Dockerfiles/dovecot/spam-to-folder.sieve ================================================ require ["fileinto"]; if header :is "X-Spam" "Yes" { fileinto "Junk"; } ================================================ FILE: Dockerfiles/dovecot/stop-supervisor.sh ================================================ #!/bin/bash printf "Start\n"; while read line; do echo "PROCESS event: $line" >&2; kill -3 $(cat "/var/run/supervisord.pid") done < /dev/stdin ================================================ FILE: Dockerfiles/dovecot/supervisord.conf ================================================ [supervisord] nodaemon=true logfile=/dev/stdout logfile_maxbytes=0 pidfile=/var/run/supervisord.pid user=root [program:rsyslog] command=/bin/sh -c "rm -f /run/rsyslogd.pid && exec /usr/sbin/rsyslogd -n -i /run/rsyslogd.pid" autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:dovecot] command=/bin/sh -c "rm -f /run/dovecot/master.pid && exec /usr/sbin/dovecot -F" autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 startsecs=10 stopasgroup=true killasgroup=true [program:cron] command=/usr/sbin/cron -f autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 user=root [eventlistener:processes] command=/stop-supervisor.sh events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL [supervisorctl] serverurl=unix:///var/run/supervisor.sock [unix_http_server] file=/var/run/supervisor.sock chmod=0700 [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface ================================================ FILE: Dockerfiles/postfix/Dockerfile ================================================ FROM debian:bookworm-slim LABEL maintainer="https://github.com/aaPanel/BillionMail" ARG DEBIAN_FRONTEND=noninteractive ENV LC_ALL=C RUN dpkg-divert --local --rename --add /sbin/initctl \ && dpkg-divert --local --rename --add /usr/bin/ischroot \ && ln -sf /bin/true /sbin/initctl \ && ln -sf /bin/true /usr/bin/ischroot ## Copy postfix file COPY postfix.sh /postfix.sh COPY stop-supervisor.sh /stop-supervisor.sh COPY rotate_log.sh /rotate_log.sh # COPY debian.sources /etc/apt/sources.list.d/debian.sources # Add groups and users install Postfix RUN groupadd -g 102 postfix \ && groupadd -g 103 postdrop \ && useradd -g postfix -u 101 -d /var/spool/postfix -s /usr/sbin/nologin postfix \ && apt-get update && apt-get install -y --no-install-recommends --allow-downgrades --allow-remove-essential --allow-change-held-packages \ ca-certificates \ curl \ dirmngr \ dnsutils \ gnupg \ libsasl2-modules \ postgresql-client \ postfix \ postfix-pgsql \ postfix-pcre \ sasl2-bin \ sudo \ supervisor \ rsyslog \ telnet \ net-tools \ tzdata \ cron \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && chmod +x /postfix.sh /stop-supervisor.sh /rotate_log.sh ## Copy the supervisord configuration file COPY supervisord.conf /etc/supervisor/supervisord.conf # EXPOSE 25 465 587 CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] ================================================ FILE: Dockerfiles/postfix/debian.sources ================================================ Types: deb URIs: http://mirrors.ustc.edu.cn/debian Suites: bookworm bookworm-updates Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg Types: deb URIs: http://mirrors.ustc.edu.cn/debian-security Suites: bookworm-security Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg ================================================ FILE: Dockerfiles/postfix/postfix.sh ================================================ #!/bin/bash trap "postfix stop" EXIT if ! grep -q "rotate_log.sh" /var/spool/cron/crontabs/root; then chmod +x /rotate_log.sh echo "00 00 * * * bash /rotate_log.sh >> /var/log/mail/rotate_log.log 2>&1" >> /var/spool/cron/crontabs/root chmod 600 /var/spool/cron/crontabs/root chown root:crontab /var/spool/cron/crontabs/root /usr/bin/supervisorctl restart cron fi cat < /etc/postfix/btrule.cf user = ${DBUSER} password = ${DBPASS} hosts = pgsql dbname = ${DBNAME} query = select s.goto from( select address, goto, 1 as stype from alias union select username,username,2 as stype from mailbox union select address, goto, 3 as stype from alias_domain a left join alias b on b.address = '@' || a.alias_domain and a.alias_domain ='%d' order by stype) s where s.address='%s' or s.stype=3 limit 0,1 EOF cat < /etc/postfix/sql/pgsql_virtual_alias_domain_catchall_maps.cf user = ${DBUSER} password = ${DBPASS} hosts = pgsql dbname = ${DBNAME} query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' and alias.address = '@' || alias_domain.target_domain AND alias.active = 1 AND alias_domain.active = 1 EOF cat < /etc/postfix/sql/pgsql_virtual_alias_domain_mailbox_maps.cf user = ${DBUSER} password = ${DBPASS} hosts = pgsql dbname = ${DBNAME} query = SELECT maildir FROM mailbox,alias_domain WHERE alias_domain.alias_domain = '%d' and mailbox.username = '%u' || '@' || alias_domain.target_domain AND mailbox.active = 1 AND alias_domain.active = 1 EOF cat < /etc/postfix/sql/pgsql_virtual_alias_domain_maps.cf user = ${DBUSER} password = ${DBPASS} hosts = pgsql dbname = ${DBNAME} query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' and alias.address = '%u' || '@' || alias_domain.target_domain AND alias.active = 1 AND alias_domain.active = 1 EOF cat < /etc/postfix/sql/pgsql_virtual_alias_maps.cf user = ${DBUSER} password = ${DBPASS} hosts = pgsql dbname = ${DBNAME} query = (select username from mailbox where username like '%s' and active = 1 limit 1) union (select goto from alias where address like '%s' and active = 1 limit 1) EOF cat < /etc/postfix/sql/pgsql_virtual_domains_maps.cf user = ${DBUSER} password = ${DBPASS} hosts = pgsql dbname = ${DBNAME} query = SELECT domain FROM domain WHERE domain='%s' AND active = 1 EOF cat < /etc/postfix/sql/pgsql_virtual_mailbox_maps.cf user = ${DBUSER} password = ${DBPASS} hosts = pgsql dbname = ${DBNAME} query = SELECT maildir FROM mailbox WHERE username='%s' AND active = 1 EOF # Append myhostname and User configuration if [ -z "${BILLIONMAIL_HOSTNAME}" ]; then BILLIONMAIL_HOSTNAME=mail.example.com fi if [ -f "/etc/postfix/conf/extra.cf" ]; then # Delete all contents of Overrides-configuration matching line to the end of the file sed '/Overrides-configuration/q' /etc/postfix/main.cf > /tmp/main.cf.tmp if [ -s "/tmp/main.cf.tmp" ]; then cat /tmp/main.cf.tmp > /etc/postfix/main.cf # rm -f /tmp/main.cf.tmp echo >> /etc/postfix/main.cf echo -e "\n# User Overrides-configuration" >> /etc/postfix/main.cf # Append User configuration sed -i '/\$myhostname/! { /myhostname/d }' /etc/postfix/conf/extra.cf echo -e "myhostname = ${BILLIONMAIL_HOSTNAME}\n$(cat /etc/postfix/conf/extra.cf)" > /etc/postfix/conf/extra.cf cat /etc/postfix/conf/extra.cf >> /etc/postfix/main.cf rm -f /etc/postfix/conf/extra.cf else echo "Rewriting /etc/postfix/main.cf failed, /tmp/main.cf.tmp is empty." fi fi CHECK_MYHOSTNAME=$(grep "myhostname" /etc/postfix/main.cf | grep -v '$myhostname') if [ -z "${CHECK_MYHOSTNAME}" ]; then echo >> /etc/postfix/main.cf echo -e "\n# User Overrides-configuration" >> /etc/postfix/main.cf echo "myhostname = ${BILLIONMAIL_HOSTNAME}" >> /etc/postfix/main.cf fi if [ ! -f "/etc/postfix/conf/vmail_ssl.map" ]; then touch /etc/postfix/conf/vmail_ssl.map fi postmap -F hash:/etc/postfix/conf/vmail_ssl.map; # Fix Postfix permissions chgrp -R postdrop /var/spool/postfix/public chgrp -R postdrop /var/spool/postfix/maildrop #postfix set-permissions if [ -e "/var/spool/postfix/pid/master.pid" ]; then rm -rf /var/spool/postfix/pid/master.pid fi if [ -d "/var/spool/postfix/" ]; then [ ! -d "/var/spool/postfix/dev/" ] && mkdir /var/spool/postfix/dev fi # Check Postfix configuration postconf -c /etc/postfix/ > /dev/null if [[ $? != 0 ]]; then echo "Postfix configuration error, Startup failed." exit 1 else postfix start-fg fi ================================================ FILE: Dockerfiles/postfix/rotate_log.sh ================================================ #!/bin/bash echo " ---- $(date) START ----" LOG_DIR="/var/log/mail" LOG_FILE="${LOG_DIR}/mail.log" DATE=$(date +%Y%m%d) BACKUP_FILE="${LOG_DIR}/mail-${DATE}.log" # Retention days RETENTION_DAYS=${RETENTION_DAYS:-7} # echo "Retention days: ${RETENTION_DAYS}" # backup log if [ -f "${LOG_FILE}" ]; then echo "Backup log: ${LOG_FILE}" mv "${LOG_FILE}" "${BACKUP_FILE}" # Restart rsyslog if [ -f "/var/run/rsyslogd.pid" ]; then kill -HUP $(cat /var/run/rsyslogd.pid) >/dev/null 2>&1 if [ $? -ne 0 ]; then echo "Restart rsyslogd" /usr/bin/supervisorctl restart rsyslog fi else /usr/bin/supervisorctl restart rsyslog fi else echo "The log file does not exist: ${LOG_FILE}" echo "" exit 1 fi # sleep 2 # CHECK_RSYSLOG=$(/usr/bin/supervisorctl status rsyslog|grep RUNNING) # if [ -z "${CHECK_RSYSLOG}" ]; then # echo "rsyslog is not running, Starting..." # /usr/bin/supervisorctl restart rsyslog # fi # CHECK_POSTFIX=$(/usr/bin/supervisorctl status postfix|grep RUNNING) # if [ -z "${CHECK_POSTFIX}" ]; then # echo "Postfix is not running, Starting..." # /usr/bin/supervisorctl restart postfix # fi # Compress backup files if [ -f "${BACKUP_FILE}.gz" ]; then mv "${BACKUP_FILE}.gz" "${BACKUP_FILE}_1.gz" fi echo "Compressing: "${BACKUP_FILE}"" gzip "${BACKUP_FILE}" # Clean up expiration logs echo "Cleaning up expiration logs:" find "${LOG_DIR}" -name "mail-*.log.gz" -type f -mtime +${RETENTION_DAYS} -print -delete echo " ---- $(date) END ----" echo "" # 10MB in bytes SIZE_THRESHOLD=$((10 * 1024 * 1024)) TARGET_LOG="${LOG_DIR}/rotate_log.log" GZIP_LOG="${LOG_DIR}/rotate_log-${DATE}.log" # Check whether the target log file exceeds 10 m, if so, compress if [ -f "${TARGET_LOG}" ]; then FILE_SIZE=$(stat -c %s "${TARGET_LOG}") if [ ${FILE_SIZE} -gt ${SIZE_THRESHOLD} ]; then echo "Log file ${TARGET_LOG} exceeds 10M, compress..." mv "${TARGET_LOG}" "${GZIP_LOG}" gzip "${GZIP_LOG}" fi fi find "${LOG_DIR}" -name "rotate_log-*.gz" -type f -mtime +${RETENTION_DAYS} -delete ================================================ FILE: Dockerfiles/postfix/stop-supervisor.sh ================================================ #!/bin/bash printf "Start\n"; while read line; do echo "PROCESS event: $line" >&2; kill -3 $(cat "/var/run/supervisord.pid") done < /dev/stdin ================================================ FILE: Dockerfiles/postfix/supervisord.conf ================================================ [supervisord] nodaemon=true logfile=/dev/stdout logfile_maxbytes=0 pidfile=/var/run/supervisord.pid user=root [program:rsyslog] command=/bin/sh -c "rm -f /run/rsyslogd.pid && exec /usr/sbin/rsyslogd -n -i /run/rsyslogd.pid" autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:postfix] command=/postfix.sh autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 startsecs=10 [program:cron] command=/usr/sbin/cron -f autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 user=root [eventlistener:processes] command=/stop-supervisor.sh events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL [supervisorctl] serverurl=unix:///var/run/supervisor.sock [unix_http_server] file=/var/run/supervisor.sock chmod=0700 [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface ================================================ FILE: Dockerfiles/rspamd/Dockerfile ================================================ FROM debian:bookworm-slim LABEL maintainer="https://github.com/aaPanel/BillionMail" ARG DEBIAN_FRONTEND=noninteractive ARG RSPAMD_VER=rspamd_3.11.1-1~ab0b44951 ARG CODENAME=bookworm ENV LC_ALL=C COPY rspamd.sh /rspamd.sh COPY stop-supervisor.sh /stop-supervisor.sh COPY rotate_log.sh /rotate_log.sh # COPY debian.sources /etc/apt/sources.list.d/debian.sources RUN apt-get update && apt-get install -y \ tzdata \ ca-certificates \ gnupg2 \ apt-transport-https \ dnsutils \ netcat-traditional \ wget \ redis-tools \ procps \ vim-tiny \ lua-cjson \ cron \ supervisor \ && arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) \ && wget -O /tmp/${RSPAMD_VER}~${CODENAME}_${arch}.deb https://rspamd.com/apt-stable/pool/main/r/rspamd/${RSPAMD_VER}~${CODENAME}_${arch}.deb \ && apt install -y /tmp/${RSPAMD_VER}~${CODENAME}_${arch}.deb \ && rm -rf /var/lib/apt/lists/* /tmp/*\ && apt-get autoremove --purge \ && apt-get clean \ && mkdir -p /run/rspamd \ && chown _rspamd:_rspamd /run/rspamd \ && chmod +x /rspamd.sh /stop-supervisor.sh /rotate_log.sh \ && echo 'alias ll="ls -la --color"' >> ~/.bashrc COPY supervisord.conf /etc/supervisor/supervisord.conf ENTRYPOINT ["/rspamd.sh"] STOPSIGNAL SIGTERM # CMD ["/usr/bin/rspamd", "-f", "-u", "_rspamd", "-g", "_rspamd"] CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] ================================================ FILE: Dockerfiles/rspamd/debian.sources ================================================ Types: deb URIs: http://mirrors.ustc.edu.cn/debian Suites: bookworm bookworm-updates Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg Types: deb URIs: http://mirrors.ustc.edu.cn/debian-security Suites: bookworm-security Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg ================================================ FILE: Dockerfiles/rspamd/rotate_log.sh ================================================ #!/bin/bash echo " ---- $(date) START ----" LOG_DIR="/var/log/rspamd" LOG_FILE="${LOG_DIR}/rspamd.log" DATE=$(date +%Y%m%d) BACKUP_FILE="${LOG_DIR}/rspamd-${DATE}.log" # Retention days RETENTION_DAYS=${RETENTION_DAYS:-7} # echo "Retention days: ${RETENTION_DAYS}" # backup log if [ -f "${LOG_FILE}" ]; then echo "Backup log: ${LOG_FILE}" mv "${LOG_FILE}" "${BACKUP_FILE}" # Restart rspamd /usr/bin/pkill -USR1 rspamd if [ $? -ne 0 ]; then echo "Restart rspamd" /usr/bin/supervisorctl restart rspamd fi else echo "The log file does not exist: ${LOG_FILE}" echo "" exit 1 fi # Compress backup files if [ -f "${BACKUP_FILE}.gz" ]; then mv "${BACKUP_FILE}.gz" "${BACKUP_FILE}_1.gz" fi echo "Compressing: "${BACKUP_FILE}"" gzip "${BACKUP_FILE}" # Clean up expiration logs echo "Cleaning up expiration logs:" find "${LOG_DIR}" -name "rspamd-*.log.gz" -type f -mtime +${RETENTION_DAYS} -print -delete echo " ---- $(date) END ----" echo "" # 10MB in bytes SIZE_THRESHOLD=$((10 * 1024 * 1024)) TARGET_LOG="${LOG_DIR}/rotate_log.log" GZIP_LOG="${LOG_DIR}/rotate_log-${DATE}.log" # Check whether the target log file exceeds 10 m, if so, compress if [ -f "${TARGET_LOG}" ]; then FILE_SIZE=$(stat -c %s "${TARGET_LOG}") if [ ${FILE_SIZE} -gt ${SIZE_THRESHOLD} ]; then echo "Log file ${TARGET_LOG} exceeds 10M, compress..." mv "${TARGET_LOG}" "${GZIP_LOG}" gzip "${GZIP_LOG}" fi fi find "${LOG_DIR}" -name "rotate_log-*.gz" -type f -mtime +${RETENTION_DAYS} -delete ================================================ FILE: Dockerfiles/rspamd/rspamd.sh ================================================ #!/bin/bash if ! grep -q "rotate_log.sh" /var/spool/cron/crontabs/root; then chmod +x /rotate_log.sh echo "10 00 * * * bash /rotate_log.sh >> /var/log/rspamd/rotate_log.log 2>&1" >> /var/spool/cron/crontabs/root chmod 600 /var/spool/cron/crontabs/root chown root:crontab /var/spool/cron/crontabs/root /usr/bin/supervisorctl restart cron fi chmod 755 /var/lib/rspamd chown -R _rspamd:_rspamd /var/lib/rspamd cat < /etc/rspamd/local.d/redis.conf servers = "redis:6379"; # Read servers (unless write_servers are unspecified) write_servers = "redis:6379"; # Servers to write data disabled_modules = ["ratelimit"]; # List of modules that should not use redis from this section timeout = 10s; db = "0"; password = "${REDISPASS}"; EOF exec "$@" ================================================ FILE: Dockerfiles/rspamd/stop-supervisor.sh ================================================ #!/bin/bash printf "Start\n"; while read line; do echo "PROCESS event: $line" >&2; kill -3 $(cat "/var/run/supervisord.pid") done < /dev/stdin ================================================ FILE: Dockerfiles/rspamd/supervisord.conf ================================================ [supervisord] nodaemon=true logfile=/dev/stdout logfile_maxbytes=0 pidfile=/var/run/supervisord.pid user=root [program:rspamd] command=/usr/bin/rspamd -f -u _rspamd -g _rspamd autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:cron] command=/usr/sbin/cron -f autostart=true autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 user=root [eventlistener:processes] command=/stop-supervisor.sh events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL [supervisorctl] serverurl=unix:///var/run/supervisor.sock [unix_http_server] file=/var/run/supervisor.sock chmod=0700 [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface ================================================ FILE: LICENSE ================================================ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================ FILE: README-ja.md ================================================

BillionMail 📧

## スマートなキャンペーンのためのオープンソースメールサーバー/メールマガジン/Eメールマーケティングソリューション [![][license-shield]][license-link] [![][docs-shield]][docs-link] [![][github-release-shield]][github-release-link] [![][github-stars-shield]][github-stars-link] [English](README.md) | [简体中文](README-zh_CN.md) | 日本語 | [Türkçe](README-ja.md)

aaPanel%2FBillionMail | Trendshift
## BillionMailとは? BillionMailは、ビジネスや個人がメールキャンペーンを簡単に管理できるよう設計された**オープンソースのメールサーバー兼Eメールマーケティングプラットフォーム**です。ニュースレター、プロモーションメール、取引通知などを送信する際に、メールマーケティングのすべてを**完全にコントロール**できます。**高度な分析機能**や**顧客管理機能**を活用し、プロフェッショナルのようにメールを作成、送信、トラッキングできます。 ![BillionMailバナー](https://www.billionmail.com/home.png?v1) # たった3ステップで10億通のメールを送信! **10億通のメール。あらゆるビジネスに。保証付き。** ### Step 1️⃣ BillionMailのインストール ✅ インストールから**8分**で**✅ メール送信成功**まで完了します ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && bash install.sh ```` ### Step 2️⃣ ドメインを接続する * 送信ドメインを追加 * DNSレコードを検証 * 無料SSLを自動有効化 ### Step 3️⃣ キャンペーンを構築する * メールを作成または貼り付け * リストとタグを選択 * 送信日時を設定または今すぐ送信 ## その他のインストール方法 👉 [https://www.aapanel.com/new/download.html](https://www.aapanel.com/new/download.html) ### aaPanelでワンクリックインストール **Docker** ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && cp env_init .env && docker compose up -d || docker-compose up -d ``` ## 管理スクリプト * 管理ヘルプ `bm help` * デフォルトログイン情報を表示 `bm default` * ドメインのDNSレコードを表示 `bm show-record` * BillionMailを更新 `bm update` ## ライブデモ BillionMailデモ: [https://demo.billionmail.com/billionmail](https://demo.billionmail.com/billionmail) ユーザー名: `billionmail` パスワード: `billionmail` ## Webメール BillionMailには**RoundCube**が統合されており、`/roundcube/`からWebメールにアクセスできます。 ## なぜBillionMailを選ぶのか? ほとんどのEメールマーケティングプラットフォームは**高価**、**クローズドソース**、または**基本機能が不足**しています。BillionMailはこれらと異なります: ✅ **完全オープンソース** – 隠れたコストなし、ベンダーロックインなし。 📊 **高度な分析機能** – メール配信、開封率、クリック率などを追跡。 📧 **送信数無制限** – 送信メール数に制限なし。 🎨 **カスタマイズ可能なテンプレート** – プロフェッショナルなマーケティングテンプレートを再利用可能。 🔒 **プライバシーファースト** – データは自分のサーバーにあり、サードパーティによる追跡なし。 🚀 **セルフホスト** – 自分のサーバーで実行し、完全にコントロール可能。 ## どうすれば貢献できるか 🌟 BillionMailは**コミュニティ主導のプロジェクト**であり、立ち上げには皆さんのサポートが必要です!以下の方法でご参加ください: 1. **このリポジトリにスターを付ける**:スターを付けて関心を示しましょう。 2. **情報を拡散する**:開発者、マーケター、オープンソース愛好家にBillionMailを紹介しましょう。 3. **フィードバックを共有する**:Issueを立てるかディスカッションに参加して、どんな機能がほしいか教えてください。 4. **コントリビュートする**:開発が始まったら、コミュニティからの貢献を歓迎します。今後のアップデートをお待ちください! --- 📧 **BillionMail – オープンソースEメールマーケティングの未来。** ## Issues 問題が発生したり機能リクエストがある場合は、[Issueを作成](https://github.com/aaPanel/BillionMail/issues)してください。以下を含めると助かります: * 問題またはリクエストの明確な説明 * 再現手順(該当する場合) * スクリーンショットやエラーログ(該当する場合) ## 今すぐインストール ✅ インストールから**8分**で**メール送信成功**まで完了します ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && bash install.sh ``` **Dockerでインストール:**(Dockerとdocker-compose-pluginを手動でインストールし、.envファイルを編集してください) ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && cp env_init .env && docker compose up -d || docker-compose up -d ``` ## ライセンス BillionMailは**AGPLv3ライセンス**のもとで公開されています。これにより以下が可能です: ✅ ソフトウェアを無料で使用する ✅ コードを改変・再配布する ✅ プライベート利用に制限なし 詳細は[LICENSE](LICENSE)ファイルをご覧ください。 --- [docs-link]: https://www.billionmail.com/ [license-link]: https://www.gnu.org/licenses/gpl-3.0.html [github-release-link]: https://github.com/aaPanel/BillionMail/releases/latest [github-stars-link]: https://github.com/aaPanel/BillionMail [github-issues-link]: https://github.com/aaPanel/BillionMail/issues [docs-shield]: https://img.shields.io/badge/documentation-148F76 [github-release-shield]: https://img.shields.io/github/v/release/aaPanel/BillionMail [github-stars-shield]: https://img.shields.io/github/stars/aaPanel/BillionMail?color=%231890FF&style=flat-square [license-shield]: https://img.shields.io/github/license/aaPanel/BillionMail ================================================ FILE: README-tr.md ================================================

BillionMail 📧

## Daha Akıllı Kampanyalar İçin Açık Kaynaklı Bir Posta Sunucusu, Bülten ve E-posta Pazarlama Çözümü [![][license-shield]][license-link] [![][docs-shield]][docs-link] [![][github-release-shield]][github-release-link] [![][github-stars-shield]][github-stars-link] English | [简体中文](README-zh_CN.md) | [日本語](README-ja.md) | [Türkçe](README-ja.md)

aaPanel%2FBillionMail | Trendshift
## BillionMail Nedir? BillionMail, işletmelerin ve bireylerin e-posta kampanyalarını kolayca yönetmelerine yardımcı olmak için tasarlanmış **geleceğe yönelik açık kaynaklı bir Posta sunucusu ve E-posta pazarlama platformudur**. İster bültenler, ister tanıtım e-postaları veya işlem mesajları gönderiyor olun, bu araç e-posta pazarlama çabalarınız üzerinde **tam kontrol sağlar**. **Gelişmiş analitik** ve **müşteri yönetimi** gibi özelliklerle, e-postaları bir profesyonel gibi oluşturabilir, gönderebilir ve takip edebilirsiniz. ![BillionMail Banner](https://www.billionmail.com/home.png?v1) # Bir Milyar E-posta Göndermek İçin Sadece 3 Adım! **Bir milyar e-posta. Her işletme. Garantili.** ### Adım 1️⃣ BillionMail'i Kurun: ✅ ✅ Kurulumdan ✅ **başarılı e-posta gönderimine** geçmek **sadece 8️⃣ dakika** sürer ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && bash install.sh ``` ### Adım 2️⃣: Alan Adınızı Bağlayın - Gönderim alan adını ekleyin - DNS kayıtlarını doğrulayın - Ücretsiz SSL'yi otomatik etkinleştirin ### Adım 3️⃣: Kampanyanızı Oluşturun - E-postanızı yazın veya yapıştırın - Liste ve etiketleri seçin - Gönderim zamanını ayarlayın veya hemen gönderin ## Diğer Kurulum Yöntemleri ### aaPanel'de Tek Tıkla Kurulum 👉 https://www.aapanel.com/new/download.html (✅aaPanel'e giriş yapın --> 🐳Docker --> 1️⃣Tek Tıkla Kurulum) **Docker** ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && cp env_init .env && docker compose up -d || docker-compose up -d ``` ## Yönetim Scripti - Yönetim yardımı `bm help` - Varsayılan oturum açma bilgilerini görüntüleme `bm default` - Alan adı DNS kaydını gösterme `bm show-record` - BillionMail'i güncelleme `bm update` ## Canlı Demo BillionMail Demo: [https://demo.billionmail.com/billionmail](https://demo.billionmail.com/billionmail) Kullanıcı Adı: `billionmail` Şifre: `billionmail` ## WebMail BillionMail, **RoundCube**'u entegre etmiştir, WebMail'e `/roundcube/` üzerinden erişebilirsiniz. . ## Neden BillionMail? Çoğu e-posta pazarlama platformu ya **pahalı**, ya **kapalı kaynaklı** ya da **temel özelliklerden yoksundur**. BillionMail farklı olmayı hedefliyor:: ✅ **Tamamen Açık Kaynaklı** – Gizli maliyetler yok, tedarikçi bağımlılığı yok. 📊 **Gelişmiş Analitik** – E-posta teslimatını, açılma oranlarını, tıklanma oranlarını ve daha fazlasını takip edin. 📧 **Sınırsız Gönderim** – Gönderebileceğiniz e-posta sayısında kısıtlama yok. 🎨 **Özelleştirilebilir** Şablonlar – Yeniden kullanım için özel profesyonel pazarlama şablonları. 🔒 **Gizlilik Öncelikli** – Verileriniz sizde kalır, üçüncü taraf takibi yok. 🚀 **Kendi Sunucunuzda Barındırma** – Tam kontrol için kendi sunucunuzda çalıştırın. ## Nasıl Yardımcı Olabilirsiniz 🌟 BillionMail **topluluk odaklı bir projedir** ve başlamak için desteğinize ihtiyacımız var! İşte nasıl yardımcı olabileceğiniz: 1. **Bu Depoyu Yıldızlayın**: Bu depoyu yıldızlayarak ilginizi gösterin. 2. **Haberi Yayın:** BillionMail'i ağınızla (geliştiriciler, pazarlamacılar ve açık kaynak meraklıları) paylaşın. 3. **Geri Bildirim Paylaşın:** Bir sorun açarak veya tartışmaya katılarak BillionMail'de görmek istediğiniz özellikleri bize bildirin. 4. **Katkıda Bulunun:** Geliştirme başladığında, topluluktan gelen katkıları memnuniyetle karşılayacağız. Güncellemeler için takipte kalın! --- 📧 **BillionMail – Açık Kaynaklı E-posta Pazarlamasının Geleceği.** ## Sorunlar Herhangi bir sorunla karşılaşırsanız veya özellik talepleriniz olursa, lütfen [bir sorun açın](https://github.com/aaPanel/BillionMail/issues). Şunları eklediğinizden emin olun: - Sorunun veya talebin açık bir açıklaması. - Sorunu yeniden oluşturma adımları (varsa). - Ekran görüntüleri veya hata günlükleri (varsa). ## Şimdi Kurun: ✅Kurulumdan **başarılı e-posta gönderimine** geçmek **sadece 8 dakika** sürer ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && bash install.sh ``` **Docker ile Kurulum**: (Lütfen Docker ve docker-compose-plugin'i manuel olarak kurun ve .env dosyasını değiştirin) ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && cp env_init .env && docker compose up -d || docker-compose up -d ``` ## Yıldız Geçmişi [![Star History Chart](https://api.star-history.com/svg?repos=aapanel/billionmail&type=Date)](https://www.star-history.com/#aapanel/billionmail&Date) ## Lisans BillionMail, **AGPLv3 Lisansı** altında lisanslanmıştır. Bu, şunları yapabileceğiniz anlamına gelir ✅ Yazılımı ücretsiz kullanma. ✅ Kodu değiştirme ve dağıtma. ✅ Özel olarak kısıtlama olmaksızın kullanma. Daha fazla ayrıntı için [LICENSE](LICENSE) dosyasına bakın. --- [docs-link]: https://www.billionmail.com/ [license-link]: https://www.gnu.org/licenses/agpl-3.0.html [github-release-link]: https://github.com/aaPanel/BillionMail/releases/latest [github-stars-link]: https://github.com/aaPanel/BillionMail [github-issues-link]: https://github.com/aaPanel/BillionMail/issues [docs-shield]: https://img.shields.io/badge/documentation-148F76 [github-release-shield]: https://img.shields.io/github/v/release/aaPanel/BillionMail [github-stars-shield]: https://img.shields.io/github/stars/aaPanel/BillionMail?color=%231890FF&style=flat-square    [license-shield]: https://img.shields.io/github/license/aaPanel/BillionMail ================================================ FILE: README-zh_CN.md ================================================

BillionMail 📧

## 一个开源的邮件服务器,为智能营销提供电子邮件解决方案 [![][license-shield]][license-link] [![][docs-shield]][docs-link] [![][github-release-shield]][github-release-link] [![][github-stars-shield]][github-stars-link] [English](README.md) | 简体中文 | [日本語](README-ja.md) | [Türkçe](README-ja.md)

aaPanel%2FBillionMail | Trendshift
## 在线演示 BillionMail 演示: [https://demo.billionmail.com/billionmail](https://demo.billionmail.com/billionmail) 用户名: `billionmail` 密码: `billionmail` ## 什么是 BillionMail? BillionMail 是一个**未来的开源邮件服务器和电子邮件营销平台**,旨在帮助企业和个人轻松管理他们的电子邮件营销活动。无论您是发送新闻通讯、促销邮件还是交易消息,这个工具都将为您的电子邮件营销工作提供**完全控制**。通过**高级分析**和**客户管理**等功能,您将能够像专业人士一样创建、发送和跟踪电子邮件。 ![BillionMail Banner](https://www.billionmail.com/home.png?v1) ## 如何使用? **安装脚本:** (✅该脚本会自动安装所有必需的运行环境,包括Docker) ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && bash install.sh ``` **使用Docker安装:** (请手动安装Docker和docker-compose-plugin,并修改.env文件) ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && cp env_init .env && docker compose up -d || docker-compose up -d ``` ## 管理脚本 - 管理帮助 `bm help` - 查看默认登录信息 `bm default` - 显示域名DNS记录 `bm show-record` - 更新BillionMail `bm update` ## 网页邮箱 BillionMail已集成**RoundCube**,您可以通过`/roundcube/`访问网页邮箱。 ## 为什么选择BillionMail? ### 大多数电子邮件营销平台要么**昂贵**,要么**闭源**,或者**缺乏基本功能**。BillionMail的目标是与众不同: ✅ **完全开源** – 没有隐藏成本,没有供应商锁定。 📊 **高级分析** – 跟踪电子邮件投递、打开率、点击率等。 📧 **无限发送** – 对您可以发送的电子邮件数量没有限制。 🎨 **可定制模板** – 可重复使用的专业营销模板。 🔒 **隐私优先** – 您的数据保留在您这里,没有第三方跟踪。 🚀 **自托管** – 在您自己的服务器上运行,完全控制。 ## 您如何提供帮助 🌟 BillionMail是一个**社区驱动的项目**,我们需要您的支持才能开始!以下是您可以提供帮助的方式: 1. **为此仓库加星标**:通过为此仓库加星表示您的兴趣。 2. **传播消息**:与您的网络分享BillionMail—开发者、营销人员和开源爱好者。 3. **分享反馈**:通过提出问题或加入讨论,让我们知道您希望在BillionMail中看到哪些功能。 4. **贡献**:一旦开发开始,我们将欢迎社区的贡献。敬请关注更新! --- 📧 **BillionMail – 开源电子邮件营销的未来。** ## 问题 如果您遇到任何问题或有功能请求,请[提交issue](https://github.com/aaPanel/BillionMail/issues)。请确保包括: - 问题或请求的清晰描述。 - 重现问题的步骤(如适用)。 - 截图或错误日志(如适用)。 ## 许可证 BillionMail根据**AGPLv3许可证**授权。这意味着您可以: ✅ 免费使用该软件。 ✅ 修改和分发代码。 ✅ 私下使用,没有限制。 有关更多详细信息,请参阅[LICENSE](LICENSE)文件。 [docs-link]: https://www.billionmail.com/ [license-link]: https://www.gnu.org/licenses/gpl-3.0.html [github-release-link]: https://github.com/aaPanel/BillionMail/releases/latest [github-stars-link]: https://github.com/aaPanel/BillionMail [github-issues-link]: https://github.com/aaPanel/BillionMail/issues [docs-shield]: https://img.shields.io/badge/documentation-148F76 [github-release-shield]: https://img.shields.io/github/v/release/aaPanel/BillionMail [github-stars-shield]: https://img.shields.io/github/stars/aaPanel/BillionMail?color=%231890FF&style=flat-square [license-shield]: https://img.shields.io/github/license/aaPanel/BillionMail ================================================ FILE: README.md ================================================

BillionMail 📧

## An Open-Source MailServer, NewsLetter, Email Marketing Solution for Smarter Campaigns [![][license-shield]][license-link] [![][docs-shield]][docs-link] [![][github-release-shield]][github-release-link] [![][github-stars-shield]][github-stars-link] English | [简体中文](README-zh_CN.md) | [日本語](README-ja.md) | [Türkçe](README-ja.md)

aaPanel%2FBillionMail | Trendshift
## What is BillionMail? BillionMail is a **future open-source Mail server, Email marketing platform** designed to help businesses and individuals manage their email campaigns with ease. Whether you're sending newsletters, promotional emails, or transactional messages, this tool will provide **full control** over your email marketing efforts. With features like **advanced analytics**, and **customer management**, you'll be able to create, send, and track emails like a pro. ![BillionMail Banner](https://www.billionmail.com/home.png?v1) # Just 3 steps to send a billion emails! **Billion emails. Any business. Guaranteed.** ### Step 1️⃣ Install BillionMail: ✅ It takes **only 8️⃣ minutes** from installation to **✅ successful email sending** ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && bash install.sh ``` ### Step 2️⃣: Connect Your Domain - Add the sending domain - Verify DNS records - Auto-enable free SSL ### Step 3️⃣: Build Your Campaign - Write or paste your email - Choose list & tags - Set send time or send now ## Other installation methods ### One-click installation on aaPanel 👉 https://www.aapanel.com/new/download.html (Log in to ✅aaPanel --> 🐳Docker --> 1️⃣OneClick install) **Docker** ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && cp env_init .env && docker compose up -d || docker-compose up -d ``` ## Management script - Management help `bm help` - View Login default info `bm default` - Show domain DNS record `bm show-record` - Update BillionMail `bm update` ## Live Demo BillionMail Demo: [https://demo.billionmail.com/billionmail](https://demo.billionmail.com/billionmail) Username: `billionmail` Password: `billionmail` ## WebMail BillionMail has integrated **RoundCube**, you can access WebMail via `/roundcube/`. ## Why BillionMail? Most email marketing platforms are either **expensive**, **closed-source**, or **lack essential features**. BillionMail aims to be different: ✅ **Fully Open-Source** – No hidden costs, no vendor lock-in. 📊 **Advanced Analytics** – Track email delivery, open rates, click-through rates, and more. 📧 **Unlimited Sending** – No restrictions on the number of emails you can send. 🎨 **Customizable Templates** – Custom professional marketing templates for reuse. 🔒 **Privacy-First** – Your data stays with you, no third-party tracking. 🚀 **Self-Hosted** – Run it on your own server for complete control. ## How You Can Help 🌟 BillionMail is a **community-driven project**, and we need your support to get started! Here's how you can help: 1. **Star This Repository**: Show your interest by starring this repo. 2. **Spread the Word**: Share BillionMail with your network—developers, marketers, and open-source enthusiasts. 3. **Share Feedback**: Let us know what features you'd like to see in BillionMail by opening an issue or joining the discussion. 4. **Contribute**: Once development begins, we'll welcome contributions from the community. Stay tuned for updates! --- 📧 **BillionMail – The Future of Open-Source Email Marketing.** ## Issues If you encounter any issues or have feature requests, please [open an issue](https://github.com/aaPanel/BillionMail/issues). Be sure to include: - A clear description of the problem or request. - Steps to reproduce the issue (if applicable). - Screenshots or error logs (if applicable). ## Install Now: ✅It takes **only 8 minutes** from installation to **successful email sending** ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && bash install.sh ``` **Install with Docker:** (Please install Docker and docker-compose-plugin manually, and modify .env file) ```shell cd /opt && git clone https://github.com/aaPanel/BillionMail && cd BillionMail && cp env_init .env && docker compose up -d || docker-compose up -d ``` ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=aapanel/billionmail&type=Date)](https://www.star-history.com/#aapanel/billionmail&Date) ## License BillionMail is licensed under the **AGPLv3 License**. This means you can: ✅ Use the software for free. ✅ Modify and distribute the code. ✅ Use it privately without restrictions. See the [LICENSE](LICENSE) file for more details. --- [docs-link]: https://www.billionmail.com/ [license-link]: https://www.gnu.org/licenses/agpl-3.0.html [github-release-link]: https://github.com/aaPanel/BillionMail/releases/latest [github-stars-link]: https://github.com/aaPanel/BillionMail [github-issues-link]: https://github.com/aaPanel/BillionMail/issues [docs-shield]: https://img.shields.io/badge/documentation-148F76 [github-release-shield]: https://img.shields.io/github/v/release/aaPanel/BillionMail [github-stars-shield]: https://img.shields.io/github/stars/aaPanel/BillionMail?color=%231890FF&style=flat-square    [license-shield]: https://img.shields.io/github/license/aaPanel/BillionMail ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Reporting a Vulnerability Please report security issues to `1249648969@qq.com` ================================================ FILE: bm.sh ================================================ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH # Add domain name and email CONTAINER_PROJECT_NAME=billionmail PGSQL_CONTAINER_NAME="${CONTAINER_PROJECT_NAME}-pgsql-billionmail-1" DOVECOT_CONTAINER_NAME="${CONTAINER_PROJECT_NAME}-dovecot-billionmail-1" POSTFIX_CONTAINER_NAME="${CONTAINER_PROJECT_NAME}-postfix-billionmail-1" RSPAMD_CONTAINER_NAME="${CONTAINER_PROJECT_NAME}-rspamd-billionmail-1" create_time=$(date +%s) time=$(date +%Y_%m_%d_%H_%M_%S) if [ $(whoami) != "root" ];then echo -e "Non-root install, please try the following solutions: \n 1.Please switch to root user install \n 2.Try executing the following install commands: \n sudo bash $0 $@" exit 1 fi PWD_d=`pwd` SWITCH_TO_BILLIONMAIL_DIR(){ if [ -f "/opt/PWD-Billion-Mail.txt" ]; then DIR=$(cat /opt/PWD-Billion-Mail.txt) if [ -d "${DIR}" ]; then cd "${DIR}" echo "Enter the BillionMail project directory: ${DIR}" fi fi } if [ -s ".env" ]; then CHECK_BILLIONMAIL=$(grep "BILLIONMAIL_HOSTNAME" .env) if [ -z "${CHECK_BILLIONMAIL}" ]; then SWITCH_TO_BILLIONMAIL_DIR fi else SWITCH_TO_BILLIONMAIL_DIR fi if [ ! -s ".env" ]; then ls -al echo " The .env file does not exist. Cannot continue operation, please operate in the BillionMail project directory" exit 1 fi source .env if [ -z "${DBUSER}" ] || [ -z "${DBNAME}" ] || [ -z "${DBPASS}" ]; then echo "The obtained .env configuration exception is empty." exit 1 fi Red_Error(){ echo '================================================='; printf '\033[1;31;40m%b\033[0m\n' "$@"; exit 1; } Command_Exists() { command -v "$@" >/dev/null 2>&1 } Docker_Compose_Check(){ if Command_Exists docker-compose ; then DOCKER_COMPOSE="docker-compose" else if Command_Exists docker; then Docker_compose="docker compose version" if $Docker_compose >/dev/null 2>&1; then DOCKER_COMPOSE="docker compose" fi else Red_Error "ERROR: Docker Compose does not exist" fi fi } Docker_Compose_Check GET_SERVICE_NAME() { # ALL_SERVICE_NAME=$(${DOCKER_COMPOSE} config --services |grep "${SERVICE}") # echo "${ALL_SERVICE_NAME}" if [[ "${SERVICE}" == "core" ]] || [[ "${SERVICE}" == "manage" ]]; then #echo "Getting the "${SERVICE}" service..." SERVICE_NAME=$(${DOCKER_COMPOSE} ps -a --format " {{.Service}} {{.ID}} {{.Image}}" |grep "/core:" | awk '{print $1}' ) elif [[ "${SERVICE}" == "postfix" ]] || [[ "${SERVICE}" == "postfix-billionmail" ]]; then SERVICE_NAME="postfix-billionmail" elif [[ "${SERVICE}" == "dovecot" ]] || [[ "${SERVICE}" == "dovecot-billionmail" ]]; then SERVICE_NAME="dovecot-billionmail" elif [[ "${SERVICE}" == "rspamd" ]] || [[ "${SERVICE}" == "rspamd-billionmail" ]]; then SERVICE_NAME="rspamd-billionmail" elif [[ "${SERVICE}" == "pgsql" ]] || [[ "${SERVICE}" == "postgres" ]] || [[ "${SERVICE}" == "pgsql-billionmail" ]]; then SERVICE_NAME="pgsql-billionmail" elif [[ "${SERVICE}" == "redis" ]] || [[ "${SERVICE}" == "redis-billionmail" ]]; then SERVICE_NAME="redis-billionmail" elif [[ "${SERVICE}" == "webmail" ]] || [[ "${SERVICE}" == "roundcube" ]] || [[ "${SERVICE}" == "webmail-billionmail" ]]; then SERVICE_NAME="webmail-billionmail" else echo "Please use: core|postfix|dovecot|rspamd|pgsql|redis|webmail" Red_Error "ERROR: The "${SERVICE}" service does not exist" fi if [ -z "${SERVICE_NAME}" ]; then Red_Error "ERROR: The "${SERVICE}" service does not exist" fi } GET_CONTAINER_ID() { if [ -z "${CONTAINER}" ]; then CONTAINER="$1" fi if [[ "${CONTAINER}" == "core" ]] || [[ "${CONTAINER}" == "manage" ]]; then CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "/core:" | awk '{print $1}' ) elif [[ ""${CONTAINER}"" == "postfix" ]] || [[ ""${CONTAINER}"" == "postfix-billionmail" ]]; then CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "/postfix:" | awk '{print $1}' ) elif [[ ""${CONTAINER}"" == "dovecot" ]] || [[ ""${CONTAINER}"" == "dovecot-billionmail" ]]; then CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "/dovecot:" | awk '{print $1}' ) elif [[ ""${CONTAINER}"" == "rspamd" ]] || [[ ""${CONTAINER}"" == "rspamd-billionmail" ]]; then CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "/rspamd:" | awk '{print $1}' ) elif [[ ""${CONTAINER}"" == "pgsql" ]] || [[ ""${CONTAINER}"" == "postgres" ]] || [[ ""${CONTAINER}"" == "pgsql-billionmail" ]]; then CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "postgres:" | awk '{print $1}' ) elif [[ ""${CONTAINER}"" == "redis" ]] || [[ ""${CONTAINER}"" == "redis-billionmail" ]]; then CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "redis:" | awk '{print $1}' ) elif [[ ""${CONTAINER}"" == "webmail" ]] || [[ ""${CONTAINER}"" == "roundcube" ]] || [[ ""${CONTAINER}"" == "webmail-billionmail" ]]; then CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "roundcubemail:" | awk '{print $1}' ) else echo "Please use: core|postfix|dovecot|rspamd|pgsql|redis|webmail" Red_Error "ERROR: The ""${CONTAINER}"" container does not exist" fi } Init_Email() { input="$2" # Regular expression verification email address format if [[ "$input" =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$ ]]; then mailbox=$(echo "$input" | cut -d '@' -f 1 | tr '[:upper:]' '[:lower:]') BILLIONMAIL_HOSTNAME=$(echo "$input" | cut -d '@' -f 2 | tr '[:upper:]' '[:lower:]') else echo "Enter an email address that is not a legal one: $input" echo "Example: user@example.com" exit 1 fi } Init_Domain() { BILLIONMAIL_HOSTNAME="$2" # Regular expression check domain name format # if [[ ! "${BILLIONMAIL_HOSTNAME}" =~ ^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9](\.[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])*$ ]]; then if [[ ! "${BILLIONMAIL_HOSTNAME}" =~ ^([a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$ ]]; then echo -e "\e[31m(${BILLIONMAIL_HOSTNAME}) is not a FQDN!\e[0m" echo "Please change it to a FQDN" exit 1 elif [[ "${BILLIONMAIL_HOSTNAME: -1}" == "." ]]; then echo "(${BILLIONMAIL_HOSTNAME}) is ending with a dot. This is not a valid FQDN!" exit 1 fi # Convert to lowercase BILLIONMAIL_HOSTNAME=$(echo "${BILLIONMAIL_HOSTNAME}" | tr '[:upper:]' '[:lower:]') } Domain_DKIM_record(){ if [ -z "${BILLIONMAIL_HOSTNAME}" ]; then echo "Please enter the domain name" exit 1 fi Check_domain=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT * FROM domain WHERE domain = '${BILLIONMAIL_HOSTNAME}';" | grep -w "^ ${BILLIONMAIL_HOSTNAME}") if [ -z "${Check_domain}" ]; then echo "Error: ${BILLIONMAIL_HOSTNAME} Domain does not exist." exit 1 fi ## DKIM key generation docker exec -i -e BILLIONMAIL_HOSTNAME=${BILLIONMAIL_HOSTNAME} ${RSPAMD_CONTAINER_NAME} bash -c 'cat << "EOF" > /tmp/1.sh #!/bin/bash if [ ! -d "/var/lib/rspamd/dkim/${BILLIONMAIL_HOSTNAME}/" ]; then mkdir -p "/var/lib/rspamd/dkim/${BILLIONMAIL_HOSTNAME}/" fi if [ -f "/var/lib/rspamd/dkim/${BILLIONMAIL_HOSTNAME}/default.private" ] && [ -f "/var/lib/rspamd/dkim/${BILLIONMAIL_HOSTNAME}/default.pub" ]; then #echo "DKIM key already exists, skipping generation." exit 0 fi rspamadm dkim_keygen -s 'default' -b 1024 -d {domain} -k "/var/lib/rspamd/dkim/${BILLIONMAIL_HOSTNAME}/default.private" > "/var/lib/rspamd/dkim/${BILLIONMAIL_HOSTNAME}/default.pub" if [ $? -eq 0 ]; then # Define the root directory for private keys DKIM_KEYS_DIR="/var/lib/rspamd/dkim" # Configuration file path CONFIG_FILE="/etc/rspamd/local.d/dkim_signing.conf" # Check if the configuration file exists, if not, create it if [ ! -f "${CONFIG_FILE}" ]; then touch "${CONFIG_FILE}" echo "${CONFIG_FILE}" echo "domain {" > "${CONFIG_FILE}" echo "#BT_DOMAIN_DKIM_BEGIN" >> "${CONFIG_FILE}" echo "#BT_DOMAIN_DKIM_END" >> "${CONFIG_FILE}" echo "}" >> "${CONFIG_FILE}" fi # Scan the DKIM_KEYS_DIR directory to get all domains DOMAINS=() for DOMAIN_DIR in "${DKIM_KEYS_DIR}"/*; do if [ -d "${DOMAIN_DIR}" ]; then DOMAIN_NAME=$(basename "${DOMAIN_DIR}") PRIVATE_KEY_PATH="${DOMAIN_DIR}/default.private" if [ -f "${PRIVATE_KEY_PATH}" ]; then DOMAINS+=("${DOMAIN_NAME}:${PRIVATE_KEY_PATH}") else echo "Warning: Private key file ${PRIVATE_KEY_PATH} for domain ${DOMAIN_NAME} does not exist, skipping configuration." fi fi done # Add domain configurations for DOMAIN in "${DOMAINS[@]}"; do DOMAIN_NAME=$(echo "${DOMAIN}" | cut -d':' -f1) PRIVATE_KEY_PATH=$(echo "${DOMAIN}" | cut -d':' -f2) # Check if the domain already exists if grep -wq "${DOMAIN_NAME}" "${CONFIG_FILE}"; then # echo "Domain ${DOMAIN_NAME} already exists, skipping configuration." continue fi # Insert domain configuration between #BT_DOMAIN_DKIM_BEGIN and #BT_DOMAIN_DKIM_END sed -i "/^#BT_DOMAIN_DKIM_BEGIN$/a #${DOMAIN_NAME}_DKIM_BEGIN\n ${DOMAIN_NAME} {\n selectors [\n {\n path: \"${PRIVATE_KEY_PATH}\";\n selector: \"default\"\n }\n ]\n }\n#${DOMAIN_NAME}_DKIM_END" "${CONFIG_FILE}" # echo "Domain ${DOMAIN_NAME} has been successfully added to the configuration file." done # echo "DKIM configuration update completed." else echo -e "DKIM key generation failed!" exit 1 fi chmod 755 -R "/var/lib/rspamd/dkim/${BILLIONMAIL_HOSTNAME}/" EOF' docker exec -i -e BILLIONMAIL_HOSTNAME=${BILLIONMAIL_HOSTNAME} ${RSPAMD_CONTAINER_NAME} bash /tmp/1.sh && rm -f /tmp/1.sh DKIM_RECORD=$(docker exec ${RSPAMD_CONTAINER_NAME} cat "/var/lib/rspamd/dkim/${BILLIONMAIL_HOSTNAME}/default.pub") # echo "DKIM RECORD: ${DKIM_RECORD}" } Domain_record() { Check_domain=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT * FROM domain WHERE domain = '${BILLIONMAIL_HOSTNAME}';" | grep -w "^ ${BILLIONMAIL_HOSTNAME}") if [ "${Check_domain}" ]; then IPV4_ADDRESS=$(curl -sS -4 --connect-timeout 10 -m 20 https://ifconfig.me) if [ -z "${IPV4_ADDRESS}" ]; then IPV4_ADDRESS=$(curl -sSk --connect-timeout 10 -m 20 https://www.aapanel.com/api/common/getClientIP) fi ipv4_regex="^([0-9]{1,3}\.){3}[0-9]{1,3}$" if [[ ${IPV4_ADDRESS} =~ ${ipv4_regex} ]]; then echo "${IPV4_ADDRESS}" >/dev/null 2>&1 elif [ -z "${IPV4_ADDRESS}" ]; then IPV4_ADDRESS="YOUR_SERVER_IPV4_ADDRESS" fi echo -e "" echo -e "\e[31mPlease add the following record to your domain name\e[0m" echo -e "===========================================================" echo -e " Type | Host record | IPv4 address |" echo -e " \e[1;33mA\e[0m | \e[1;33mmail.${BILLIONMAIL_HOSTNAME}\e[0m | \e[1;33m${IPV4_ADDRESS}\e[0m |" echo -e "===========================================================" echo -e " Type | Host record | MX priority | Record value " echo -e " \e[1;33mMX\e[0m | \e[1;33m@\e[0m | \e[1;33m10\e[0m | \e[1;33mmail.${BILLIONMAIL_HOSTNAME}\e[0m " echo -e "===========================================================" if [ "${IPV4_ADDRESS}" ]; then echo -e " Type | Host record | Record value |" echo -e " \e[1;33mTXT\e[0m | \e[1;33m@\e[0m | \e[1;33mv=spf1 +a +mx +ip4:${IPV4_ADDRESS} -all\e[0m |" else echo -e " Type | Host record | Record value |" echo -e " \e[1;33mTXT\e[0m | \e[1;33m@\e[0m | \e[1;33mv=spf1 +a +mx -all\e[0m |" fi echo -e "===========================================================" echo -e " Type | Host record | Record value |" echo -e " \e[1;33mTXT\e[0m | \e[1;33m_dmarc\e[0m | \e[1;33mv=DMARC1;p=quarantine;rua=mailto:admin@${BILLIONMAIL_HOSTNAME}\e[0m |" echo -e "===========================================================" Domain_DKIM_record if [ "${DKIM_RECORD}" ]; then DKIM_RECORD=$(echo "${DKIM_RECORD}" | awk -F'"' '{print $2 $4}' | tr -d '[:space:]') #echo "DKIM RECORD: ${DKIM_RECORD}" echo -e " Type | Host record | Record value |" echo -e " \e[1;33mTXT\e[0m | \e[1;33mdefault._domainkey\e[0m | \e[1;33m${DKIM_RECORD}\e[0m |<-- Start from \"v=DKIM1\" end, A single line." echo -e "===========================================================" else echo -e "${BILLIONMAIL_HOSTNAME} DKIM key generation failed!" fi else echo -e "Domain ${BILLIONMAIL_HOSTNAME} does not exist." fi } Select_Domain_data(){ # Check_domain=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT * FROM domain;") # echo "${Check_domain}" Check_domain=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT domain FROM domain;") echo "${Check_domain}" } Select_Email_data(){ Check_mailbox=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT username FROM mailbox;") echo "${Check_mailbox}" } Add_Domain() { echo "Creating domain..." Check_domain=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT * FROM domain WHERE domain = '${BILLIONMAIL_HOSTNAME}';" | grep -w "^ ${BILLIONMAIL_HOSTNAME}") if [ -z "${Check_domain}" ]; then # Create a domain docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "INSERT INTO domain (domain, a_record, mailboxes, mailbox_quota, quota, rate_limit, create_time, active) VALUES ('${BILLIONMAIL_HOSTNAME}', 'mail.${BILLIONMAIL_HOSTNAME}', 500, 5368709120, 5368709120, 12, ${create_time}, 1);" if [ $? -eq 0 ]; then echo "${BILLIONMAIL_HOSTNAME} Domain creation was successful!" Domain_record else Red_Error "Domain creation failed!" fi else echo ""${Check_domain}" Domain already exists!" fi } Del_Domain() { echo "Deleting domain..." Check_domain=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT * FROM domain WHERE domain = '${BILLIONMAIL_HOSTNAME}';" | grep -w "^ ${BILLIONMAIL_HOSTNAME}") if [ -z "${Check_domain}" ]; then echo "Domain '${BILLIONMAIL_HOSTNAME}' does not exist!" else # Delete the domain docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "DELETE FROM domain WHERE domain = '${BILLIONMAIL_HOSTNAME}';" if [ $? -eq 0 ]; then echo "Domain '${BILLIONMAIL_HOSTNAME}' deleted successfully!" else Red_Error "Failed to delete domain '${BILLIONMAIL_HOSTNAME}'!" fi fi } Add_Email() { echo "Creating mailbox..." Check_domain=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT * FROM domain WHERE domain = '${BILLIONMAIL_HOSTNAME}';" | grep -w "^ ${BILLIONMAIL_HOSTNAME}") if [ -z "${Check_domain}" ]; then Red_Error "Domain '${BILLIONMAIL_HOSTNAME}' does not exist, please create it first!" fi # Create a mailbox if [ -z "${mailbox}" ]; then mailbox=$(LC_ALL=C /dev/null | head -c 6) echo "Generate mailbox: ${mailbox}" else mailbox=$(echo "${mailbox}" | tr '[:upper:]' '[:lower:]') fi Generate_mailbox_password=$(LC_ALL=C /dev/null | head -c 16) #echo "Generate_mailbox_password: ${Generate_mailbox_password}" Encrypt_mailbox_password=$(docker exec -i ${DOVECOT_CONTAINER_NAME} doveadm pw -s MD5-CRYPT -p "${Generate_mailbox_password}" | sed 's/{MD5-CRYPT}//') if [ $? -eq 0 ]; then echo "Generate_mailbox_password: ${Generate_mailbox_password}" echo "mailbox_password: ${Encrypt_mailbox_password}" else # Generate the default password after failure: BILLIONMAIL Generate_mailbox_password="BILLIONMAIL" Encrypt_mailbox_password='$1$ELBUCcYE$TbdGKBvLkFbjQguDbi3s01' echo "Generate_mailbox_password--default: ${Generate_mailbox_password}" Default_password=1 fi if [ "${Default_password}" != 1 ]; then # password_encode # Base64 encoding of strings b64_data=$(echo -n "${Generate_mailbox_password}" | base64) # Convert characters to hexadecimal password_encode=$(echo -n "${b64_data}" | while IFS= read -r -n1 char; do printf "%02x" "'$char"; done) echo "password_encode: ${password_encode}" if [ -z ${password_encode} ]; then b64_data=$(echo -n "${Generate_mailbox_password}" | base64) password_encode=$(echo -n "${b64_data}" | od -A n -t x1 | tr -d ' \n') echo "password_encode: ${password_encode}" fi else password_encode="516b6c4d54456c50546b31425355773d" fi Check_mailbox=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT * FROM mailbox WHERE username = '${mailbox}@${BILLIONMAIL_HOSTNAME}';" | grep -w "${mailbox}@${BILLIONMAIL_HOSTNAME}") if [ -z "${Check_mailbox}" ]; then INSERT_mailbox='INSERT INTO mailbox (username, password, password_encode, full_name, is_admin, maildir, quota, local_part, domain, create_time, update_time, active) VALUES ( '\'${mailbox}@${BILLIONMAIL_HOSTNAME}\'', '\'${Encrypt_mailbox_password}\'', '\'${password_encode}\'', '\'${mailbox}\'', 0, '\'${mailbox}@${BILLIONMAIL_HOSTNAME}/\'', 5368709120, '\'${mailbox}\'', '\'${BILLIONMAIL_HOSTNAME}\'', '${create_time}', '${create_time}', 1 );' echo "$INSERT_mailbox" docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "$INSERT_mailbox" if [ $? -eq 0 ]; then echo "Mailbox creation was successful!" else Red_Error "Mailbox creation failed!" fi #docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT * FROM mailbox WHERE username = '${mailbox}@${BILLIONMAIL_HOSTNAME}';" else echo ""${Check_mailbox}" Mailbox already exists!" fi echo -e "\e[31mPlease save the following information:\e[0m" echo -e "Mailbox (e-mail): \e[33m${mailbox}@${BILLIONMAIL_HOSTNAME}\e[0m \nPassword: \e[33m${Generate_mailbox_password}\e[0m" } Del_Email() { echo "Deleting mailbox..." Check_mailbox=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT * FROM mailbox WHERE username = '${mailbox}@${BILLIONMAIL_HOSTNAME}';" | grep -w "${mailbox}@${BILLIONMAIL_HOSTNAME}") if [ -z "${Check_mailbox}" ]; then echo "Mailbox '${mailbox}@${BILLIONMAIL_HOSTNAME}' does not exist!" else docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "DELETE FROM mailbox WHERE username = '${mailbox}@${BILLIONMAIL_HOSTNAME}';" if [ $? -eq 0 ]; then echo "Mailbox '${mailbox}@${BILLIONMAIL_HOSTNAME}' deleted successfully!" else Red_Error "Failed to delete mailbox '${mailbox}@${BILLIONMAIL_HOSTNAME}'!" fi fi } Update_BillionMail() { BRANCH="main" if [ -f "update.sh" ]; then echo -e "Checking for update.sh script..." MD5_1="$(md5sum update.sh)" git fetch origin git checkout "origin/${BRANCH}" update.sh MD5_2=$(md5sum update.sh) if [[ "${MD5_1}" != "${MD5_2}" ]]; then #echo -e "\033[33m update.sh is changed, please run update.sh script again.\033[0m" chmod +x update.sh echo y | ./update.sh #exit 1 else chmod +x update.sh echo y | ./update.sh fi else Red_Error "Error: update.sh script does not exist!" fi } Default_info() { ipv4_address="" ipv6_address="" if [ "$address" = "" ];then ipv4_address=$(curl -4 -sSf --connect-timeout 10 -m 15 https://ifconfig.me 2>&1) if [ -z "${ipv4_address}" ];then ipv4_address=$(curl -4 -sSf --connect-timeout 10 -m 15 https://www.aapanel.com/api/common/getClientIP 2>&1) if [ -z "${ipv4_address}" ];then ipv4_address=$(curl -4 -sSf --connect-timeout 10 -m 15 https://www.bt.cn/Api/getIpAddress 2>&1) fi fi IPV4_REGEX="^([0-9]{1,3}\.){3}[0-9]{1,3}$" if ! [[ $ipv4_address =~ $IPV4_REGEX ]]; then ipv4_address="" fi ipv6_address=$(curl -6 -sSf --connect-timeout 10 -m 15 https://ifconfig.me 2>&1) IPV6_REGEX="^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$" if ! [[ $ipv6_address =~ $IPV6_REGEX ]]; then ipv6_address="" else if [[ ! $ipv6_address =~ ^\[ ]]; then ipv6_address="[$ipv6_address]" fi fi if [ "$address" = "" ] && [ "$ipv4_address" = "" ] && [ "$ipv6_address" = "" ];then address="SERVER_IP" echo -e "\033[33mFailed to obtain Internet IP, please use the server Internet IP+PORT to access.\033[0m" fi fi LOCAL_IP=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1) echo -e "==================================================================" echo -e "\033[32mBillionMail default info!\033[0m" echo -e "==================================================================" pool=https if [ -f "core-data/billionmail_hostname.txt" ];then BILLIONMAIL_Domain=$(cat core-data/billionmail_hostname.txt) if [ "${HTTPS_PORT}" = "443" ];then echo "BillionMail Domain Address: ${pool}://${BILLIONMAIL_Domain}/${SafePath}" else echo "BillionMail Domain Address: ${pool}://${BILLIONMAIL_Domain}:${HTTPS_PORT}/${SafePath}" fi fi if [ "${ipv6_address}" ];then if [ "${HTTPS_PORT}" = "443" ];then echo "BillionMail Internet IPv6 Address: ${pool}://${ipv6_address}/${SafePath}" else echo "BillionMail Internet IPv6 Address: ${pool}://${ipv6_address}:${HTTPS_PORT}/${SafePath}" fi fi if [ "${ipv4_address}" ];then if [ "${HTTPS_PORT}" = "443" ];then echo "BillionMail Internet IPv4 Address: ${pool}://${ipv4_address}/${SafePath}" else echo "BillionMail Internet IPv4 Address: ${pool}://${ipv4_address}:${HTTPS_PORT}/${SafePath}" fi fi if [ "${address}" ];then if [ "${HTTPS_PORT}" = "443" ];then echo "BillionMail Internet Address: ${pool}://${address}/${SafePath}" else echo "BillionMail Internet Address: ${pool}://${address}:${HTTPS_PORT}/${SafePath}" fi fi if [ "${HTTPS_PORT}" = "443" ];then echo "BillionMail Internal Address: ${pool}://${LOCAL_IP}/${SafePath}" else echo "BillionMail Internal Address: ${pool}://${LOCAL_IP}:${HTTPS_PORT}/${SafePath}" fi echo -e "Username: ${ADMIN_USERNAME} \nPassword: ${ADMIN_PASSWORD}" echo -e "\033[33mWarning:\033[0m" echo -e "\033[33mIf you cannot access the BillionMail, \033[0m" echo -e "\033[33mrelease the following port ${SMTP_PORT}|${SMTPS_PORT}|${SUBMISSION_PORT}|${POP_PORT}|${IMAP_PORT}|${IMAPS_PORT}|${POPS_PORT}|${HTTP_PORT}|${HTTPS_PORT} in the security group\033[0m" echo -e "==================================================================" } # Modify the apply SSL interface access port MODIFY_HTTP_SSL_PORT() { NEW_PORT="$2" if [ -z "${NEW_PORT}" ]; then echo -e "\033[31m Let's Encrypt SSL certificate can only be applied using port 80, other ports cannot be applied.\033[0m" read -p "Please enter the new apply SSL port: " NEW_PORT fi # Verify that the input is a number if ! echo "${NEW_PORT}" | grep -qE '^[0-9]+$' || ((NEW_PORT < 1 || NEW_PORT > 65535)); then echo -e "\033[31m Error: The port number must be a number between 1-65535 \033[0m" exit 1 fi Check_Port=$(ss -tlnp | grep -E ":(${NEW_PORT})\b") if [ ! -z "${Check_Port}" ]; then echo "${Check_Port}" echo -e "\033[31m Error: The ${NEW_PORT} port is already in use. \033[0m" exit 1 fi # Perform modification sed -i 's/^HTTP_PORT=.*/HTTP_PORT='"${NEW_PORT}"'/' .env echo -e "The BillionMail apply SSL port has been modified to: ${NEW_PORT} \n Rebuild the container, please wait..." sleep 3 # Find the container ID of the core image in the current project and rebuild the container # CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "/core:" | awk '{print $1}' ) CONTAINER="core" GET_CONTAINER_ID ${CONTAINER} if [ "${CONTAINER_ID}" ]; then echo "Rebuilding Manage Container..." docker stop ${CONTAINER_ID} docker rm -f ${CONTAINER_ID} ${DOCKER_COMPOSE} up -d else echo "The "core" container does not exist" echo "Starting BillionMail..." ${DOCKER_COMPOSE} up -d fi if [ -f "/usr/sbin/ufw" ]; then /usr/sbin/ufw allow ${NEW_PORT}/tcp >/dev/null 2>&1 /usr/sbin/ufw reload elif [ -f "/usr/sbin/firewall-cmd" ]; then /usr/sbin/firewall-cmd --permanent --zone=public --add-port=${NEW_PORT}/tcp >/dev/null 2>&1 /usr/sbin/firewall-cmd --reload elif [ -f "/etc/sysconfig/iptables" ]; then iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport ${NEW_PORT} -j ACCEPT service iptables save fi if [[ ${NEW_PORT} != "80" ]]; then echo -e "\033[31m Let's Encrypt SSL certificate can only be applied using port 80, other ports cannot be applied.\033[0m" fi } # Modify the management interface access port MODIFY_HTTPS_PORT() { NEW_PORT="$2" if [ -z "${NEW_PORT}" ]; then read -p "Please enter the new BillionMail management port: " NEW_PORT fi # Verify that the input is a number if ! echo "${NEW_PORT}" | grep -qE '^[0-9]+$' || ((NEW_PORT < 1 || NEW_PORT > 65535)); then echo -e "\033[31m Error: The port number must be a number between 1-65535 \033[0m" exit 1 fi Check_Port=$(ss -tlnp | grep -E ":(${NEW_PORT})\b") if [ ! -z "${Check_Port}" ]; then echo "${Check_Port}" echo -e "\033[31m Error: The ${NEW_PORT} port is already in use. \033[0m" exit 1 fi # Perform modification sed -i 's/^HTTPS_PORT=.*/HTTPS_PORT='"${NEW_PORT}"'/' .env if [ $? -ne 0 ]; then echo -e "\033[31m Error: The BillionMail management port modification failed! \033[0m" exit 1 fi echo -e "The BillionMail management port has been modified to: ${NEW_PORT} \n Rebuild the container, please wait..." sleep 3 # Find the container ID of the core image in the current project and rebuild the container # CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "/core:" | awk '{print $1}' ) CONTAINER="core" GET_CONTAINER_ID ${CONTAINER} if [ "${CONTAINER_ID}" ]; then echo "Rebuilding Manage Container..." docker stop ${CONTAINER_ID} docker rm -f ${CONTAINER_ID} ${DOCKER_COMPOSE} up -d else echo "The "core" container does not exist" echo "Starting BillionMail..." ${DOCKER_COMPOSE} up -d fi if [ -f "/usr/sbin/ufw" ]; then /usr/sbin/ufw allow ${NEW_PORT}/tcp >/dev/null 2>&1 /usr/sbin/ufw reload elif [ -f "/usr/sbin/firewall-cmd" ]; then /usr/sbin/firewall-cmd --permanent --zone=public --add-port=${NEW_PORT}/tcp >/dev/null 2>&1 /usr/sbin/firewall-cmd --reload elif [ -f "/etc/sysconfig/iptables" ]; then iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport ${NEW_PORT} -j ACCEPT service iptables save fi # Display login information bash bm.sh default } # Modify time zone MODIFY_TZ() { if [ -a /etc/timezone ]; then SYSTEM_TIME_ZONE=$(cat /etc/timezone) elif [ -a /etc/localtime ]; then SYSTEM_TIME_ZONE=$(readlink /etc/localtime|sed -n 's|^.*zoneinfo/||p') fi NEW_TZ="$2" echo -e "" echo -e "See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for a list of timezones" echo -e "Use a column named "TZ identifier" + note the column named "Notes"" echo -e "Please enter your time zone" echo -e "" if [ -z "${SYSTEM_TIME_ZONE}" ]; then read -p "Timezone: " -e NEW_TZ else read -p "Timezone [${SYSTEM_TIME_ZONE}]: " -e NEW_TZ [ -z "${NEW_TZ}" ] && NEW_TZ=${SYSTEM_TIME_ZONE} fi if [ -z "${NEW_TZ}" ]; then echo -e "\033[31m Error: Please enter the time zone \033[0m" exit 1 fi # Perform modification sed -i "s|^TZ=.*|TZ=${NEW_TZ}|" .env if [ $? -ne 0 ]; then echo -e "\033[31m Error: The BillionMail time zone modification failed! \033[0m" exit 1 fi if [ -f "postgresql-data/postgresql.conf" ]; then cp -arpf postgresql-data/postgresql.conf postgresql-data/postgresql.conf_${time} sed -i "s|^log_timezone = .*|log_timezone = \'${NEW_TZ}\'|" postgresql-data/postgresql.conf sed -i "s|^timezone = .*|timezone = \'${NEW_TZ}\'|" postgresql-data/postgresql.conf fi echo -e "The BillionMail time zone has been modified to: ${NEW_TZ} \n Rebuild the container, please wait..." sleep 3 ${DOCKER_COMPOSE} down ${DOCKER_COMPOSE} up -d } # Modify Admin Username MODIFY_ADMIN_USERNAME() { NEW_ADMIN="$2" if [ -z "${NEW_ADMIN}" ]; then read -p "Please enter the new BillionMail administrator username (minimum 5 characters): " NEW_ADMIN fi if [ -z "${NEW_ADMIN}" ]; then echo -e "\033[31mError: Administrator username is required!\033[0m" exit 1 fi if [ ${#NEW_ADMIN} -lt 5 ]; then echo -e "\033[31mError: Username must be at least 5 characters long!\033[0m" exit 1 fi if ! [[ "${NEW_ADMIN}" =~ ^[a-zA-Z0-9@#_.!+-]+$ ]]; then echo -e "\033[31mError: Username can only contain letters, numbers, symbols: @ # _ - + . !\033[0m" exit 1 fi # Perform modification sed -i "s|^ADMIN_USERNAME=.*|ADMIN_USERNAME="${NEW_ADMIN}"|" .env if [ $? -ne 0 ]; then echo -e "\033[31mError: Failed to update BillionMail administrator username!\033[0m" exit 1 fi echo -e "BillionMail administrator username has been updated. Restarting container, please wait..." sleep 3 # Find the container ID of the core image in the current project and rebuild the container # CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "/core:" | awk '{print $1}' ) CONTAINER="core" GET_CONTAINER_ID ${CONTAINER} if [ "${CONTAINER_ID}" ]; then echo "Restarting Manage Container..." docker restart ${CONTAINER_ID} else echo "The "core" container does not exist" echo "Starting BillionMail..." ${DOCKER_COMPOSE} up -d fi # Display login information bash bm.sh default } # Modify Admin Password MODIFY_ADMIN_PASSWORD() { NEW_PASSWORD="$2" if [ -z "${NEW_PASSWORD}" ]; then read -p "Please enter the new BillionMail administrator password (minimum 5 characters): " NEW_PASSWORD fi if [ -z "${NEW_PASSWORD}" ]; then echo -e "\033[31mError: Administrator password is required!\033[0m" exit 1 fi if [ ${#NEW_PASSWORD} -lt 5 ]; then echo -e "\033[31mError: Password must be at least 5 characters long!\033[0m" exit 1 fi if ! [[ "${NEW_PASSWORD}" =~ ^[a-zA-Z0-9@#_.!+-]+$ ]]; then echo -e "\033[31mError: Password can only contain letters, numbers, symbols: @ # _ - + . !\033[0m" exit 1 fi # Perform modification sed -i "s|^ADMIN_PASSWORD=.*|ADMIN_PASSWORD="${NEW_PASSWORD}"|" .env if [ $? -ne 0 ]; then echo -e "\033[31mError: Failed to update BillionMail administrator password!\033[0m" exit 1 fi echo -e "BillionMail administrator password has been updated. Restarting container, please wait..." sleep 3 # Find the container ID of the core image in the current project and rebuild the container #CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "/core:" | awk '{print $1}' ) CONTAINER="core" GET_CONTAINER_ID ${CONTAINER} if [ "${CONTAINER_ID}" ]; then echo "Restarting Manage Container..." docker restart ${CONTAINER_ID} else echo "The "core" container does not exist" echo "Starting BillionMail..." ${DOCKER_COMPOSE} up -d fi # Display login information bash bm.sh default } # Modify Safe entrance MODIFY_SAFE_ENTRANCE() { NEW_ENTRANCE="$2" if [ -z "${NEW_ENTRANCE}" ]; then read -p "Please enter the new BillionMail security entrance path (minimum 5 characters): " NEW_ENTRANCE fi if [ -z "${NEW_ENTRANCE}" ]; then echo -e "\033[31mError: Security entrance path is required!\033[0m" exit 1 fi if [ ${#NEW_ENTRANCE} -lt 5 ]; then echo -e "\033[31mError: Security entrance path must be at least 5 characters long!\033[0m" exit 1 fi if ! [[ "${NEW_ENTRANCE}" =~ ^[a-zA-Z0-9]+$ ]]; then echo -e "\033[31mError: Security entrance path can only contain letters and numbers!\033[0m" exit 1 fi # Perform modification sed -i "s|^SafePath=.*|SafePath=${NEW_ENTRANCE}|" .env if [ $? -ne 0 ]; then echo -e "\033[31mError: Failed to update BillionMail security entrance path!\033[0m" exit 1 fi echo -e "BillionMail security entrance path has been updated. Restarting container, please wait..." sleep 3 # Find the container ID of the core image in the current project and rebuild the container # CONTAINER_ID=$(${DOCKER_COMPOSE} ps -a --format "{{.ID}} {{.Image}}" |grep "/core:" | awk '{print $1}' ) CONTAINER="core" GET_CONTAINER_ID ${CONTAINER} if [ "${CONTAINER_ID}" ]; then echo "Restarting Manage Container..." docker restart ${CONTAINER_ID} else echo "The "core" container does not exist" echo "Starting BillionMail..." ${DOCKER_COMPOSE} up -d fi # Display login information bash bm.sh default } # Rebuild the BillionMail project REBUILD_PROJECT() { echo "Rebuilding BillionMail..." echo -e "\033[31mWarning: This operation will rebuild all containers, service will be unavailable during the rebuild process. \033[0m" read -p "Are you sure you want to continue? (yes/no): " NEW_REBUILD if [[ "$NEW_REBUILD" =~ ^(yes|y|Y)$ ]]; then sleep 3 ${DOCKER_COMPOSE} down ${DOCKER_COMPOSE} up -d echo "Rebuild completed." else echo "Rebuild cancel." fi } # Restart the BillionMail project RESTART_PROJECT() { echo "Restarting BillionMail..." sleep 1 ${DOCKER_COMPOSE} restart } # Stop the BillionMail project STOP_PROJECT() { echo "Stop BillionMail..." sleep 1 ${DOCKER_COMPOSE} stop } START_PROJECT() { echo "Start BillionMail..." sleep 1 ${DOCKER_COMPOSE} up -d } DOWN_PROJECT() { echo "Stop all BillionMail services and delete all BillionMail containers..." sleep 3 ${DOCKER_COMPOSE} down } # Restart the specified service RESTART_SERVICE() { SERVICE="$2" if [ -z "${SERVICE}" ]; then echo "" echo "Support input: postfix|core|dovecot|rspamd|redis|webmail|pgsql" read -p "Please enter service: " SERVICE fi GET_SERVICE_NAME ${SERVICE} echo "Restarting ${SERVICE} service..." sleep 3 ${DOCKER_COMPOSE} restart ${SERVICE_NAME} } RESTART_SERVICE_ADMIN() { SERVICE="core" GET_SERVICE_NAME ${SERVICE} echo "Restarting ${SERVICE} service..." sleep 3 ${DOCKER_COMPOSE} restart ${SERVICE_NAME} } # Get container log GET_CONTAINER_LOG() { CONTAINER="$2" if [ -z "${CONTAINER}" ]; then echo "" echo "Support input: postfix|core|dovecot|rspamd|redis|webmail|pgsql" read -p "Please enter container: " CONTAINER fi log_num="$3" follow="" if [ "$log_num" == "-f" ]; then follow="-f" log_num="$4" elif [ "$4" == "-f" ]; then follow="-f" fi if [[ "$log_num" =~ ^[0-9]+$ ]]; then log_num="${log_num}" else log_num=25 fi GET_CONTAINER_ID ${CONTAINER} if [ -z "${CONTAINER_ID}" ]; then Red_Error "ERROR: The "${CONTAINER}" container does not exist, Please execute '${DOCKER_COMPOSE} up -d' to start BillionMail" fi docker logs ${follow} --tail="${log_num}" ${CONTAINER_ID} } # Get file log GET_FILE_LOG() { NAME_FILE="$2" if [ -z "${NAME_FILE}" ]; then echo "" echo "Support input: postfix|core|core-access|core-error|dovecot|rspamd|fail2ban" read -p "Please enter name: " NAME_FILE fi log_num="$3" follow="" if [ "$log_num" == "-f" ]; then follow="-f" log_num="$4" elif [ "$4" == "-f" ]; then follow="-f" fi if [[ "$log_num" =~ ^[0-9]+$ ]]; then log_num="${log_num}" else log_num=25 fi # Define log files declare -A LOG_FILES=( ["core"]="$(date +%Y-%m-%d).log" ["core-access"]="access-$(date +%Y%m%d).log" ["core-error"]="error-$(date +%Y%m%d).log" ["postfix"]="mail.log" ["dovecot"]="mail.log" ["rspamd"]="rspamd.log" ["fail2ban"]="fail2ban.log" ) # Define log directory mapping declare -A LOG_DIRS=( ["core"]="core" ["core-access"]="core" ["core-error"]="core" ["postfix"]="postfix" ["dovecot"]="dovecot" ["rspamd"]="rspamd" ["fail2ban"]="fail2ban" ) # Check whether the service name is valid if [[ ! " ${!LOG_FILES[@]} " =~ " ${NAME_FILE} " ]]; then echo "How to use: $0 log_file core 100" Red_Error "Error: Invalid name. Please enter name: (postfix|core|core-access|core-error|dovecot|rspamd|fail2ban) " fi # Get log file name and directory LOG_FILE="${LOG_FILES[$NAME_FILE]}" LOG_DIR="${LOG_DIRS[$NAME_FILE]}" # Check and display log files if [ -f "logs/${LOG_DIR}/${LOG_FILE}" ]; then tail ${follow} -n ${log_num} "logs/${LOG_DIR}/${LOG_FILE}" elif [ -f "data/logs/${LOG_DIR}/${LOG_FILE}" ]; then tail ${follow} -n ${log_num} "data/logs/${LOG_DIR}/${LOG_FILE}" else Red_Error "logs file does not exist!" fi } # Get service TOP GET_SERVICE_TOP() { SERVICE="$2" if [ -z "${SERVICE}" ]; then read -p "Please enter service: " SERVICE fi GET_SERVICE_NAME ${SERVICE} ${DOCKER_COMPOSE} top ${SERVICE_NAME} } GET_SERVICE_TOP_ALL() { ${DOCKER_COMPOSE} top } GET_SERVICE_PS() { ${DOCKER_COMPOSE} ps } # Get containers status GET_CONTAINER_STATUS() { CONTAINERS=("core" "postfix" "dovecot" "rspamd" "pgsql" "redis" "webmail") for cc in "${CONTAINERS[@]}"; do CONTAINER="${cc}" GET_CONTAINER_ID "${CONTAINER}" status=$(docker inspect --format='{{.State.Status}}' "${CONTAINER_ID}" 2>/dev/null) if [ "$status" = "running" ]; then echo -e "\033[32m ${CONTAINER} container is running\033[0m" else echo -e "\033[31m ${CONTAINER} container is not running. Status: ${status} \033[0m" fi done } CLEAR_OLD_IMAGE() { # Remove only outdated versions of images defined in docker-compose.yml # Check if docker-compose.yml exists if [ ! -f "docker-compose.yml" ]; then Red_Error "Error: docker-compose.yml file not found" fi # Extract complete image names (including tags) defined in compose file # echo "Extracting billionmail images from docker-compose.yml..." # COMPOSE_IMAGES=$(grep -oP 'image:\s*\K[^"\s]+' docker-compose.yml | sort -u) COMPOSE_IMAGES=$(grep -oP 'image:\s*\K(?:billionmail|ghcr\.io/aapanel)[^"\s]+' docker-compose.yml | sort -u) # Check if any images were found if [ -z "${COMPOSE_IMAGES}" ]; then echo "Warning: No image definitions found in docker-compose.yml" exit 1 fi # Get all local Docker images (excluding images) # echo "Getting all local Docker images..." ALL_IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -v ":") # Find outdated images to remove IMAGES_TO_REMOVE="" while IFS= read -r compose_image; do # Extract image name (without tag) image_name=$(echo "${compose_image}" | awk -F: '{print $1}') # Extract tag defined in compose file compose_tag=$(echo "${compose_image}" | awk -F: '{print $2}') # Find all local images with the same name local_images=$(echo "${ALL_IMAGES}" | grep "^${image_name}:") # Filter images with different tags for local_image in ${local_images}; do local_tag=$(echo "${local_image}" | awk -F: '{print $2}') # If local tag differs from compose tag, add to removal list if [ "${local_tag}" != "${compose_tag}" ]; then IMAGES_TO_REMOVE="${IMAGES_TO_REMOVE} ${local_image}" fi done done <<< "${COMPOSE_IMAGES}" # Display results if [ -z "${IMAGES_TO_REMOVE}" ]; then echo "" echo "No outdated images found to remove" exit 0 fi echo -e "\n--- Outdated images to remove ---" echo "${IMAGES_TO_REMOVE}" | tr ' ' '\n' | grep -v '^$' IMAGE_COUNT=$(echo "${IMAGES_TO_REMOVE}" | wc -w) echo -e "\nTotal: ${IMAGE_COUNT} outdated images to remove" # Ask for confirmation read -p "Remove these outdated images? (y/n): " confirm if [ "${confirm}" = "y" ] || [ "${confirm}" = "Y" ]; then sleep 5 for image in ${IMAGES_TO_REMOVE}; do echo "Removing image: ${image}" docker rmi "${image}" || echo "Warning: Failed to remove ${image}" done echo "Outdated images removed successfully" echo -e "For deeper Docker system cleanup, ensure all containers to keep are running before executing:\n docker system prune" else echo "Operation cancelled" fi } # Turn off IP access whitelist restrictions CANCEL_IP_WHITELIST_LIMIT() { # Perform modification sed -i 's/^IP_WHITELIST_ENABLE=.*/IP_WHITELIST_ENABLE=false/' .env echo -e "The BillionMail IP access whitelist Restrictions: Closed \n Restart the container, please wait..." sleep 3 CONTAINER="core" GET_CONTAINER_ID ${CONTAINER} if [ "${CONTAINER_ID}" ]; then echo "Rebuilding Manage Container..." docker stop ${CONTAINER_ID} docker rm -f ${CONTAINER_ID} ${DOCKER_COMPOSE} up -d else echo "The "core" container does not exist" echo "Starting BillionMail..." ${DOCKER_COMPOSE} up -d fi } APPLY_MULTI_IP() { echo "🚀 Starting multi-IP configuration application..." # Initialize_Project echo "📁 Current directory: $PWD_d" PROJECT_DIR="$PWD_d" # Temporary backup path (under project root) BACKUP_COMPOSE="docker-compose.yml.bak.$(date +%Y%m%d-%H%M%S)" # 🔐 Load .env file ENV_FILE="./.env" if [ -f "$ENV_FILE" ]; then echo "🔐 Loading environment variables: $ENV_FILE" source "$ENV_FILE" if [ -z "${DBUSER}" ] || [ -z "${DBNAME}" ] || [ -z "${DBPASS}" ]; then Red_Error "❌ .env configuration error, database settings are empty" fi else Red_Error "❌ .env file not found: $ENV_FILE, please ensure configuration exists" fi # Database configuration DB_HOST="127.0.0.1" DB_PORT="25432" DB_NAME="${DBNAME}" DB_USER="${DBUSER}" DB_PASS="${DBPASS}" # Record initial state for rollback ORIGINAL_COMPOSE="docker-compose.yml" ADDNETWORK_COMPOSE="docker-compose_addnetwork.yml" # Create temporary file TEMP_FILE=$(mktemp) || { Red_Error "❌ Unable to create temporary file"; } # ============ Cleanup and rollback functions ============ cleanup_apply() { if [[ -n "$TEMP_FILE" && -f "$TEMP_FILE" ]]; then rm -f "$TEMP_FILE" fi } rollback_compose() { echo "⚠️ Error detected, rolling back docker-compose.yml..." if [[ -f "$BACKUP_COMPOSE" ]]; then cp "$BACKUP_COMPOSE" "$ORIGINAL_COMPOSE" echo "✅ Successfully rolled back to original configuration" else echo "❌ Backup file $BACKUP_COMPOSE does not exist, unable to rollback!" fi } # Set trap to handle exceptions and cleanup trap 'echo "💥 Script execution failed, triggering rollback"; rollback_compose; cleanup_apply; exit 1' ERR trap 'cleanup_apply' EXIT # ============ 1. Check if new compose file exists ============ echo "🔍 Checking if docker-compose_addnetwork.yml exists..." if [ ! -f "${ADDNETWORK_COMPOSE}" ]; then Red_Error "❌ Error: ${ADDNETWORK_COMPOSE} file does not exist, please verify" fi # ============ 2. Backup and replace docker-compose.yml ============ echo "🔄 Backing up and replacing docker-compose.yml" if [[ -f "$ORIGINAL_COMPOSE" ]]; then cp "$ORIGINAL_COMPOSE" "$BACKUP_COMPOSE" echo "✅ Backup created as: $BACKUP_COMPOSE" fi # Use cp instead of mv to keep original file for repeated execution cp "$ADDNETWORK_COMPOSE" "$ORIGINAL_COMPOSE" echo "✅ docker-compose.yml has been updated" # ============ 3. Insert domain → smtp_name mapping into bm_domain_smtp_transport ============ echo "🔄 Reading data from bm_multi_ip_domain and inserting into bm_domain_smtp_transport..." # Query database for domain and smtp_server_name using secure query method if ! docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -t -A -F'|' \ -c "SELECT domain, smtp_server_name FROM bm_multi_ip_domain WHERE active = 1;" > "$TEMP_FILE"; then Red_Error "❌ Database query failed, please check connection or table structure" fi # Check if temporary file has content if [[ ! -s "$TEMP_FILE" ]]; then echo "⚠️ No active multi-IP domain configurations found, skipping sender rule setup" else echo "📋 Found $(wc -l < "$TEMP_FILE") configuration records" # Safely process query results while IFS='|' read -r domain smtp_name; do # Clean whitespace and validate domain=$(echo "$domain" | xargs) smtp_name=$(echo "$smtp_name" | xargs) # Skip empty lines or invalid data [[ -z "$domain" || -z "$smtp_name" ]] && continue # Validate domain format (basic security check) if [[ ! "$domain" =~ ^[a-zA-Z0-9.-]+$ ]]; then echo "⚠️ Skipping invalid domain format: $domain" continue fi atype="dedicated_ip" domain_with_at="@${domain}" echo "🔍 Checking if sender rule exists for domain: $domain_with_at..." # Use secure SQL query escaped_domain=$(printf '%s\n' "$domain_with_at" | sed "s/'/''/g") EXISTS=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -t -A \ -c "SELECT 1 FROM bm_domain_smtp_transport WHERE domain = '$escaped_domain';") # If exists, delete it if [[ -n "$EXISTS" && "$EXISTS" != "" ]]; then echo "🟡 Sender rule already exists for domain: $domain_with_at, deleting..." if ! docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} \ -c "DELETE FROM bm_domain_smtp_transport WHERE domain = '$escaped_domain';"; then Red_Error "❌ Failed to delete old record: $domain_with_at" fi echo "✅ Old rule deleted: $domain_with_at" fi # Execute insertion (using secure string escaping) echo "📝 Inserting: $domain_with_at → $smtp_name" escaped_smtp=$(printf '%s\n' "$smtp_name" | sed "s/'/''/g") escaped_atype=$(printf '%s\n' "$atype" | sed "s/'/''/g") if ! docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} \ -c "INSERT INTO bm_domain_smtp_transport (atype, domain, smtp_name) VALUES ('$escaped_atype', '$escaped_domain', '$escaped_smtp');"; then Red_Error "❌ Insertion failed: $domain_with_at" fi echo "✅ Successfully inserted: $domain_with_at → $smtp_name" done < "$TEMP_FILE" echo "📝 All domain mappings have been successfully written to bm_domain_smtp_transport" fi # Update status of all records in bm_multi_ip_domain table to 'applied' echo "🔄 Resetting multi-IP domain status to 'applied'..." # First, query how many records need updating CURRENT_DOMAIN_COUNT=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -t -A \ -c "SELECT COUNT(*) FROM bm_multi_ip_domain WHERE status != 'applied';" 2>/dev/null || echo "0") echo "📊 Current number of domains needing status reset: ${CURRENT_DOMAIN_COUNT}" if [[ "${CURRENT_DOMAIN_COUNT}" -gt 0 ]]; then # Execute update operation if docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} \ -c "UPDATE bm_multi_ip_domain SET status = 'applied';" >/dev/null 2>&1; then echo "✅ Successfully reset ${CURRENT_DOMAIN_COUNT} multi-IP domain statuses to 'applied'" else echo "❌ Failed to reset multi-IP domain statuses" exit 1 fi else echo "✅ All multi-IP domain statuses are already 'applied'" fi # ============ 4. Restart services ============ echo "🔄 Restarting BillionMail services" if ! ${DOCKER_COMPOSE} down; then Red_Error "❌ docker-compose down failed" fi if ! ${DOCKER_COMPOSE} up -d; then Red_Error "❌ docker-compose up -d failed: docker-compose.yml has errors, please check" fi # Wait for services to start and check health status echo "🔄 Waiting for services to start..." sleep 5 echo "📊 Checking service status..." ${DOCKER_COMPOSE} ps # Check if critical services are running properly CORE_STATUS=$(${DOCKER_COMPOSE} ps core-billionmail --format "{{.State}}" 2>/dev/null || echo "missing") POSTFIX_STATUS=$(${DOCKER_COMPOSE} ps postfix-billionmail --format "{{.State}}" 2>/dev/null || echo "missing") if [[ "$CORE_STATUS" != "running" || "$POSTFIX_STATUS" != "running" ]]; then echo "⚠️ Warning: Some critical services may not have started properly" echo " Core status: $CORE_STATUS" echo " Postfix status: $POSTFIX_STATUS" echo "💡 Please check 'docker compose logs' for details" fi # ============ 5. Execution Summary ============ echo "" echo "🎉 =============== Execution Summary ===============" echo "✅ All operations completed! Services have been successfully restarted" echo "📁 Original configuration backed up as: $BACKUP_COMPOSE" echo "🔄 New configuration applied: $ORIGINAL_COMPOSE" echo "📋 Source configuration file preserved: $ADDNETWORK_COMPOSE" echo "🕐 Completion time: $(date '+%Y-%m-%d %H:%M:%S')" # Optional: Clean up old backups (keep latest 3) OLD_BACKUPS=$(find . -name 'docker-compose.yml.bak.*' -type f | wc -l) if [[ $OLD_BACKUPS -gt 3 ]]; then echo "🧹 Cleaning up old backup files (keeping latest 3)..." find . -name 'docker-compose.yml.bak.*' -type f | sort -r | tail -n +4 | xargs rm -f 2>/dev/null || true fi echo "=========================================" # Successfully completed, remove ERR trap trap - ERR } FIX_MULTI_IP() { echo "🔧 Starting multi-IP configuration fix..." # ============ Initialization: Automatically locate project root directory ============ # Initialize_Project # Load environment variables if [ ! -f ".env" ]; then Red_Error "❌ .env file not found, please ensure execution from project root directory" fi source .env if [ -z "${DBUSER}" ] || [ -z "${DBNAME}" ] || [ -z "${DBPASS}" ]; then Red_Error "❌ .env configuration error, database settings are empty" fi echo "📁 Project directory: ${PWD_d}" # ============ 1. Find the latest backup file ============ echo "🔍 Searching for the latest docker-compose.yml backup file..." LATEST_BACKUP=$(find . -name 'docker-compose.yml.bak.*' -type f | sort -r | head -n 1) if [ -z "${LATEST_BACKUP}" ]; then echo "⚠️ No docker-compose.yml backup file found" echo "📋 List of available backup files:" find . -name 'docker-compose.yml.bak.*' -type f 2>/dev/null || echo " No backup files" read -p "Proceed with database cleanup operation? (y/n): " continue_cleanup if [[ "$continue_cleanup" != "y" && "$continue_cleanup" != "Y" ]]; then echo "❌ Operation cancelled" exit 1 fi else echo "✅ Found latest backup: ${LATEST_BACKUP}" echo "🔄 Restoring docker-compose.yml..." # Create a backup of current file (in case rollback fails) cp docker-compose.yml "docker-compose.yml.before-fix.$(date +%Y%m%d-%H%M%S)" 2>/dev/null || true # Restore from backup if cp "${LATEST_BACKUP}" docker-compose.yml; then echo "✅ docker-compose.yml has been restored" else Red_Error "❌ Failed to restore docker-compose.yml" fi fi # ============ 2. Clean up multi-IP configurations in database ============ echo "🗄️ Starting database configuration cleanup..." # Check database connection (using container method) echo "🔗 Testing database connection..." if ! docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -c "SELECT 1;" >/dev/null 2>&1; then Red_Error "❌ Database connection failed, please check if service is running properly" fi echo "✅ Database connection is normal" # Delete records with atype="dedicated_ip" from bm_domain_smtp_transport table echo "🗑️ Deleting dedicated IP records from bm_domain_smtp_transport table..." # First, query the current number of records CURRENT_SMTP_COUNT=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -t -A \ -c "SELECT COUNT(*) FROM bm_domain_smtp_transport WHERE atype = 'dedicated_ip';" 2>/dev/null || echo "0") echo "📊 Current number of dedicated IP sender rules: ${CURRENT_SMTP_COUNT}" if [[ "${CURRENT_SMTP_COUNT}" -gt 0 ]]; then # Execute deletion if docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} \ -c "DELETE FROM bm_domain_smtp_transport WHERE atype = 'dedicated_ip';" >/dev/null 2>&1; then echo "✅ Deleted ${CURRENT_SMTP_COUNT} dedicated IP sender rules" else echo "❌ Failed to delete dedicated IP sender rules" exit 1 fi else echo "✅ No dedicated IP sender rules found to delete" fi # Update status of all records in bm_multi_ip_domain table to 'pending' echo "🔄 Resetting multi-IP domain status to 'pending'..." # First, query the current number of records needing update CURRENT_DOMAIN_COUNT=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -t -A \ -c "SELECT COUNT(*) FROM bm_multi_ip_domain WHERE status != 'pending';" 2>/dev/null || echo "0") echo "📊 Current number of domains needing status reset: ${CURRENT_DOMAIN_COUNT}" if [[ "${CURRENT_DOMAIN_COUNT}" -gt 0 ]]; then # Execute update operation if docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} \ -c "UPDATE bm_multi_ip_domain SET status = 'pending';" >/dev/null 2>&1; then echo "✅ Reset ${CURRENT_DOMAIN_COUNT} multi-IP domain statuses to 'pending'" else echo "❌ Failed to reset multi-IP domain statuses" exit 1 fi else echo "✅ All multi-IP domain statuses are already 'pending'" fi # ============ 3. Verify cleanup results ============ echo "🔍 Verifying cleanup results..." # Verify dedicated IP sender rules have been cleaned REMAINING_SMTP_COUNT=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -t -A \ -c "SELECT COUNT(*) FROM bm_domain_smtp_transport WHERE atype = 'dedicated_ip';" 2>/dev/null || echo "unknown") # Verify multi-IP domain statuses have been reset REMAINING_APPLIED_COUNT=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -t -A \ -c "SELECT COUNT(*) FROM bm_multi_ip_domain WHERE status = 'applied';" 2>/dev/null || echo "unknown") echo "📊 Verification results:" echo " Remaining dedicated IP sender rules: ${REMAINING_SMTP_COUNT}" echo " Remaining applied status domains: ${REMAINING_APPLIED_COUNT}" # ============ 4. Restart services ============ echo "🔄 Restarting BillionMail services..." echo "🛑 Stopping services..." if ! ${DOCKER_COMPOSE} down; then echo "⚠️ Warning during service stop, continuing execution..." fi echo "🚀 Starting services..." if ! ${DOCKER_COMPOSE} up -d; then Red_Error "❌ Failed to start services, please check docker-compose.yml configuration" fi # Wait for services to start echo "⏳ Waiting for services to start..." sleep 5 # Check service status echo "📊 Checking service status..." ${DOCKER_COMPOSE} ps # ============ 5. Final verification ============ echo "🔍 Final verification of database status..." sleep 2 # Final verification of dedicated IP sender rules FINAL_SMTP_COUNT=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -t -A \ -c "SELECT COUNT(*) FROM bm_domain_smtp_transport WHERE atype = 'dedicated_ip';" 2>/dev/null || echo "unknown") # Final verification of multi-IP domain statuses FINAL_APPLIED_COUNT=$(docker exec -i -e PGPASSWORD=${DBPASS} ${PGSQL_CONTAINER_NAME} psql -U ${DBUSER} -d ${DBNAME} -t -A \ -c "SELECT COUNT(*) FROM bm_multi_ip_domain WHERE status = 'applied';" 2>/dev/null || echo "unknown") # ============ 6. Execution Summary ============ echo "" echo "🎉 =============== Fix Summary ===============" echo "✅ Multi-IP configuration fix completed!" if [ -n "${LATEST_BACKUP}" ]; then echo "📁 Restored backup: ${LATEST_BACKUP} → docker-compose.yml" fi echo "🗑️ Dedicated IP sender rule cleanup result: ${CURRENT_SMTP_COUNT} → ${FINAL_SMTP_COUNT}" echo "🔄 applied status domain reset result: ${CURRENT_DOMAIN_COUNT} → ${FINAL_APPLIED_COUNT}" echo "🚀 Services restarted" echo "🕐 Completion time: $(date '+%Y-%m-%d %H:%M:%S')" echo "=========================================" # Provide detailed verification information if [[ "${FINAL_SMTP_COUNT}" == "0" && "${FINAL_APPLIED_COUNT}" == "0" ]]; then echo "" echo "🎉 Congratulations! Database cleanup completed successfully:" echo " ✅ All dedicated IP sender rules have been deleted" echo " ✅ All multi-IP domain statuses have been reset to pending" else echo "" echo "⚠️ Note: Some data may not have been fully cleaned:" if [[ "${FINAL_SMTP_COUNT}" != "0" ]]; then echo " ❌ Still ${FINAL_SMTP_COUNT} dedicated IP sender rules remaining" fi if [[ "${FINAL_APPLIED_COUNT}" != "0" ]]; then echo " ❌ Still ${FINAL_APPLIED_COUNT} domains with applied status" fi echo " 💡 Suggest manually checking the database or re-running the fix command" fi echo "" echo "💡 Tips:" echo " 1. To reconfigure multi-IP, please re-run: bm.sh multi_ip" echo " 2. Suggest checking email sending functionality" echo " 3. If issues occur, check container logs: bm.sh l-c core" } SHOW_HELP() { echo "Help Information:" echo " default - Show BillionMail login default info: $0 default" echo " update - Update BillionMail: $0 update" echo " change-port - Modify BillionMail access management port: $0 change-port" echo " change-tz - Modify BillionMail time zone: $0 change-tz" echo " change-user - Modify BillionMail Administrator user: $0 change-user" echo " change-password - Modify BillionMail Administrator password: $0 change-password" echo " change-safe-path - Modify BillionMail security entrance path: $0 change-safe-path" echo " change-apply-ssl-port - Modify BillionMail apply ssl port: $0 change-apply-ssl-port" echo " start - Start BillionMail: $0 start" echo " stop - Stop BillionMail: $0 stop" echo " restart - Restart BillionMail: $0 restart" echo " status - Show BillionMail containers running status : $0 status" echo " down - Stop and remove containers, networks: $0 down" echo " rebuild - Rebuild all BillionMail containers: $0 rebuild" echo " top - Show all BillionMail processes: $0 top" echo " ps - Show all BillionMail containers: $0 ps" echo " service-top - Show processes of a specific BillionMail service: $0 s-t postfix" echo " log-file - View logs of a specific service: $0 l-f postfix" echo " log-container - View logs of a specific container: $0 l-c postfix" echo " restart-service - Restart a specific service and its container: $0 r-s postfix" echo " clear - Clear BillionMail old images: $0 clear" echo " cancel-ip-limit - Cancel IP access limit : $0 c-i-l" # echo " add-domain - Add domain. Example: $0 add-domain example.com" # echo " del-domain - Delete domain. Example: $0 del-domain example.com" # echo " add-email - Add email. Example: $0 add-email user@example.com" # echo " del-email - Delete email. Example: $0 del-email user@example.com" echo " show-domain - Show domain data." echo " show-email - Show email data." # echo " show-record - Show domain DNS record." exit } case "$1" in h | -h | help | --help | -help) SHOW_HELP ;; default | info) Default_info ;; update) Update_BillionMail ;; add-domain) Init_Domain "$@" Add_Domain ;; del-domain) Init_Domain "$@" Del_Domain ;; add-email) Init_Email "$@" Add_Email ;; del-email) Init_Email "$@" Del_Email ;; show-domain) Select_Domain_data ;; show-email) Select_Email_data ;; show-record|show_dns_record) Init_Domain "$@" Domain_record ;; MODIFY_HTTP_PORT|modify_http_port|change-apply-ssl-port) MODIFY_HTTP_SSL_PORT ;; MODIFY_HTTPS_PORT|modify_https_port|change-port) MODIFY_HTTPS_PORT ;; MODIFY_TZ|modify_tz|change-tz) MODIFY_TZ ;; MODIFY_ADMIN_USERNAME|modify_user|change-user) MODIFY_ADMIN_USERNAME ;; MODIFY_ADMIN_PASSWORD|modify_password|change-password) MODIFY_ADMIN_PASSWORD ;; MODIFY_SAFE_ENTRANCE|modify_safe_path|change-safe-path) MODIFY_SAFE_ENTRANCE ;; REBUILD_PROJECT|rebuild_project|rebuild) REBUILD_PROJECT ;; RESTART_PROJECT|restart_project|restart) RESTART_PROJECT ;; START_PROJECT|start_project|start) START_PROJECT ;; STOP_PROJECT|stop_project|stop) STOP_PROJECT ;; GET_CONTAINER_STATUS|get_container_status|status) GET_CONTAINER_STATUS ;; DOWN_PROJECT|down_project|down) DOWN_PROJECT ;; RESTART_SERVICE|restart_service|restart-service|r-s) RESTART_SERVICE "$@" ;; GET_CONTAINER_LOG|log_container|log-container|l-c) GET_CONTAINER_LOG "$@" ;; GET_FILE_LOG|log_file|log-file|l-f) GET_FILE_LOG "$@" ;; GET_SERVICE_TOP|service_top|service-top|s-t) GET_SERVICE_TOP "$@" ;; GET_SERVICE_TOP_ALL|service_top_all|service-top-all|top) GET_SERVICE_TOP_ALL ;; GET_SERVICE_PS|service-ps|ps) GET_SERVICE_PS ;; RESTART_SERVICE_ADMIN|restart_service_admin|restart-service-admin|restart-admin) RESTART_SERVICE_ADMIN ;; clear) CLEAR_OLD_IMAGE ;; cancel-ip-limit|c-i-l) CANCEL_IP_WHITELIST_LIMIT ;; Domain_multi_send_IP|apply_multi_ip|multi_ip) APPLY_MULTI_IP ;; fix_multi_ip|fix-multi-ip) FIX_MULTI_IP ;; *) echo "=============== BillionMail CLI ==================" echo "1) Restart BillionMail 2) View login info" echo "" echo "3) View running status 4) Stop BillionMail" echo "" echo "5) Start BillionMail 6) Restart manage only (mail unaffected)" echo "" echo "7) Change manage password 8) Change manage username" echo "" echo "9) Change secure entry 10) Change manage access port" echo "" echo "11) View all processes 12) Update BillionMail" echo "" echo "13) Cancel IP access limit " echo "" echo "0) Exit For more commands: help" echo "==================================================" read -p "Enter number to execute command [0-12]: " input case ${input} in 1) RESTART_PROJECT ;; 2) Default_info ;; 3) GET_CONTAINER_STATUS ;; 4) STOP_PROJECT ;; 5) START_PROJECT ;; 6) RESTART_SERVICE_ADMIN ;; 7) MODIFY_ADMIN_PASSWORD ;; 8) MODIFY_ADMIN_USERNAME ;; 9) MODIFY_SAFE_ENTRANCE ;; 10) MODIFY_HTTPS_PORT ;; 11) GET_SERVICE_TOP_ALL ;; 12) Update_BillionMail ;; 13) CANCEL_IP_WHITELIST_LIMIT ;; help) SHOW_HELP ;; 0 | * ) echo "Cancelled!" exit ;; esac ;; esac ================================================ FILE: conf/core/fail2ban_init/filter.d/core-limit-filter.conf ================================================ [Definition] failregex = ^.*? \d+ "(GET|POST|HEAD|PUT|DELETE|PATCH|OPTIONS|CONNECT|TRACE) (http|https) [^ ]+ \S+ HTTP.*" .*, , ".*?", ".*?"$ ignoreregex = .*/roundcube.* ================================================ FILE: conf/core/fail2ban_init/filter.d/roundcube-limit-filter.conf ================================================ [Definition] # Only match roundcube logs failregex = ^.*? \d+ "(GET|POST|HEAD|PUT|DELETE|PATCH|OPTIONS|CONNECT|TRACE) (http|https) [^ ]+ /roundcube(?:[/?][^ \"]*)? HTTP.*" .*, , ".*?", ".*?"$ # Exclude static resource interference ignoreregex = ^.* /roundcube/(?:skins|plugins|assets|images)/ ================================================ FILE: conf/core/fail2ban_init/jail.d/core-accesslimit.conf ================================================ [core-accesslimit] ignoreip = 127.0.0.1/8 enabled = true port = 80,443 filter = core-limit-filter logpath = /opt/billionmail/core/logs/access-*.log maxretry = 1000 findtime = 60 bantime = 60 action = %(action_)s ================================================ FILE: conf/core/fail2ban_init/jail.d/roundcube-accesslimit.conf ================================================ [roundcube-accesslimit] ignoreip = 127.0.0.1/8 enabled = true port = 80,443 filter = roundcube-limit-filter logpath = /opt/billionmail/core/logs/access-*.log maxretry = 600 findtime = 60 bantime = 60 action = %(action_)s ================================================ FILE: conf/dovecot/conf.d/10-auth.conf ================================================ ## ## Authentication processes ## # Disable LOGIN command and all other plaintext authentications unless # SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP # matches the local IP (ie. you're connecting from the same computer), the # connection is considered secure and plaintext authentication is allowed. # See also ssl=required setting. disable_plaintext_auth = no # Authentication cache size (e.g. 10M). 0 means it's disabled. Note that # bsdauth, PAM and vpopmail require cache_key to be set for caching to be used. #auth_cache_size = 0 # Time to live for cached data. After TTL expires the cached record is no # longer used, *except* if the main database lookup returns internal failure. # We also try to handle password changes automatically: If user's previous # authentication was successful, but this one wasn't, the cache isn't used. # For now this works only with plaintext authentication. #auth_cache_ttl = 1 hour # TTL for negative hits (user not found, password mismatch). # 0 disables caching them completely. #auth_cache_negative_ttl = 1 hour # Space separated list of realms for SASL authentication mechanisms that need # them. You can leave it empty if you don't want to support multiple realms. # Many clients simply use the first one listed here, so keep the default realm # first. #auth_realms = # Default realm/domain to use if none was specified. This is used for both # SASL realms and appending @domain to username in plaintext logins. #auth_default_realm = # List of allowed characters in username. If the user-given username contains # a character not listed in here, the login automatically fails. This is just # an extra check to make sure user can't exploit any potential quote escaping # vulnerabilities with SQL/LDAP databases. If you want to allow all characters, # set this value to empty. #auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@ # Username character translations before it's looked up from databases. The # value contains series of from -> to characters. For example "#@/@" means # that '#' and '/' characters are translated to '@'. #auth_username_translation = # Username formatting before it's looked up from databases. You can use # the standard variables here, eg. %Lu would lowercase the username, %n would # drop away the domain if it was given, or "%n-AT-%d" would change the '@' into # "-AT-". This translation is done after auth_username_translation changes. #auth_username_format = %Lu # If you want to allow master users to log in by specifying the master # username within the normal username string (ie. not using SASL mechanism's # support for it), you can specify the separator character here. The format # is then . UW-IMAP uses "*" as the # separator, so that could be a good choice. #auth_master_user_separator = # Username to use for users logging in with ANONYMOUS SASL mechanism #auth_anonymous_username = anonymous # Maximum number of dovecot-auth worker processes. They're used to execute # blocking passdb and userdb queries (eg. MySQL and PAM). They're # automatically created and destroyed as needed. #auth_worker_max_count = 30 # Host name to use in GSSAPI principal names. The default is to use the # name returned by gethostname(). Use "$ALL" (with quotes) to allow all keytab # entries. #auth_gssapi_hostname = # Kerberos keytab to use for the GSSAPI mechanism. Will use the system # default (usually /etc/krb5.keytab) if not specified. You may need to change # the auth service to run as root to be able to read this file. #auth_krb5_keytab = # Do NTLM and GSS-SPNEGO authentication using Samba's winbind daemon and # ntlm_auth helper. #auth_use_winbind = no # Path for Samba's ntlm_auth helper binary. #auth_winbind_helper_path = /usr/bin/ntlm_auth # Time to delay before replying to failed authentications. #auth_failure_delay = 2 secs # Require a valid SSL client certificate or the authentication fails. #auth_ssl_require_client_cert = no # Take the username from client's SSL certificate, using # X509_NAME_get_text_by_NID() which returns the subject's DN's # CommonName. #auth_ssl_username_from_cert = no # Space separated list of wanted authentication mechanisms: # plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey # gss-spnego # NOTE: See also disable_plaintext_auth setting. auth_mechanisms = plain login ## ## Password and user databases ## # # Password database is used to verify user's password (and nothing more). # You can have multiple passdbs and userdbs. This is useful if you want to # allow both system users (/etc/passwd) and virtual users to login without # duplicating the system users into virtual database. # # # # User database specifies where mails are located and what user/group IDs # own them. For single-UID configuration use "static" userdb. # # #!include auth-deny.conf.ext #!include auth-master.conf.ext #!include auth-system.conf.ext !include auth-sql.conf.ext #!include auth-ldap.conf.ext #!include auth-passwdfile.conf.ext #!include auth-checkpassword.conf.ext #!include auth-vpopmail.conf.ext #!include auth-static.conf.ext ================================================ FILE: conf/dovecot/conf.d/10-director.conf ================================================ ## ## Director-specific settings. ## # Director can be used by Dovecot proxy to keep a temporary user -> mail server # mapping. As long as user has simultaneous connections, the user is always # redirected to the same server. Each proxy server is running its own director # process, and the directors are communicating the state to each others. # Directors are mainly useful with NFS-like setups. # List of IPs or hostnames to all director servers, including ourself. # Ports can be specified as ip:port. The default port is the same as # what director service's inet_listener is using. #director_servers = # List of IPs or hostnames to all backend mail servers. Ranges are allowed # too, like 10.0.0.10-10.0.0.30. #director_mail_servers = # How long to redirect users to a specific server after it no longer has # any connections. #director_user_expire = 15 min # How the username is translated before being hashed. Useful values include # %Ln if user can log in with or without @domain, %Ld if mailboxes are shared # within domain. #director_username_hash = %Lu # To enable director service, uncomment the modes and assign a port. service director { unix_listener login/director { #mode = 0666 } fifo_listener login/proxy-notify { #mode = 0666 } unix_listener director-userdb { #mode = 0600 } inet_listener { #port = } } # Enable director for the wanted login services by telling them to # connect to director socket instead of the default login socket: service imap-login { #executable = imap-login director } service pop3-login { #executable = pop3-login director } service submission-login { #executable = submission-login director } # Enable director for LMTP proxying: protocol lmtp { #auth_socket_path = director-userdb } ================================================ FILE: conf/dovecot/conf.d/10-logging.conf ================================================ ## ## Log destination. ## # Log file to use for error messages. "syslog" logs to syslog, # /dev/stderr logs to stderr. #log_path = syslog # Log file to use for informational messages. Defaults to log_path. #info_log_path = # Log file to use for debug messages. Defaults to info_log_path. #debug_log_path = # Syslog facility to use if you're logging to syslog. Usually if you don't # want to use "mail", you'll use local0..local7. Also other standard # facilities are supported. #syslog_facility = mail ## ## Logging verbosity and debugging. ## # Log filter is a space-separated list conditions. If any of the conditions # match, the log filter matches (i.e. they're ORed together). Parenthesis # are supported if multiple conditions need to be matched together. # # See https://doc.dovecot.org/configuration_manual/event_filter/ for details. # # For example: event=http_request_* AND category=error AND category=storage # # Filter to specify what debug logging to enable. This will eventually replace # mail_debug and auth_debug settings. #log_debug = # Crash after logging a matching event. For example category=error will crash # any time an error is logged, which can be useful for debugging. #log_core_filter = # Log unsuccessful authentication attempts and the reasons why they failed. #auth_verbose = no # In case of password mismatches, log the attempted password. Valid values are # no, plain and sha1. sha1 can be useful for detecting brute force password # attempts vs. user simply trying the same password over and over again. # You can also truncate the value to n chars by appending ":n" (e.g. sha1:6). #auth_verbose_passwords = no # Even more verbose logging for debugging purposes. Shows for example SQL # queries. #auth_debug = no # In case of password mismatches, log the passwords and used scheme so the # problem can be debugged. Enabling this also enables auth_debug. #auth_debug_passwords = no # Enable mail process debugging. This can help you figure out why Dovecot # isn't finding your mails. #mail_debug = no # Show protocol level SSL errors. #verbose_ssl = no # mail_log plugin provides more event logging for mail processes. plugin { # Events to log. Also available: flag_change append #mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename # Available fields: uid, box, msgid, from, subject, size, vsize, flags # size and vsize are available only for expunge and copy events. #mail_log_fields = uid box msgid size } ## ## Log formatting. ## # Prefix for each line written to log file. % codes are in strftime(3) # format. #log_timestamp = "%b %d %H:%M:%S " # Space-separated list of elements we want to log. The elements which have # a non-empty variable value are joined together to form a comma-separated # string. #login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c # Login log format. %s contains login_log_format_elements string, %$ contains # the data we want to log. #login_log_format = %$: %s # Log prefix for mail processes. See doc/wiki/Variables.txt for list of # possible variables you can use. #mail_log_prefix = "%s(%u)<%{pid}><%{session}>: " # Format to use for logging mail deliveries: # %$ - Delivery status message (e.g. "saved to INBOX") # %m / %{msgid} - Message-ID # %s / %{subject} - Subject # %f / %{from} - From address # %p / %{size} - Physical size # %w / %{vsize} - Virtual size # %e / %{from_envelope} - MAIL FROM envelope # %{to_envelope} - RCPT TO envelope # %{delivery_time} - How many milliseconds it took to deliver the mail # %{session_time} - How long LMTP session took, not including delivery_time # %{storage_id} - Backend-specific ID for mail, e.g. Maildir filename #deliver_log_format = msgid=%m: %$ ================================================ FILE: conf/dovecot/conf.d/10-mail.conf ================================================ ## ## Mailbox locations and namespaces ## # Location for users' mailboxes. The default is empty, which means that Dovecot # tries to find the mailboxes automatically. This won't work if the user # doesn't yet have any mail, so you should explicitly tell Dovecot the full # location. # # If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u) # isn't enough. You'll also need to tell Dovecot where the other mailboxes are # kept. This is called the "root mail directory", and it must be the first # path given in the mail_location setting. # # There are a few special variables you can use, eg.: # # %u - username # %n - user part in user@domain, same as %u if there's no domain # %d - domain part in user@domain, empty if there's no domain # %h - home directory # # See doc/wiki/Variables.txt for full list. Some examples: # # mail_location = maildir:~/Maildir # mail_location = mbox:~/mail:INBOX=/var/mail/%u # mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n # # # mail_location = maildir:/var/vmail/%d/%n # If you need to set multiple mailbox locations or want to change default # namespace settings, you can do it by defining namespace sections. # # You can have private, shared and public namespaces. Private namespaces # are for user's personal mails. Shared namespaces are for accessing other # users' mailboxes that have been shared. Public namespaces are for shared # mailboxes that are managed by sysadmin. If you create any shared or public # namespaces you'll typically want to enable ACL plugin also, otherwise all # users can access all the shared mailboxes, assuming they have permissions # on filesystem level to do so. namespace inbox { # Namespace type: private, shared or public #type = private # Hierarchy separator to use. You should use the same separator for all # namespaces or some clients get confused. '/' is usually a good one. # The default however depends on the underlying mail storage format. #separator = # Prefix required to access this namespace. This needs to be different for # all namespaces. For example "Public/". #prefix = # Physical location of the mailbox. This is in same format as # mail_location, which is also the default for it. #location = # There can be only one INBOX, and this setting defines which namespace # has it. inbox = yes # If namespace is hidden, it's not advertised to clients via NAMESPACE # extension. You'll most likely also want to set list=no. This is mostly # useful when converting from another server with different namespaces which # you want to deprecate but still keep working. For example you can create # hidden namespaces with prefixes "~/mail/", "~%u/mail/" and "mail/". #hidden = no # Show the mailboxes under this namespace with LIST command. This makes the # namespace visible for clients that don't support NAMESPACE extension. # "children" value lists child mailboxes, but hides the namespace prefix. #list = yes # Namespace handles its own subscriptions. If set to "no", the parent # namespace handles them (empty prefix should always have this as "yes") #subscriptions = yes # See 15-mailboxes.conf for definitions of special mailboxes. } # Example shared namespace configuration #namespace { #type = shared #separator = / # Mailboxes are visible under "shared/user@domain/" # %%n, %%d and %%u are expanded to the destination user. #prefix = shared/%%u/ # Mail location for other users' mailboxes. Note that %variables and ~/ # expands to the logged in user's data. %%n, %%d, %%u and %%h expand to the # destination user's data. #location = maildir:%%h/Maildir:INDEX=~/Maildir/shared/%%u # Use the default namespace for saving subscriptions. #subscriptions = no # List the shared/ namespace only if there are visible shared mailboxes. #list = children #} # Should shared INBOX be visible as "shared/user" or "shared/user/INBOX"? #mail_shared_explicit_inbox = no # System user and group used to access mails. If you use multiple, userdb # can override these by returning uid or gid fields. You can use either numbers # or names. mail_uid = vmail mail_gid = mail # Group to enable temporarily for privileged operations. Currently this is # used only with INBOX when either its initial creation or dotlocking fails. # Typically this is set to "mail" to give access to /var/mail. mail_privileged_group = mail # Grant access to these supplementary groups for mail processes. Typically # these are used to set up access to shared mailboxes. Note that it may be # dangerous to set these if users can create symlinks (e.g. if "mail" group is # set here, ln -s /var/mail ~/mail/var could allow a user to delete others' # mailboxes, or ln -s /secret/shared/box ~/mail/mybox would allow reading it). #mail_access_groups = mail_access_groups = mail # Allow full filesystem access to clients. There's no access checks other than # what the operating system does for the active UID/GID. It works with both # maildir and mboxes, allowing you to prefix mailboxes names with eg. /path/ # or ~user/. #mail_full_filesystem_access = no # Dictionary for key=value mailbox attributes. This is used for example by # URLAUTH and METADATA extensions. #mail_attribute_dict = # A comment or note that is associated with the server. This value is # accessible for authenticated users through the IMAP METADATA server # entry "/shared/comment". #mail_server_comment = "" # Indicates a method for contacting the server administrator. According to # RFC 5464, this value MUST be a URI (e.g., a mailto: or tel: URL), but that # is currently not enforced. Use for example mailto:admin@example.com. This # value is accessible for authenticated users through the IMAP METADATA server # entry "/shared/admin". #mail_server_admin = ## ## Mail processes ## # Don't use mmap() at all. This is required if you store indexes to shared # filesystems (NFS or clustered filesystem). #mmap_disable = no # Rely on O_EXCL to work when creating dotlock files. NFS supports O_EXCL # since version 3, so this should be safe to use nowadays by default. #dotlock_use_excl = yes # When to use fsync() or fdatasync() calls: # optimized (default): Whenever necessary to avoid losing important data # always: Useful with e.g. NFS when write()s are delayed # never: Never use it (best performance, but crashes can lose data) #mail_fsync = optimized # Locking method for index files. Alternatives are fcntl, flock and dotlock. # Dotlocking uses some tricks which may create more disk I/O than other locking # methods. NFS users: flock doesn't work, remember to change mmap_disable. #lock_method = fcntl # Directory in which LDA/LMTP temporarily stores incoming mails >128 kB. #mail_temp_dir = /tmp # Valid UID range for users, defaults to 500 and above. This is mostly # to make sure that users can't log in as daemons or other system users. # Note that denying root logins is hardcoded to dovecot binary and can't # be done even if first_valid_uid is set to 0. first_valid_uid = 150 last_valid_uid = 150 # Valid GID range for users, defaults to non-root/wheel. Users having # non-valid GID as primary group ID aren't allowed to log in. If user # belongs to supplementary groups with non-valid GIDs, those groups are # not set. #first_valid_gid = 1 #last_valid_gid = 0 # Maximum allowed length for mail keyword name. It's only forced when trying # to create new keywords. #mail_max_keyword_length = 50 # ':' separated list of directories under which chrooting is allowed for mail # processes (ie. /var/mail will allow chrooting to /var/mail/foo/bar too). # This setting doesn't affect login_chroot, mail_chroot or auth chroot # settings. If this setting is empty, "/./" in home dirs are ignored. # WARNING: Never add directories here which local users can modify, that # may lead to root exploit. Usually this should be done only if you don't # allow shell access for users. #valid_chroot_dirs = # Default chroot directory for mail processes. This can be overridden for # specific users in user database by giving /./ in user's home directory # (eg. /home/./user chroots into /home). Note that usually there is no real # need to do chrooting, Dovecot doesn't allow users to access files outside # their mail directory anyway. If your home directories are prefixed with # the chroot directory, append "/." to mail_chroot. #mail_chroot = # UNIX socket path to master authentication server to find users. # This is used by imap (for shared users) and lda. #auth_socket_path = /var/run/dovecot/auth-userdb # Directory where to look up mail plugins. #mail_plugin_dir = /usr/lib/dovecot # Space separated list of plugins to load for all services. Plugins specific to # IMAP, LDA, etc. are added to this list in their own .conf files. #mail_plugins = ## ## Mailbox handling optimizations ## # Mailbox list indexes can be used to optimize IMAP STATUS commands. They are # also required for IMAP NOTIFY extension to be enabled. #mailbox_list_index = no # Trust mailbox list index to be up-to-date. This reduces disk I/O at the cost # of potentially returning out-of-date results after e.g. server crashes. # The results will be automatically fixed once the folders are opened. #mailbox_list_index_very_dirty_syncs = yes # Should INBOX be kept up-to-date in the mailbox list index? By default it's # not, because most of the mailbox accesses will open INBOX anyway. #mailbox_list_index_include_inbox = no # The minimum number of mails in a mailbox before updates are done to cache # file. This allows optimizing Dovecot's behavior to do less disk writes at # the cost of more disk reads. #mail_cache_min_mail_count = 0 # When IDLE command is running, mailbox is checked once in a while to see if # there are any new mails or other changes. This setting defines the minimum # time to wait between those checks. Dovecot can also use inotify and # kqueue to find out immediately when changes occur. #mailbox_idle_check_interval = 30 secs # Save mails with CR+LF instead of plain LF. This makes sending those mails # take less CPU, especially with sendfile() syscall with Linux and FreeBSD. # But it also creates a bit more disk I/O which may just make it slower. # Also note that if other software reads the mboxes/maildirs, they may handle # the extra CRs wrong and cause problems. #mail_save_crlf = no # Max number of mails to keep open and prefetch to memory. This only works with # some mailbox formats and/or operating systems. #mail_prefetch_count = 0 # How often to scan for stale temporary files and delete them (0 = never). # These should exist only after Dovecot dies in the middle of saving mails. #mail_temp_scan_interval = 1w # How many slow mail accesses sorting can perform before it returns failure. # With IMAP the reply is: NO [LIMIT] Requested sort would have taken too long. # The untagged SORT reply is still returned, but it's likely not correct. #mail_sort_max_read_count = 0 protocol !indexer-worker { # If folder vsize calculation requires opening more than this many mails from # disk (i.e. mail sizes aren't in cache already), return failure and finish # the calculation via indexer process. Disabled by default. This setting must # be 0 for indexer-worker processes. #mail_vsize_bg_after_count = 0 } ## ## Maildir-specific settings ## # By default LIST command returns all entries in maildir beginning with a dot. # Enabling this option makes Dovecot return only entries which are directories. # This is done by stat()ing each entry, so it causes more disk I/O. # (For systems setting struct dirent->d_type, this check is free and it's # done always regardless of this setting) #maildir_stat_dirs = no # When copying a message, do it with hard links whenever possible. This makes # the performance much better, and it's unlikely to have any side effects. #maildir_copy_with_hardlinks = yes # Assume Dovecot is the only MUA accessing Maildir: Scan cur/ directory only # when its mtime changes unexpectedly or when we can't find the mail otherwise. #maildir_very_dirty_syncs = no # If enabled, Dovecot doesn't use the S= in the Maildir filenames for # getting the mail's physical size, except when recalculating Maildir++ quota. # This can be useful in systems where a lot of the Maildir filenames have a # broken size. The performance hit for enabling this is very small. #maildir_broken_filename_sizes = no # Always move mails from new/ directory to cur/, even when the \Recent flags # aren't being reset. #maildir_empty_new = no ## ## mbox-specific settings ## # Which locking methods to use for locking mbox. There are four available: # dotlock: Create .lock file. This is the oldest and most NFS-safe # solution. If you want to use /var/mail/ like directory, the users # will need write access to that directory. # dotlock_try: Same as dotlock, but if it fails because of permissions or # because there isn't enough disk space, just skip it. # fcntl : Use this if possible. Works with NFS too if lockd is used. # flock : May not exist in all systems. Doesn't work with NFS. # lockf : May not exist in all systems. Doesn't work with NFS. # # You can use multiple locking methods; if you do the order they're declared # in is important to avoid deadlocks if other MTAs/MUAs are using multiple # locking methods as well. Some operating systems don't allow using some of # them simultaneously. #mbox_read_locks = fcntl #mbox_write_locks = dotlock fcntl mbox_write_locks = fcntl # Maximum time to wait for lock (all of them) before aborting. #mbox_lock_timeout = 5 mins # If dotlock exists but the mailbox isn't modified in any way, override the # lock file after this much time. #mbox_dotlock_change_timeout = 2 mins # When mbox changes unexpectedly we have to fully read it to find out what # changed. If the mbox is large this can take a long time. Since the change # is usually just a newly appended mail, it'd be faster to simply read the # new mails. If this setting is enabled, Dovecot does this but still safely # fallbacks to re-reading the whole mbox file whenever something in mbox isn't # how it's expected to be. The only real downside to this setting is that if # some other MUA changes message flags, Dovecot doesn't notice it immediately. # Note that a full sync is done with SELECT, EXAMINE, EXPUNGE and CHECK # commands. #mbox_dirty_syncs = yes # Like mbox_dirty_syncs, but don't do full syncs even with SELECT, EXAMINE, # EXPUNGE or CHECK commands. If this is set, mbox_dirty_syncs is ignored. #mbox_very_dirty_syncs = no # Delay writing mbox headers until doing a full write sync (EXPUNGE and CHECK # commands and when closing the mailbox). This is especially useful for POP3 # where clients often delete all mails. The downside is that our changes # aren't immediately visible to other MUAs. #mbox_lazy_writes = yes # If mbox size is smaller than this (e.g. 100k), don't write index files. # If an index file already exists it's still read, just not updated. #mbox_min_index_size = 0 # Mail header selection algorithm to use for MD5 POP3 UIDLs when # pop3_uidl_format=%m. For backwards compatibility we use apop3d inspired # algorithm, but it fails if the first Received: header isn't unique in all # mails. An alternative algorithm is "all" that selects all headers. #mbox_md5 = apop3d ## ## mdbox-specific settings ## # Maximum dbox file size until it's rotated. #mdbox_rotate_size = 2M # Maximum dbox file age until it's rotated. Typically in days. Day begins # from midnight, so 1d = today, 2d = yesterday, etc. 0 = check disabled. #mdbox_rotate_interval = 0 # When creating new mdbox files, immediately preallocate their size to # mdbox_rotate_size. This setting currently works only in Linux with some # filesystems (ext4, xfs). #mdbox_preallocate_space = no ## ## Mail attachments ## # sdbox and mdbox support saving mail attachments to external files, which # also allows single instance storage for them. Other backends don't support # this for now. # Directory root where to store mail attachments. Disabled, if empty. #mail_attachment_dir = # Attachments smaller than this aren't saved externally. It's also possible to # write a plugin to disable saving specific attachments externally. #mail_attachment_min_size = 128k # Filesystem backend to use for saving attachments: # posix : No SiS done by Dovecot (but this might help FS's own deduplication) # sis posix : SiS with immediate byte-by-byte comparison during saving # sis-queue posix : SiS with delayed comparison and deduplication #mail_attachment_fs = sis posix # Hash format to use in attachment filenames. You can add any text and # variables: %{md4}, %{md5}, %{sha1}, %{sha256}, %{sha512}, %{size}. # Variables can be truncated, e.g. %{sha256:80} returns only first 80 bits #mail_attachment_hash = %{sha1} # Settings to control adding $HasAttachment or $HasNoAttachment keywords. # By default, all MIME parts with Content-Disposition=attachment, or inlines # with filename parameter are consired attachments. # add-flags-on-save - Add the keywords when saving new mails. # content-type=type or !type - Include/exclude content type. Excluding will # never consider the matched MIME part as attachment. Including will only # negate an exclusion (e.g. content-type=!foo/* content-type=foo/bar). # exclude-inlined - Exclude any Content-Disposition=inline MIME part. #mail_attachment_detection_options = ================================================ FILE: conf/dovecot/conf.d/10-master.conf ================================================ #default_process_limit = 100 #default_client_limit = 1000 # Default VSZ (virtual memory size) limit for service processes. This is mainly # intended to catch and kill processes that leak memory before they eat up # everything. #default_vsz_limit = 256M # Login user is internally used by login processes. This is the most untrusted # user in Dovecot system. It shouldn't have access to anything at all. #default_login_user = dovenull # Internal user is used by unprivileged processes. It should be separate from # login user, so that login processes can't disturb other processes. #default_internal_user = dovecot service imap-login { inet_listener imap { #port = 143 } inet_listener imaps { #port = 993 #ssl = yes } # Number of connections to handle before starting a new process. Typically # the only useful values are 0 (unlimited) or 1. 1 is more secure, but 0 # is faster. #service_count = 1 # Number of processes to always keep waiting for more connections. #process_min_avail = 0 # If you set service_count=0, you probably need to grow this. #vsz_limit = $default_vsz_limit } service pop3-login { inet_listener pop3 { #port = 110 } inet_listener pop3s { #port = 995 #ssl = yes } } # service lmtp { # unix_listener /var/spool/postfix/private/dovecot-lmtp { # #mode = 0666 # mode = 0600 # user = postfix # group = postfix # } service lmtp { inet_listener lmtp-inet { port = 26 } user = vmail } # Create inet listener only if you can't use the above UNIX socket #inet_listener lmtp { # Avoid making LMTP visible for the entire internet #address = #port = #} service imap { # Most of the memory goes to mmap()ing files. You may need to increase this # limit if you have huge mailboxes. #vsz_limit = $default_vsz_limit # Max. number of IMAP processes (connections) #process_limit = 1024 } service pop3 { # Max. number of POP3 processes (connections) #process_limit = 1024 } service auth { inet_listener auth-inet { port = 10002 } unix_listener auth-master { mode = 0600 user = vmail } unix_listener auth-userdb { mode = 0600 user = vmail } vsz_limit = 2G } # service auth { # # auth_socket_path points to this userdb socket by default. It's typically # # used by dovecot-lda, doveadm, possibly imap process, etc. Users that have # # full permissions to this socket are able to get a list of all usernames and # # get the results of everyone's userdb lookups. # # # # The default 0666 mode allows anyone to connect to the socket, but the # # userdb lookups will succeed only if the userdb returns an "uid" field that # # matches the caller process's UID. Also if caller's uid or gid matches the # # socket's uid or gid the lookup succeeds. Anything else causes a failure. # # # # To give the caller full permissions to lookup all users, set the mode to # # something else than 0666 and Dovecot lets the kernel enforce the # # permissions (e.g. 0777 allows everyone full permissions). # unix_listener auth-userdb { # mode = 0600 # user = vmail # #group = vmail # } # # Postfix smtp-auth # unix_listener /var/spool/postfix/private/auth { # mode = 0666 # user = postfix # group = postfix # } # # Auth process is run as this user. # #user = $default_internal_user # user = dovecot # } service auth-worker { # Auth worker process is run as root by default, so that it can access # /etc/shadow. If this isn't necessary, the user should be changed to # $default_internal_user. #user = root user = vmail } service dict { # If dict proxy is used, mail processes should have access to its socket. # For example: mode=0660, group=vmail and global mail_access_groups=vmail unix_listener dict { #mode = 0600 #user = #group = } } ================================================ FILE: conf/dovecot/conf.d/10-ssl.conf ================================================ ## ## SSL settings ## # SSL/TLS support: yes, no, required. # disable plain pop3 and imap, allowed are only pop3+TLS, pop3s, imap+TLS and imaps # plain imap and pop3 are still allowed for local connections ssl = yes # PEM encoded X.509 SSL/TLS certificate and private key. They're opened before # dropping root privileges, so keep the key file unreadable by anyone but # root. Included doc/mkcert.sh can be used to easily generate self-signed # certificate, just make sure to update the domains in dovecot-openssl.cnf ssl_cert = was automatically rejected:%n%r # Delimiter character between local-part and detail in email address. #recipient_delimiter = + # Header where the original recipient address (SMTP's RCPT TO: address) is taken # from if not available elsewhere. With dovecot-lda -a parameter overrides this. # A commonly used header for this is X-Original-To. #lda_original_recipient_header = # Should saving a mail to a nonexistent mailbox automatically create it? #lda_mailbox_autocreate = no # Should automatically created mailboxes be also automatically subscribed? #lda_mailbox_autosubscribe = no protocol lda { # Space separated list of plugins to load (default is global mail_plugins). #mail_plugins = $mail_plugins mail_plugins = $mail_plugins sieve } ================================================ FILE: conf/dovecot/conf.d/15-mailboxes.conf ================================================ ## ## Mailbox definitions ## # Each mailbox is specified in a separate mailbox section. The section name # specifies the mailbox name. If it has spaces, you can put the name # "in quotes". These sections can contain the following mailbox settings: # # auto: # Indicates whether the mailbox with this name is automatically created # implicitly when it is first accessed. The user can also be automatically # subscribed to the mailbox after creation. The following values are # defined for this setting: # # no - Never created automatically. # create - Automatically created, but no automatic subscription. # subscribe - Automatically created and subscribed. # # special_use: # A space-separated list of SPECIAL-USE flags (RFC 6154) to use for the # mailbox. There are no validity checks, so you could specify anything # you want in here, but it's not a good idea to use flags other than the # standard ones specified in the RFC: # # \All - This (virtual) mailbox presents all messages in the # user's message store. # \Archive - This mailbox is used to archive messages. # \Drafts - This mailbox is used to hold draft messages. # \Flagged - This (virtual) mailbox presents all messages in the # user's message store marked with the IMAP \Flagged flag. # \Junk - This mailbox is where messages deemed to be junk mail # are held. # \Sent - This mailbox is used to hold copies of messages that # have been sent. # \Trash - This mailbox is used to hold messages that have been # deleted. # # comment: # Defines a default comment or note associated with the mailbox. This # value is accessible through the IMAP METADATA mailbox entries # "/shared/comment" and "/private/comment". Users with sufficient # privileges can override the default value for entries with a custom # value. # NOTE: Assumes "namespace inbox" has been defined in 10-mail.conf. namespace inbox { # These mailboxes are widely used and could perhaps be created automatically: mailbox Drafts { auto = subscribe special_use = \Drafts } mailbox Junk { auto = subscribe special_use = \Junk } mailbox Trash { auto = subscribe special_use = \Trash } # For \Sent mailboxes there are two widely used names. We'll mark both of # them as \Sent. User typically deletes one of them if duplicates are created. mailbox Sent { auto = subscribe special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } # If you have a virtual "All messages" mailbox: #mailbox virtual/All { # special_use = \All # comment = All my messages #} # If you have a virtual "Flagged" mailbox: #mailbox virtual/Flagged { # special_use = \Flagged # comment = All my flagged messages #} } ================================================ FILE: conf/dovecot/conf.d/20-imap.conf ================================================ ## ## IMAP specific settings ## # If nothing happens for this long while client is IDLEing, move the connection # to imap-hibernate process and close the old imap process. This saves memory, # because connections use very little memory in imap-hibernate process. The # downside is that recreating the imap process back uses some resources. #imap_hibernate_timeout = 0 # Maximum IMAP command line length. Some clients generate very long command # lines with huge mailboxes, so you may need to raise this if you get # "Too long argument" or "IMAP command line too large" errors often. #imap_max_line_length = 64k # IMAP logout format string: # %i - total number of bytes read from client # %o - total number of bytes sent to client # %{fetch_hdr_count} - Number of mails with mail header data sent to client # %{fetch_hdr_bytes} - Number of bytes with mail header data sent to client # %{fetch_body_count} - Number of mails with mail body data sent to client # %{fetch_body_bytes} - Number of bytes with mail body data sent to client # %{deleted} - Number of mails where client added \Deleted flag # %{expunged} - Number of mails that client expunged, which does not # include automatically expunged mails # %{autoexpunged} - Number of mails that were automatically expunged after # client disconnected # %{trashed} - Number of mails that client copied/moved to the # special_use=\Trash mailbox. # %{appended} - Number of mails saved during the session #imap_logout_format = in=%i out=%o deleted=%{deleted} expunged=%{expunged} \ # trashed=%{trashed} hdr_count=%{fetch_hdr_count} \ # hdr_bytes=%{fetch_hdr_bytes} body_count=%{fetch_body_count} \ # body_bytes=%{fetch_body_bytes} # Override the IMAP CAPABILITY response. If the value begins with '+', # add the given capabilities on top of the defaults (e.g. +XFOO XBAR). #imap_capability = # How long to wait between "OK Still here" notifications when client is # IDLEing. #imap_idle_notify_interval = 2 mins # ID field names and values to send to clients. Using * as the value makes # Dovecot use the default value. The following fields have default values # currently: name, version, os, os-version, support-url, support-email. #imap_id_send = # ID fields sent by client to log. * means everything. #imap_id_log = # Workarounds for various client bugs: # delay-newmail: # Send EXISTS/RECENT new mail notifications only when replying to NOOP # and CHECK commands. Some clients ignore them otherwise, for example OSX # Mail () instead of full path # syntax. # # The list is space-separated. #lmtp_client_workarounds = protocol lmtp { # Space separated list of plugins to load (default is global mail_plugins). #mail_plugins = $mail_plugins mail_plugins = $mail_plugins sieve } ================================================ FILE: conf/dovecot/conf.d/20-pop3.conf ================================================ ## ## POP3 specific settings ## # Don't try to set mails non-recent or seen with POP3 sessions. This is # mostly intended to reduce disk I/O. With maildir it doesn't move files # from new/ to cur/, with mbox it doesn't write Status-header. #pop3_no_flag_updates = no # Support LAST command which exists in old POP3 specs, but has been removed # from new ones. Some clients still wish to use this though. Enabling this # makes RSET command clear all \Seen flags from messages. #pop3_enable_last = no # If mail has X-UIDL header, use it as the mail's UIDL. #pop3_reuse_xuidl = no # Allow only one POP3 session to run simultaneously for the same user. #pop3_lock_session = no # POP3 requires message sizes to be listed as if they had CR+LF linefeeds. # Many POP3 servers violate this by returning the sizes with LF linefeeds, # because it's faster to get. When this setting is enabled, Dovecot still # tries to do the right thing first, but if that requires opening the # message, it fallbacks to the easier (but incorrect) size. #pop3_fast_size_lookups = no # POP3 UIDL (unique mail identifier) format to use. You can use following # variables, along with the variable modifiers described in # doc/wiki/Variables.txt (e.g. %Uf for the filename in uppercase) # # %v - Mailbox's IMAP UIDVALIDITY # %u - Mail's IMAP UID # %m - MD5 sum of the mailbox headers in hex (mbox only) # %f - filename (maildir only) # %g - Mail's GUID # # If you want UIDL compatibility with other POP3 servers, use: # UW's ipop3d : %08Xv%08Xu # Courier : %f or %v-%u (both might be used simultaneously) # Cyrus (<= 2.1.3) : %u # Cyrus (>= 2.1.4) : %v.%u # Dovecot v0.99.x : %v.%u # tpop3d : %Mf # # Note that Outlook 2003 seems to have problems with %v.%u format which was # Dovecot's default, so if you're building a new server it would be a good # idea to change this. %08Xu%08Xv should be pretty fail-safe. # #pop3_uidl_format = %08Xu%08Xv # Permanently save UIDLs sent to POP3 clients, so pop3_uidl_format changes # won't change those UIDLs. Currently this works only with Maildir. #pop3_save_uidl = no # What to do about duplicate UIDLs if they exist? # allow: Show duplicates to clients. # rename: Append a temporary -2, -3, etc. counter after the UIDL. #pop3_uidl_duplicates = allow # This option changes POP3 behavior so that it's not possible to actually # delete mails via POP3, only hide them from future POP3 sessions. The mails # will still be counted towards user's quota until actually deleted via IMAP. # Use e.g. "$POP3Deleted" as the value (it will be visible as IMAP keyword). # Make sure you can legally archive mails before enabling this setting. #pop3_deleted_flag = # POP3 logout format string: # %i - total number of bytes read from client # %o - total number of bytes sent to client # %t - number of TOP commands # %p - number of bytes sent to client as a result of TOP command # %r - number of RETR commands # %b - number of bytes sent to client as a result of RETR command # %d - number of deleted messages # %{deleted_bytes} - number of bytes in deleted messages # %m - number of messages (before deletion) # %s - mailbox size in bytes (before deletion) # %u - old/new UIDL hash. may help finding out if UIDLs changed unexpectedly #pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s # Workarounds for various client bugs: # outlook-no-nuls: # Outlook and Outlook Express hang if mails contain NUL characters. # This setting replaces them with 0x80 character. # oe-ns-eoh: # Outlook Express and Netscape Mail breaks if end of headers-line is # missing. This option simply sends it if it's missing. # The list is space-separated. #pop3_client_workarounds = protocol pop3 { # Space separated list of plugins to load (default is global mail_plugins). #mail_plugins = $mail_plugins # Maximum number of POP3 connections allowed for a user from each IP address. # NOTE: The username is compared case-sensitively. #mail_max_userip_connections = 10 } ================================================ FILE: conf/dovecot/conf.d/90-acl.conf ================================================ ## ## Mailbox access control lists. ## # vfile backend reads ACLs from "dovecot-acl" file from mail directory. # You can also optionally give a global ACL directory path where ACLs are # applied to all users' mailboxes. The global ACL directory contains # one file for each mailbox, eg. INBOX or sub.mailbox. cache_secs parameter # specifies how many seconds to wait between stat()ing dovecot-acl file # to see if it changed. plugin { #acl = vfile:/etc/dovecot/global-acls:cache_secs=300 } # To let users LIST mailboxes shared by other users, Dovecot needs a # shared mailbox dictionary. For example: plugin { #acl_shared_dict = file:/var/lib/dovecot/shared-mailboxes } ================================================ FILE: conf/dovecot/conf.d/90-plugin.conf ================================================ ## ## Plugin settings ## # All wanted plugins must be listed in mail_plugins setting before any of the # settings take effect. See for list of plugins and # their configuration. Note that %variable expansion is done for all values. plugin { #setting_name = value sieve = /etc/dovecot/sieve/default.sieve } ================================================ FILE: conf/dovecot/conf.d/90-quota.conf ================================================ ## ## Quota configuration. ## # Note that you also have to enable quota plugin in mail_plugins setting. # ## ## Quota limits ## # Quota limits are set using "quota_rule" parameters. To get per-user quota # limits, you can set/override them by returning "quota_rule" extra field # from userdb. It's also possible to give mailbox-specific limits, for example # to give additional 100 MB when saving to Trash: plugin { #quota_rule = *:storage=1G #quota_rule2 = Trash:storage=+100M # LDA/LMTP allows saving the last mail to bring user from under quota to # over quota, if the quota doesn't grow too high. Default is to allow as # long as quota will stay under 10% above the limit. Also allowed e.g. 10M. #quota_grace = 10%% # Quota plugin can also limit the maximum accepted mail size. #quota_max_mail_size = 100M } ## ## Quota warnings ## # You can execute a given command when user exceeds a specified quota limit. # Each quota root has separate limits. Only the command for the first # exceeded limit is executed, so put the highest limit first. # The commands are executed via script service by connecting to the named # UNIX socket (quota-warning below). # Note that % needs to be escaped as %%, otherwise "% " expands to empty. plugin { #quota_warning = storage=95%% quota-warning 95 %u #quota_warning2 = storage=80%% quota-warning 80 %u } # Example quota-warning service. The unix listener's permissions should be # set in a way that mail processes can connect to it. Below example assumes # that mail processes run as vmail user. If you use mode=0666, all system users # can generate quota warnings to anyone. #service quota-warning { # executable = script /usr/local/bin/quota-warning.sh # user = dovecot # unix_listener quota-warning { # user = vmail # } #} ## ## Quota backends ## # Multiple backends are supported: # dirsize: Find and sum all the files found from mail directory. # Extremely SLOW with Maildir. It'll eat your CPU and disk I/O. # dict: Keep quota stored in dictionary (eg. SQL) # maildir: Maildir++ quota # fs: Read-only support for filesystem quota plugin { #quota = dirsize:User quota #quota = maildir:User quota #quota = dict:User quota::proxy::quota #quota = fs:User quota } # Multiple quota roots are also possible, for example this gives each user # their own 100MB quota and one shared 1GB quota within the domain: plugin { #quota = dict:user::proxy::quota #quota2 = dict:domain:%d:proxy::quota_domain #quota_rule = *:storage=102400 #quota2_rule = *:storage=1048576 } ================================================ FILE: conf/dovecot/conf.d/90-sieve-extprograms.conf ================================================ # Sieve Extprograms plugin configuration # Don't forget to add the sieve_extprograms plugin to the sieve_plugins setting. # Also enable the extensions you need (one or more of vnd.dovecot.pipe, # vnd.dovecot.filter and vnd.dovecot.execute) by adding these to the # sieve_extensions or sieve_global_extensions settings. Restricting these # extensions to a global context using sieve_global_extensions is recommended. plugin { # The directory where the program sockets are located for the # vnd.dovecot.pipe, vnd.dovecot.filter and vnd.dovecot.execute extension # respectively. The name of each unix socket contained in that directory # directly maps to a program-name referenced from the Sieve script. #sieve_pipe_socket_dir = sieve-pipe #sieve_filter_socket_dir = sieve-filter #sieve_execute_socket_dir = sieve-execute # The directory where the scripts are located for direct execution by the # vnd.dovecot.pipe, vnd.dovecot.filter and vnd.dovecot.execute extension # respectively. The name of each script contained in that directory # directly maps to a program-name referenced from the Sieve script. #sieve_pipe_bin_dir = /usr/lib/dovecot/sieve-pipe #sieve_filter_bin_dir = /usr/lib/dovecot/sieve-filter #sieve_execute_bin_dir = /usr/lib/dovecot/sieve-execute } # An example program service called 'do-something' to pipe messages to #service do-something { # Define the executed script as parameter to the sieve service #executable = script /usr/lib/dovecot/sieve-pipe/do-something.sh # Use some unprivileged user for executing the program #user = dovenull # The unix socket located in the sieve_pipe_socket_dir (as defined in the # plugin {} section above) #unix_listener sieve-pipe/do-something { # LDA/LMTP must have access # user = vmail # mode = 0600 #} #} ================================================ FILE: conf/dovecot/conf.d/90-sieve.conf ================================================ ## ## Settings for the Sieve interpreter ## # Do not forget to enable the Sieve plugin in 15-lda.conf and 20-lmtp.conf # by adding it to the respective mail_plugins= settings. # The Sieve interpreter can retrieve Sieve scripts from several types of # locations. The default `file' location type is a local filesystem path # pointing to a Sieve script file or a directory containing multiple Sieve # script files. More complex setups can use other location types such as # `ldap' or `dict' to fetch Sieve scripts from remote databases. # # All settings that specify the location of one ore more Sieve scripts accept # the following syntax: # # location = [:]path[;