Skip to content

Nuface Blog

隨意隨手記 Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login
Menu

Blog

Building an Enterprise-Grade Mail Server: Full Architecture Overview

Posted on 2025-11-072025-11-07 by Rico

For many small to medium businesses and technical teams, the mail system is one of the most critical — yet often overlooked — internal services.Building your own secure, reliable, and maintainable mail infrastructure can greatly reduce long-term service costs while giving you full control over your organization’s data and privacy. In this article, I’ll introduce…

Read more

自建企業級 Mail Server 架構總覽

Posted on 2025-11-072025-11-07 by Rico

在許多中小企業或技術團隊中,郵件系統往往是內部最重要、卻也最容易被忽略的一個服務。若能自行建置一套穩定、安全、可維護的郵件系統,不僅能降低長期外部服務的費用,更能完全掌握公司內部郵件的安全與隱私。 本文將介紹我目前正在使用的一套完整郵件系統架構,並簡單說明各元件的角色與實際應用情境。 🧩 系統整體架構 輔助系統: 🔧 各模組功能與角色 🏣 Postfix — 郵件核心 Postfix 是整個郵件系統的心臟,負責 SMTP 傳送與接收。它會依照 DNS 的 MX 記錄接收外部信件,並將信件投遞給內部的收信系統(Dovecot)。同時,它也負責寄信出去(relay 外部郵件)。 應用場景: 👩‍💻 PostfixAdmin — 使用者與網域管理 這是一個 PHP 網頁介面,讓管理者能輕鬆管理: 應用場景: 🗃️ MariaDB — 帳號與設定資料庫 MariaDB 負責儲存 Postfix、Dovecot 所需的帳號與設定資料,例如: 📬 Dovecot — 收信與使用者信箱管理 Dovecot 提供 IMAP/POP3 服務,讓使用者可以透過各種郵件軟體(Outlook、Apple Mail、手機)讀信。它同時支援: 應用場景: 🧱 Amavis — 郵件內容過濾中心 Amavis 是郵件防護的中樞,所有收進來的郵件都會被轉交給它處理。它會呼叫: 應用場景: 🦠…

Read more

Understanding FROM xxx AS builder in Dockerfile

Posted on 2025-11-072025-11-07 by Rico

Multi-stage Build Explained Clearly 📘 1. What Does FROM xxx AS builder Mean? In Dockerfile, defines a build stage called builder.You typically use this stage to compile or package your application, and then later copy the final artifacts into a clean runtime image using: Only the last stage (or the one you specify with –target)…

Read more

Dockerfile 中的 FROM xxx AS builder 是什麼?

Posted on 2025-11-072025-11-07 by Rico

—— 多階段建置(Multi-stage Build)完整解析 📘 一、什麼是 FROM xxx AS builder 在 Dockerfile 中,FROM ubuntu:24.04 AS builder 表示「建立一個名為 builder 的建置階段」。這個階段通常用來編譯或打包應用程式,後續可以在另一個階段中用: 把編譯好的成果(例如可執行檔或壓縮包)複製到乾淨、輕量的最終映像中。最終映像只會包含執行應用程式所需的檔案,不會帶入完整的建置工具與相依套件。 ⚙️ 二、運作原理 💡 三、優點 🧰 四、常見應用場景 🧱 五、實際範例:編譯 Postfix 結果: 🔍 六、實務建議 ✅ 結論 FROM … AS builder 是 Docker 多階段建置的核心技巧。它讓我們在「肥」的建置階段做完編譯,再把成果抽出放入「瘦」的最終映像,兼顧 體積小、安全高、可重現、可維護 —— 是現代 Dockerfile 的最佳實踐。

Read more

Replacing AD with Samba: Can OpenLDAP Be the Backend? Practical Feasibility, Options & Migration Guide

Posted on 2025-11-062025-11-06 by Rico

Your Context Key Fact: Samba AD DC vs. OpenLDAP Do You Really Need a Domain? You can avoid it—but know the trade-offs Running without a domain still works for SMB and RDS, but you’ll face: Minimal domain (Samba AD) advantages—even with no GPOs: Three Architecture Options A. Samba AD DC replaces AD (recommended, pragmatic) B….

Read more

用 Samba 取代 AD?OpenLDAP 能不能當後端?——可行性、選型與遷移指南

Posted on 2025-11-062025-11-06 by Rico

