Skip to content

Nuface Blog

隨意隨手記 Casual Notes

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

Category: Linux

About Linux Tech

用 BIND 9.21 打造「內外分流 + DNSSEC」權威/遞迴混合 DNS:完整實戰筆記

Posted on 2025-11-052025-11-05 by Rico

本文將我在容器內部署 BIND 9.21 的完整過程整理成一篇教學。為保護實際環境,所有網域以 domainA、domainB 代稱,IP 也以示例地址(如 203.0.113.0/24)呈現。 目標架構 目錄佈局(建議) 重點:K* 金鑰與 .state 一律放 /var/cache/bind/keys;managed-keys.bind*、*.mkeys* 放 /var/cache/bind 根目錄;external 區檔放 /var/cache/bind/zones/ext。 關鍵設定片段 1) options:工作目錄、金鑰目錄、僅 IPv4 監聽 2) RNDC 控制通道(只綁 127.0.0.1) 如果容器外要下 rndc,要能讀到同一把 rndc.key,或在容器內執行。 3) internal view:內網權威 + 遞迴(不做 DNSSEC 驗證) 4) external view:對外權威(簽名),只對本機開遞迴+驗證供 KASP 使用 TSIG:請用 tsig-keygen -a hmac-sha256 xfr-key > /etc/bind/keys/xfr-key.key 產生,主從兩邊都 include,從伺服器 zone {…

Read more

Implementing a Shared Sinkhole Zone in BIND — and What to Know About DNSSEC

Posted on 2025-11-052025-11-05 by Rico

Author: Rico Wu | Topic: DNS Security & Infrastructure 1. Why Create a Sinkhole Zone? When reviewing your DNS logs, you might often see queries like: Some of these come from automated scanners or bots, and others are legitimate DNSSEC lookups.However, domains like wpad (Web Proxy Auto Discovery) can sometimes be abused for malicious purposes…

Read more

BIND 共用 Sinkhole Zone 實作與 DNSSEC 管理要點

Posted on 2025-11-052025-11-05 by Rico

作者:Rico Wu | 主題:DNS 防護實務 一、為什麼要建立 Sinkhole Zone? 在日常 DNS 維運中,我們經常會看到一些可疑查詢: 這些請求有些來自網際網路掃描,有些則是自動化偵測或 Bot 行為。其中 wpad(Web Proxy Auto Discovery)甚至可能被用於安全攻擊(WPAD 攻擊)。 若我們希望: 就可以透過「共用 Sinkhole Zone」的方式實作。 二、共用 Sinkhole Zone 設定範例 1️⃣ 建立共用區檔 檔名: 內容: 2️⃣ 在 named.conf 中引用 多個 zone 可共用同一個檔案: 這樣不論你要沉沒幾個子域,都可共用一份檔案,維護最簡單。 三、DNSSEC 的關聯與注意事項 DNSSEC 採用「信任鏈」的驗證機制。每一層的關係是: 這條鏈由 DS record(Delegation Signer)串起。 ✅ 若主域有 DNSSEC(如 nuface.tw) 你在 ISP / Registry…

Read more

Building a Linux Gateway with HTB + iptables + IFB

Posted on 2025-11-052025-11-05 by Rico

Complete Bidirectional Bandwidth Control (Web / Mail / FTP / VoIP) In this article, we’ll build a Linux-based gateway that not only routes traffic between your LAN and the Internet but also provides precise QoS and bandwidth shaping using HTB, iptables, and IFB. This setup is ideal for small offices, labs, or home networks where…

Read more

Linux Gateway 上的 HTB 雙向頻寬控制實作

Posted on 2025-11-052025-11-05 by Rico

一、環境設定 介面 方向 說明 eth0 外網(WAN) 連接 Internet(例如 PPPoE、NAT 出口) eth1 內網(LAN) 內部使用者連線的網卡,例如 192.168.10.0/24 Gateway Linux 主機 同時負責路由與 NAT 目標 控制內部使用者上 / 下行頻寬與分類(Web/Mail/FTP/VoIP) 二、邏輯說明 流量方向定義: 類型 封包方向 實際控制介面 上傳 LAN → WAN 控制 eth0 的 egress 下載 WAN → LAN 控制 eth1 的 ingress(轉發前)→ 用 IFB 重導再整形 因此: 重點:雖然下載的流量「進入 eth0」再被轉送到 eth1,但我們控制的是「eth0 的 ingress」,不是 eth1 的…

Read more

Using Apache 2.4 on AWS as a Reverse Proxy: Debugging 502s & Hardening in Practice (with vhost-scoped logs and rotatelogs)

Posted on 2025-11-052025-11-05 by Rico

This post summarizes a real troubleshooting session; all company/domain details are anonymized.Example domains use demodomain.com, e.g., wmsadmin.demodomain.com. Architecture Overview Typical vhost (simplified): Symptom Troubleshooting Flow (quick checklist) Raise timeouts only on long-running paths Avoid setting a huge global timeout that can tie up workers. Relax timeouts per URI: If mod_reqtimeout is enabled, prevent slow uploads…

Read more

在 AWS 上用 Apache 2.4 做反向代理:502 問題排查與實戰調校(含 vhost 分檔與 rotatelogs)

Posted on 2025-11-052025-11-05 by Rico

本文整理自一段真實排查經驗,所有公司與網域資訊已去識別化。範例網域以 demodomain.com 表示,例如 wmsadmin.demodomain.com。 架構概述 典型 vhost(簡化示意): 問題現象 排查思路(速查) 針對長耗時路徑「差異化」放寬 timeout 不要全站一刀切放到很長,避免把 worker 綁死;只對特定 URI 提高 timeout: 若有啟用 mod_reqtimeout,避免慢速上傳被切斷: 如何判讀「滿版的 trace 訊息」? 看到像這樣的行: 代表只是 偵錯等級很高時,Apache 把上游回應 header 與傳輸流程寫進 error log。不是錯誤。要看真正異常,請降回 LogLevel warn,或在 access log 先找 502 再對照 error log 該時段的 warn/error 級別訊息。 vhost 各自分檔記錄(擺脫 other_vhosts_access.log) 在每個 vhost 內指定 ErrorLog/CustomLog,最簡單: 如不想再用全域 other_vhosts_access.log,可停用: (注意:停用後,沒自訂 CustomLog 的 vhost…

Read more

自建防火牆,不干擾其他系統服務的防火牆規則

Posted on 2025-11-042025-11-04 by Rico

— 以 Docker、Fail2Ban 為例 — 在實際維運環境中,我們常會自己寫一份防火牆腳本來控管流量,例如 NAT、DNAT、上網白名單、時間限制等。但如果主機同時運行 Docker、Fail2Ban、libvirt 等服務,這些服務也會在 iptables 中自動產生規則。若不小心「清空整個防火牆」,就會把它們的規則一併刪除,導致容器、SSH、甚至 fail2ban 全部失效。 本文介紹一個簡潔安全的方式: 建立自有鏈 (custom chains),在不影響其他服務的前提下,自行維護防火牆邏輯。 🧩 為什麼會互相影響? 因為許多服務(像 Docker、Fail2Ban)啟動時都會自動執行: 或建立自己的鏈: 如果我們的腳本中也執行 iptables -F、iptables -X,那就會清空這些鏈的規則,導致: ✅ 解決原則:用「自有鏈」管理,不清整表 我們不再動系統原生的 INPUT、FORWARD、OUTPUT 等預設鏈,而是在它們裡面「插入一次跳轉」到我們自己的鏈,例如: 這樣: 🔧 實作架構範例 建立自有鏈(只清自己的鏈) 🔍 各表的職責清楚分工 Table 主要職責 我們自有鏈功能 filter ACL(放行、封鎖) FW-INPUT, FW-FORWARD(包含上網白名單、時間控管) nat 位址轉換 FW-PREROUTING(DNAT)、FW-POSTROUTING(MASQ / Hairpin) mangle 封包修改 FW-FORWARD(MSS Clamp for PPPoE)…

Read more

Understanding VLAN Configuration in Proxmox VE — A Practical Guide

Posted on 2025-11-042025-11-04 by Rico

Introduction In a virtualized environment, VLANs (Virtual LANs) play a crucial role in network isolation and segmentation.Within Proxmox VE (PVE), VLANs can be managed through Linux bridges (e.g., vmbr0) combined with VLAN tagging, allowing multiple VMs to share a single physical NIC while staying securely separated across different subnets.This article summarizes my hands-on experience configuring…

Read more

Proxmox VE 中的 VLAN 架構與 VM 網路設定實戰指南

Posted on 2025-11-042025-11-04 by Rico

前言 在虛擬化環境中,VLAN(Virtual LAN) 是網路隔離與分流的核心機制。在 Proxmox VE (PVE) 裡,透過 Linux Bridge(例如 vmbr0)搭配 VLAN tag,就能讓多個 VM 共用一張實體網卡,卻依然區隔不同子網。這篇文章記錄了我在實際部署過程中對 VLAN 架構的理解與設定步驟,作為日後參考筆記。 一、VLAN 的基本概念 在實體交換器(例如 Unifi、Juniper、Cisco)上,只要對 port 設為 Trunk 模式,允許多個 VLAN 通過,就能讓 Proxmox 的一張 NIC(例如 enp3s0)同時承載多個 VLAN。 二、Proxmox 中的網路邏輯 Proxmox 的網路基礎是 Linux Bridge。當你建立 vmbr0 時,它就像一個虛擬交換器,VM、Container 與實體網卡都能接在上面。 範例: 🔹 說明: 三、在 VM 上設定 VLAN Tag 每台 VM 的網卡(例如 net0)都可以指定 VLAN tag。當…

Read more

Posts pagination

  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Next

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