Skip to content

Nuface Blog

隨意隨手記 Casual Notes

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

Category: Fail2Ban

About Fail2Ban

OPNsense 中的 NAT — 功能、用例和最佳實踐

Posted on 2025-11-112025-11-11 by Rico

一、NAT 是什麼? NAT(Network Address Translation,網路地址轉換)是一項讓防火牆/路由器能在內部私有 IP 與外部公有 IP 之間做轉換的機制。官方說明指出,當使用者/裝置從內部網路對外進行連線時,NAT 可以替換封包的來源 IP/目的 IP,使封包能正常往返。 docs.opnsense.org 二、NAT 的類型與作用 官方文件中指出了兩大類型: 三、為什麼需使用 NAT? 四、在 OPNsense 中的設定方式與注意點 根據官方文件,你在 OPNsense 的操作可參考以下流程: 4.1 Port Forwarding (DNAT) 4.2 Outbound NAT (SNAT) 五、實際應用範例 六、注意事項與最佳實務 七、總結 NAT 功能是 OPNsense 中不可或缺的一環,用以處理內部與外部網路的 IP 與連線邏輯。掌握 DNAT(目的轉譯)與 SNAT(來源轉譯)的差異及應用場景,能讓企業環境中內外部服務、頻寬共享、與多 WAN 架構運作得更穩定。合理使用 Port Forwarding、Outbound NAT 與 Reflection NAT,搭配過濾規則,構建安全且可控的網路架構。

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

Recent Posts

  • Postfix + Let’s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide
  • Postfix + Let’s Encrypt + BIND9 + DANE TLSA 指紋自動更新完整教學
  • Deploying DANE in Postfix
  • 如何在 Postfix 中部署 DANE
  • DANE: DNSSEC-Based TLS Protection

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