2023年5月5日 星期五

Allow CloudFront edge server only

服務有導入 CloudFront 的話,限制只有 CloudFront edge server 來存取會較安全

JSON 資料格式
https://d7uri8nf7uskq.cloudfront.net/tools/list-cloudfront-ips

ref. Locations and IP address ranges of CloudFront edge servers

2023年4月25日 星期二

Amazon Linux 2

可以把 Amazon Linux 2裝在自己的 VM 上
Run Amazon Linux 2 as a virtual machine on premises

要自訂帳密需自行建立 seed.iso,然後掛到光碟上,
seed.iso 內容只有兩個檔,meta-data 及 user-data
懶得自己建也可以用預設的 seed.iso

預設有四個帳號 user1, user2, user3, ec2-user
其中帳號 user1 及 ec2-user 可以用預設密碼 amazon 登入
user2 要設定 hashed passwd, 沒設定是無法登入
user3 是用 SSH key 登入
使用預設的 seed.iso 第一次開完最好把預設的 user 都刪除

2023年3月29日 星期三

Bash built-in case modification

BASH 有內建大小寫轉換功能,執行效率會比使用 tr, sed, awk 好

$ A=ABCdef

# To upper case
$ echo ${A^^}
ABCDEF

# To lower case
$ echo ${A,,}
abcdef

2023年3月23日 星期四

ifup and ifdown equivalent nmcli command

ifup eth0 = nmcli con up eth0
ifdown eth0 = nmcli con down eth0

ifup, ifdown command still available in NetworkManager-initscripts-updown package
dnf -y install NetworkManager-initscripts-updown

2023年3月12日 星期日

解決 Windows 工作排程器 錯誤訊息: 已回報下列錯誤: 工作定義使用了過時的功能

Windows不曉得何時拿掉了工作排程顯示訊息的功能,但還是能設定,後面括號(已過時)
最後會出現如下的畫面。
奇怪,不能設定為何不拿掉設定選項?


替代方式是用執行程式 msg
新增引數輸入 * 要顯示的訊息


2023年2月15日 星期三

2023年1月15日 星期日

Detect iPhone by Port 62078

現在手機預設都有開 Random MAC Address 的功能,也就是無法用 MAC 來判斷是那一家廠商
iPhone 手機有一個固定會 Listen 的 Port 62078,若 Scan 這個 Port 有回應,可以判斷這個 Device 可能是 iPhone
Android 則沒有固定會 Listen 的 Port

2023年1月9日 星期一

Using iperf3 to test uload and download

Server side
iperf3 -s

Client side
iperf3 -c server_host -b 10M -t 60 -P 5 # Test upload
iperf3 -c server_host -b 10M -t 60 -P 5 -R # Test download
頻寬 10M,測試時間 60 秒,使用 5 個平行連線
iperf3 只能一個 Client 對一個 Server
若要多個 Client 對同一台 Server,Server 端需執行多個 iperf3 用不同的 Port 切開

2023年1月6日 星期五

Detect if a VM is running in Google Compute Engine

Detect if a VM is running in Compute Engine

sudo dmidecode -s system-product-name | grep "Google Compute Engine"
這個需要 root 權限,實際上是去讀取 /sys/firmware/dmi/tables/DMI
用 strings /sys/firmware/dmi/tables/DMI | grep "Google Compute Engine" 也行

若程式沒有 root 權限,可以去讀取 /etc/hosts 有沒有包含 Added by Google 字樣
grep "Added by Google" /etc/hosts

2023年1月2日 星期一

RouterOS Packet Sniffer Streaming

RouterOS 的儲存空間有限,要分析封包可以用 Packet Sniffer Streaming,
將封包轉送到 PC,再用 Wireshark 收。
它會用 TZSP 封裝協定將封包再包一層後再轉送

Tools / Packet Sniffer / Streaming Enabled 打勾,輸入 Server IP 及 Port (預設37008)
Apply / Start,還可以下 Filter 條件

在 PC 端的 Wireshark 下 tzsp 過濾條件即可查看

RustDesk

RustDesk 使用上跟 Anydesk, Teamviewer 差不多,也是用 ID + Password 就可以連線 其優點是開源,可以自架 ID/Relay Server 在 Client 裝好的情況下,直接是可以使用的,預設應該是使用 RustDesk 的公共 Ser...