需求背景 關鍵事實:Samba AD DC 與 OpenLDAP 的關係 是否一定要建「網域」? 不一定,但要看你在意什麼 不用網域也能跑 檔案分享與 RDS,但你會遇到: 建「最小網域(Samba AD)」的好處(就算你不打算用 GPO): 三種可行架構 A. Samba AD DC 取代 AD(建議、最務實) B. Samba AD 為主 + OpenLDAP 做旁路鏡像 C. 無網域:OpenLDAP/本機帳號 + Samba 成員伺服器 快速決策表 情境 建議 只有 1 台檔案伺服器 + 1 台 RDS,幾乎不擴充 可先不建網域(C),但要接受人工同步帳號與 ACL 成本 兩台以上檔案/RDS、權限常變動、考慮擴充 建 最小 Samba AD(A),不一定要用 GPO 仍有舊系統依賴 OpenLDAP…

Read more

How Docker Containers Communicate Using Container Names

Posted on 2025-11-06 by Rico

When running multiple Docker containers, one common question is:“Can containers connect to each other using their container names?”The answer is Yes!But — only if they are on the same custom Docker network. 1. Why the Default Network Doesn’t Work By default, Docker creates a bridge network (also known as docker0).However, this default bridge network does…

Read more

Docker 不同容器間如何透過容器名互相連線

Posted on 2025-11-062025-11-06 by Rico

在使用 Docker 建立多個服務容器時,常常會遇到一個問題:「不同容器之間能不能用容器名稱互相連線?」答案是 —— 可以的!但前提是:它們必須在同一個自訂的 Docker network 裡。 一、為什麼預設 network 不行? Docker 預設會建立一個名為 bridge 的網路(也就是 docker0)。這個預設網路不提供容器名的 DNS 解析,因此容器之間只能用 IP 位址互相連線。 這樣做在測試階段還可以,但在實際環境中,容器 IP 經常變動,維護起來相當麻煩。 二、建立自訂 network 要讓容器之間能用「容器名稱」互相連線,最簡單的方法就是建立一個自訂的 network。 建立好之後,所有加入這個 network 的容器,就能彼此透過名稱解析進行通訊。 三、讓容器加入同一個 network 啟動容器時指定 network 參數: 此時,web 與 app 這兩個容器都在 mynet 網路裡。 四、容器之間用名稱連線 進入其中一個容器(例如 app): 測試連線: Docker 的內建 DNS 會自動解析 web → web 容器的 IP。因此你不需要知道 IP…

Read more

Fixing Fail2Ban Postfix Filter Errors on CentOS 7

Posted on 2025-11-062025-11-06 by Rico

1. Background When managing mail servers, Fail2Ban is used to block malicious IPs and brute-force attempts.On CentOS 7 (Fail2Ban v0.11.2 / Python 2.7), running: triggered the following error: 2. Root Cause Fail2Ban filters often reference shared variables like: These are defined in /etc/fail2ban/filter.d/common.conf.However, on older versions (e.g., CentOS 7’s 0.11.x), the IPv4/IPv6 variables are missing,causing…

Read more

在 CentOS 7 修正 Fail2Ban Postfix 過濾器錯誤並建立有效防護

Posted on 2025-11-062025-11-06 by Rico

一、問題背景 在管理郵件伺服器時,Fail2Ban 常用於封鎖惡意連線或暴力破解行為。Rico 在 CentOS 7(Fail2Ban v0.11.2 / Python 2.7)環境下執行以下指令測試 Postfix 過濾器: 卻出現錯誤訊息: 二、問題原因 Fail2Ban 的過濾器(filter)會引用一些共用變數,如: 這些變數定義在 /etc/fail2ban/filter.d/common.conf。但在某些舊版(如 0.11.x for CentOS 7)中,__prefix_ipv4 和 __prefix_ipv6 並未被定義,導致過濾器解析失敗。 三、修正方法 ✅ 方法一:改用 <HOST>(推薦) Fail2Ban 內建 <HOST> 巨集,自動辨識 IPv4 與 IPv6。修改 /etc/fail2ban/filter.d/postfix-pipelining.conf: 測試: 若輸出顯示: 即代表成功命中。 ✅ 方法二:手動補上變數(若不想改 regex) 在 filter 開頭自行定義: 四、延伸:建立 Postfix 過濾器防護 建立 jail 設定 /etc/fail2ban/jail.d/postfix-pipelining.local: 重新載入: 五、進階:擴充另一個過濾器…

Read more

Posts pagination

  • Previous
  • 1
  • …
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • …
  • 29
  • Next

Recent Posts

  • Cleaning Up Unused Let’s Encrypt Certificates in a Docker Certbot Environment
  • 使用 Docker Certbot 刪除不再使用的 Let’s Encrypt 憑證
  • Postfix + Let’s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide
  • Postfix + Let’s Encrypt + BIND9 + DANE TLSA 指紋自動更新完整教學
  • Deploying DANE in Postfix

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Linux
  • LLM
  • Mail
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2025 Nuface Blog | Powered by Superbs Personal Blog theme