在查詢一個域名時,若當資料不存在,會出現 NXDOMAIN
DNS 也會 cache 這個查不到的結果,其預設的 TTL 跟 DNS 及 Zone 的 SOA TTL 有關
例如 BIND 的 max-ncache-ttl 預設是 10800 秒
當 SOA 中的 TTL 小於 DNS 的 ncache-ttl,會看 SOA 中的 TTL
某些情境,需要比較快速查到最新資料,需要縮短這個值,BIND 的 max-ncache-ttl 可以設 0
也就是 disable negative cache,遇到 NXDOMAIN 都不 cache
這樣設定的話,本來沒設定的域名,設了解析後就可以馬上查到,公用服務的 DNS 不建議這樣設定
Pank's Blog
2024年3月14日 星期四
2024年2月22日 星期四
Install w3m in Rocky Linux
Rocky Linux 中安裝 w3m 需要啟用 powertools repo
未啟用前安裝會出現此錯誤
- nothing provides perl(NKF) needed by w3m-0.5.3-60.git20230121.el8.x86_64 from epel
啟用 powertools repo 指令
dnf config-manager --set-enabled powertools
dnf -y install w3m
未啟用前安裝會出現此錯誤
- nothing provides perl(NKF) needed by w3m-0.5.3-60.git20230121.el8.x86_64 from epel
啟用 powertools repo 指令
dnf config-manager --set-enabled powertools
dnf -y install w3m
2024年1月20日 星期六
Han River Running Place 2024 (潭子旱溪大操場)
由於 旱溪西路拓寬 (2023-08-31 開放通車),有部份自行車道被犧牲了,破壞了原本一圈 5.7K 的 旱溪大操場,
現在旱溪西路從松竹路口往北,過南興北二路一點點,自行車道就沒了,只有 1.2K。
附圖潭興路以北區塊,就是小一點的潭子旱溪大操場,一圈 3.3K。
地圖的右下角綠色起點右側是聚興福德爺廟,有飲水機可以喝水,也有厠所,需過馬路。
根據台中市政府的公告,會將犧牲掉的自行車道再補回來,期待旱溪大操場早日回歸
「市府觀旅局已將自行車道改道至旱溪東路,目前也積極爭取中央補助計畫,新設自行車道併同人行道整體規劃,
預計建置於旱溪西路堤頂上,透過分階段調整的方式,將原有旱溪西路的道路環境做更完善的規劃。」
現在旱溪西路從松竹路口往北,過南興北二路一點點,自行車道就沒了,只有 1.2K。
附圖潭興路以北區塊,就是小一點的潭子旱溪大操場,一圈 3.3K。
地圖的右下角綠色起點右側是聚興福德爺廟,有飲水機可以喝水,也有厠所,需過馬路。
根據台中市政府的公告,會將犧牲掉的自行車道再補回來,期待旱溪大操場早日回歸
「市府觀旅局已將自行車道改道至旱溪東路,目前也積極爭取中央補助計畫,新設自行車道併同人行道整體規劃,
預計建置於旱溪西路堤頂上,透過分階段調整的方式,將原有旱溪西路的道路環境做更完善的規劃。」
2023年12月31日 星期日
cstream - stream limit tool
cstream 通用串流處理工具
此工具可以將 output 做限流處理,本來在找降低 mysqldump loading 的方案,
看到 這篇 回文,裡面提到將 mysqldump pipe 給 cstream 限速。
實測的確有效,大幅降低 mysqldump 期間對服務效能造成的影響
另一個應用範例: 下載限速 1MB/s
curl https://osk-jp-ping.vultr.com/vultr.com.100MB.bin | cstream -t 1048576 > output
當然,curl 本身就有限速參數,上面經由 cstream 限速的語法效果跟下面這句相同
curl --limit-rate 1048576 https://osk-jp-ping.vultr.com/vultr.com.100MB.bin > output
Get IP addresses by ASN
whois -h whois.radb.net -i origin AS15169 | grep ^route
result
route: IPv4 network segment
route6: IPv6 network segment
2023年11月17日 星期五
Fix Unable to detect release version (use '--releasever' to specify release version)
rpm -ivh https://mirror01.idc.hinet.net/CentOS/8-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-6.el8.noarch.rpm
rpm -ivh https://mirror01.idc.hinet.net/CentOS/8-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-8-6.el8.noarch.rpm
rpm -ivh https://mirror01.idc.hinet.net/CentOS/8-stream/BaseOS/x86_64/os/Packages/centos-stream-release-8.6-1.el8.noarch.rpm
會遇到這個問題是在 migrate to Rocky Linux 時中斷造成
再次執行 migrate2rocky.sh 腳本會出現錯誤
Found a full or partial RockyLinux install already in place. Aborting
because continuing with the migration could cause further damage to system.
修改 migrate2rocky.sh 把出現上面訊息的 if 那一段拿掉,上面的 rpm 補完,再執行一次就可以了
rpm -ivh https://mirror01.idc.hinet.net/CentOS/8-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-8-6.el8.noarch.rpm
rpm -ivh https://mirror01.idc.hinet.net/CentOS/8-stream/BaseOS/x86_64/os/Packages/centos-stream-release-8.6-1.el8.noarch.rpm
會遇到這個問題是在 migrate to Rocky Linux 時中斷造成
再次執行 migrate2rocky.sh 腳本會出現錯誤
Found a full or partial RockyLinux install already in place. Aborting
because continuing with the migration could cause further damage to system.
修改 migrate2rocky.sh 把出現上面訊息的 if 那一段拿掉,上面的 rpm 補完,再執行一次就可以了
2023年11月2日 星期四
SSH via Shadowsocks
Local address: 127.0.0.1
Local port: 1080
Server IP: 12.34.56.78
~/.ssh/config 加入
Host *
若要 ssh 到 Server IP,改用 ssh 127.0.0.1
Local port: 1080
Server IP: 12.34.56.78
~/.ssh/config 加入
Host *
ProxyCommand connect-proxy -S 127.0.0.1:1080 %h %p
若要 ssh 到 Server IP,改用 ssh 127.0.0.1
2023年9月8日 星期五
Fix Ubuntu NO_PUBKEY B53DC80D13EDEF05
Google Cloud package update failed
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
2023年8月10日 星期四
HAProxy Reverse Proxy with SSL
憑證掛在 Reverse Proxy, 內部走 HTTP
frontend http-in
backend test1.pank.org
backend test2.pank.org
test1.pank.org 及 test2.pank.org 使用同一個 wildcard 憑證,
crt 是 crt+chain+key 放同一個檔
若兩個站的憑證不同,可以用 crt-list 指定多個憑證
例: bind *:443 ssl crt-list /etc/haproxy/crt-list.txt
crt-list.txt 的內容
/etc/haproxy/domain1.com-crt-chain-key.pem
/etc/haproxy/domain2.com-crt-chain-key.pem
有設定 option forwardfor 會帶 X-Forwarded-For 到 backend server
frontend http-in
mode http
bind *:80
bind *:443 ssl crt /etc/haproxy/pank.org-crt-chain-key.pem
use_backend %[req.hdr(Host),lower]
bind *:80
bind *:443 ssl crt /etc/haproxy/pank.org-crt-chain-key.pem
use_backend %[req.hdr(Host),lower]
backend test1.pank.org
balance first
mode http
option forwardfor except 127.0.0.0/8
server web-1 192.168.0.27:80
mode http
option forwardfor except 127.0.0.0/8
server web-1 192.168.0.27:80
backend test2.pank.org
balance first
mode http
option forwardfor except 127.0.0.0/8
server web-2 192.168.0.42:80
mode http
option forwardfor except 127.0.0.0/8
server web-2 192.168.0.42:80
test1.pank.org 及 test2.pank.org 使用同一個 wildcard 憑證,
crt 是 crt+chain+key 放同一個檔
若兩個站的憑證不同,可以用 crt-list 指定多個憑證
例: bind *:443 ssl crt-list /etc/haproxy/crt-list.txt
crt-list.txt 的內容
/etc/haproxy/domain1.com-crt-chain-key.pem
/etc/haproxy/domain2.com-crt-chain-key.pem
有設定 option forwardfor 會帶 X-Forwarded-For 到 backend server
2023年8月9日 星期三
NGINX Reverse Proxy with SSL
憑證掛在 Reverse Proxy, 內部走 HTTP
/etc/nginx/conf.d/test1.conf
server {
若後端有多台,建立多個 conf 即可
有設定 proxy_set_header X-Forwarded-For 會帶 X-Forwarded-For 到 backend server
/etc/nginx/conf.d/test1.conf
server {
listen 443 ssl;
server_name test1.pank.org;
ssl_certificate /etc/nginx/conf.d/pank.org-crt-chain.pem;
ssl_certificate_key /etc/nginx/conf.d/pank.org-key.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
server_name test1.pank.org;
ssl_certificate /etc/nginx/conf.d/pank.org-crt-chain.pem;
ssl_certificate_key /etc/nginx/conf.d/pank.org-key.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
add_header X-Proxy-Cache $upstream_cache_status;
proxy_pass http://192.168.0.27;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.0.27;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}若後端有多台,建立多個 conf 即可
有設定 proxy_set_header X-Forwarded-For 會帶 X-Forwarded-For 到 backend server
訂閱:
文章 (Atom)
DNS negative cache
在查詢一個域名時,若當資料不存在,會出現 NXDOMAIN DNS 也會 cache 這個查不到的結果,其預設的 TTL 跟 DNS 及 Zone 的 SOA TTL 有關 例如 BIND 的 max-ncache-ttl 預設是 10800 秒 當 SOA 中的 TTL 小於 ...
-
openfortivpn 和 FortiClient VPN 相容,若不想用官方的 Client 可以試試 只是它是命令列模式,沒有 GUI 使用很簡單 openfortivpn vpn-gateway:8443 -u username 然後會提示輸入 Password 若憑...
-
以前都是用 rp-pppoe 套件裡的 adsl-setup 來設定 PPPoE 現在比較新的 Linux 已經沒有這個套件了,要用 NetworkManager 的 nmcli 來設定 設定也很簡單,準備帳號、密碼及網路卡就行了 以下範例帳號是 xxxx@hinet.net 密...
-
電腦不符合 Windows 11 需求,也可以安裝 Windows 11 安裝流程第一個畫面按 Shift-F10 開啟 CMD 下指令 reg add HKLM\System\Setup\LabConfig /v "BypassTPMCheck" /t RE...
-
RouterOS 的管理工具 winbox,因為還不支援 UTF-8, 雖然可以在 Wireless 設定中文的 SSID,但是實際上會看到亂碼, WiFi 的 SSID 是走 UTF-8 編碼,需要把 UTF-8 中文轉成 HEX 碼,再用指令設定 寫了一個小工具提供大家使用...
-
禁止 LINE 電腦版自動或強制更新的方法 LINE 電腦版啟動都會去連這個更新資訊檔 https://desktop.line-scdn.net/win/v1/real/update_info.json 內容大概長這樣 可以看出針對各版本的更新 type 有 force, ...
-
現在自架的 Mail Server 若沒有簽章,寄出的信件有很大的機會被擋或歸類在垃圾信 所以 SPF + DKIM 已經是必要的設定 環境 CentOS + Postfix,文中的域名均以 yourdomain.com 作為範例 安裝所需套件 yum -y install py...
-
禁止 LINE 電腦版傳送連線診斷報告 當把 desktop.line-scdn.net 擋掉時 (ref. Disable LINE desktop force update ), LINE 會傳送連線診斷報告到 nelo2-col.linecorp.com, 內容 body ...
-
由於 旱溪西路拓寬 (2023-08-31 開放通車),有部份自行車道被犧牲了,破壞了原本一圈 5.7K 的 旱溪大操場 , 現在旱溪西路從松竹路口往北,過南興北二路一點點,自行車道就沒了,只有 1.2K。 附圖潭興路以北區塊,就是小一點的潭子旱溪大操場,一圈 3.3K。 ...
-
CentOS 7 的更新支援到 2024-06-30 CentOS 8 的更新支援到 2021年底 CentOS 的替代方案有 1. CentOS Stream 如果 Server 目前是運行 CentOS 8,轉換到 CentOS Stream 應該是最佳選擇 兩行指令即可進...
-
What if I use G Suite legacy free edition for personal use? Google 一月宣布收掉免費版的 G Suite,一定收到不少抱怨,最後做出了讓步, 保留非商業個人用途可以繼續使用免費版的 G Suite 符合條件的人還...