Honeypot Live Stats — 10 connections today from 5 unique IPs (10 total, 5 unique IPs all-time)
Kris Pham

Honeypot report: 2026-08-20

Reading time: ~1 minute

68 connections hit the honeypot on 2026-08-20, from 44 unique IP(s).

Top source IPs

111.207.227.228 — 6 connections
46.33.121.4 — 2 connections
73.177.188.238 — 2 connections
179.36.233.188 — 2 connections
193.57.42.42 — 2 connections

Commands attempted

/ip cloud print
ifconfig
uname -a
cat /proc/cpuinfo
ps | grep '[Mm]iner'
ps -ef | grep '[Mm]iner'
ls -la ~/.local/share/TelegramDesktop/tdata /home/*/.local/share/TelegramDesktop/tdata /dev/ttyGSM* /dev/ttyUSB-mod* /var/spool/sms/* /var/log/smsd.log /etc/smsd.conf* /usr/bin/qmuxd /var/qmux_connect_socket /etc/config/simman /dev/modem* /var/config/sms/*
locate D877F783D5D3EF8Cs
echo Hi | cat -n

Auto-generated from the Cowrie session logs. Updates automatically while the day is still in progress.


This day has ended — the numbers above are final and will not change further.

Lỗi và cách xử lý

Reading time: 12 minutes

Danh sách đầy đủ mọi lỗi và trục trặc gặp phải trong suốt quá trình dựng server, honeypot và blog này — kèm đúng nội dung lỗi gốc và cách xử lý từng cái. Hơn 30 lỗi lớn nhỏ, phần lớn rơi vào ba nhóm: nhầm cửa sổ terminal, giá trị lưu cứng (IP/domain) không tự cập nhật, và khác biệt Amazon Linux so với Ubuntu/Debian.

I. Nhầm lẫn terminal

Đây là nhóm lỗi lặp lại nhiều nhất trong cả quá trình.

Gõ lệnh Linux vào PowerShell Windows:

PS C:\WINDOWS\system32> sudo chgrp nginx /var/lib/php/session
Sudo is disabled on this machine. To enable it, go to the Developer Settings page in the Settings app

Cách xử lý: luôn nhìn prompt trước khi gõ — PS C:\...> là Windows, [ec2-user@...]$ là server.

Gõ ssh bên trong session SSH đã kết nối, server tự SSH vào chính nó, báo yêu cầu xác nhận fingerprint mới dù đang đứng ngay trong server. Cách xử lý: nếu đã thấy prompt [ec2-user@...]$ thì không cần gõ ssh nữa.

Nhiều lệnh dán cùng lúc ngay sau sudo su - cowrie bị nuốt mất:

[ec2-user@...]$ sudo su - cowrie
cd cowrie
rm -rf cowrie-env
python3.11 -m venv cowrie-env
source cowrie-env/bin/activate
Last login: ...
[cowrie@... ~]$

Không có dòng nào trong 4 lệnh sau thực sự chạy — prompt vẫn ở thư mục home, chưa vào cowrie-env. Cách xử lý: chạy từng lệnh một, đợi lệnh trước chạy xong mới gõ lệnh kế tiếp.

II. Cài đặt EC2 và Bludit

Chọn instance type t2.micro:

This instance type is not eligible under the Free Plan.
Upgrade your account plan to access this instance type.

Cách xử lý: đổi sang t3.micro, loại được đánh dấu Free tier eligible cho tài khoản này.

SSH báo lỗi quyền file key:

Permissions for 'C:\\AWS\\my-key.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "C:\\AWS\\my-key.pem": bad permissions
ec2-user@3.26.204.172: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Cách xử lý:

icacls "C:\AWS\my-key.pem" /inheritance:r
icacls "C:\AWS\my-key.pem" /grant:r "$env:USERNAME:(R)"

Tải bludit-files.zip báo lỗi:

HTTP request sent, awaiting response... 404 Not Found

Cách xử lý: tải trực tiếp source code từ nhánh master (archive/refs/heads/master.zip) thay vì tìm release asset.

Vào trang admin Bludit chỉ thấy một dòng chỏ:

Bludit CMS. Session initialization failed.

Cách xử lý: PHP-FPM chạy dưới user nginx nhưng thư mục session PHP mặc định (/var/lib/php/session) chỉ cho group apache ghi — sửa quyền:

sudo chgrp nginx /var/lib/php/session
sudo chmod 770 /var/lib/php/session
sudo systemctl restart php-fpm

III. Domain, HTTPS và IP

Đổi Elastic IP xong, giao diện mất hết CSS, trang chỉ còn chữ thô không định dạng. Kiểm tra Console thấy hàng loạt:

Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
3.26.204.172/bl-theme.../img/favicon.png:1

Nguyên nhân: Bludit lưu cứng IP cũ làm base URL trong site.php. Cách xử lý:

sudo sed -i 's/OLD_IP/NEW_IP/g' bl-content/databases/site.php

Bật HTTPS xong, giao diện vỡ lần nữa vì cùng lý do, lần này Console báo:

Mixed Content: The page at 'https://...' was loaded over HTTPS,
but requested an insecure script/stylesheet '...'.
This request has been blocked; the content must be served over HTTPS.

Cách xử lý: sed lại site.php, lần này đổi http:// thành https://.

Certbot chạy lần đầu báo:

Could not install certificate
Could not automatically find a matching server block for [domain].
Set the `server_name` directive to use the Nginx installer.

Nguyên nhân: nginx.conf vẫn còn server_name _; — certbot hiểu đây là giá trị thật, không phải chỗ để trống. Cách xử lý: đổi thành domain thật, reload nginx, chạy lại certbot install --cert-name [domain].

IV. Honeypot Cowrie

$ sudo adduser --disabled-password --gecos "" cowrie
adduser: unrecognized option '--disabled-password'

Cách xử lý (cú pháp Amazon Linux thay cho Ubuntu/Debian):

sudo useradd -m -s /bin/bash cowrie
sudo passwd -l cowrie
$ cp etc/cowrie.cfg.dist etc/cowrie.cfg
cp: cannot stat 'etc/cowrie.cfg.dist': No such file or directory

Cách xử lý: find . -name "cowrie.cfg*" để tìm ra đường dẫn thật (src/cowrie/data/etc/cowrie.cfg.dist) — bản mới đổi cấu trúc thư mục.

ERROR: Package 'cowrie' requires a different Python: 3.9.25 not in '<4,>=3.10'

Cách xử lý: cài python3.11, tạo lại venv bằng đúng bản Python mới.

$ bin/cowrie start
-bash: bin/cowrie: No such file or directory

Cách xử lý: bản mới dùng lệnh cowrie cài qua pip, không còn script bin/cowrie — chạy pip install -e . để đăng ký lệnh, rồi gọi thẳng cowrie start.

$ sudo iptables -t nat -A PREROUTING ...
sudo: iptables: command not found

Cách xử lý: sudo dnf install -y iptables (Amazon Linux 2023 dùng nftables mặc định, không cài sẵn iptables).

V. Bảo mật và mật khẩu

Log Cowrie ghi lại nguyên văn:

login attempt [test/Duckhai1412@] succeeded

Đây là password thật gõ nhầm lúc test — cảnh báo đổi ngay ở nơi khác nếu có dùng thật.

Test truy cập /admin không thấy popup xác thực Basic Auth như mong đợi, nhưng kiểm tra độc lập lại đúng:

$ curl -I https://khaipham.duckdns.org/admin/dashboard
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="Restricted"

Kết luận: cấu hình đúng, chỉ là trình duyệt tự nhớ mật khẩu đã nhập trước đó.

VI. Xử lý nội dung và file lớn

Heredoc dài bị dán lẫn lộn — nội dung file honeypot_blog.py bị chèn nhầm dòng sudo chmod +x ngay giữa thân hàm Python, khiến file hỏng hoàn toàn. Cách xử lý: chuyển sang mã hoá base64 một dòng, dùng echo '...' | base64 -d | sudo tee file > /dev/null.

Bấm nhầm "Move to Static" trong menu quản trị, bài Honeypot report biến mất khỏi danh sách Pages. Cách xử lý: vào tab Static, dùng "Move to Pages" để đưa về lại.

Kéo-thả sắp xếp thứ tự bài viết không hoạt động — dùng chức năng Sticky thay thế để ghim bài lên đầu.

File artifact tổng hợp hiển thị lỗi font:

<title>Nhật Ký Honeypot</title>

Nguyên nhân: PowerShell Get-Content/Set-Content không tường minh UTF-8 khi ghép nội dung. Cách xử lý: dùng [System.IO.File]::ReadAllText/WriteAllText với UTF8Encoding tường minh.

Chuỗi base64 dài khoảng 8500 ký tự dán một lần bị lỗi:

base64: invalid input
Traceback (most recent call last):
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 4869: invalid start byte

Cách xử lý: chia thành 4 đoạn nhỏ hơn, nối bằng lệnh append (>>), giải mã một lần duy nhất ở bước cuối.

File tạm từ lần thất bại trước còn sót lại, thuộc quyền root:

-bash: /tmp/build_log_post.txt: Permission denied

Cách xử lý: sudo rm -f /tmp/build_log_post.txt trước khi tạo lại.

VII. Kết nối mạng

ssh: connect to host 54.66.147.65 port 2222: Connection timed out

Xuất hiện lặp lại nhiều lần vì IP nhà bạn hay đổi (mạng Việt Nam dùng IP động). Cách xử lý: kiểm tra IP hiện tại qua icanhazip.com, cập nhật lại rule Security Group.

Lần cuối, timeout xảy ra dù Security Group và Instance state đều kiểm tra đúng hoàn toàn (Running, 3/3 status check passed). Đã cân nhắc phương án dự phòng EC2 Instance Connect và Serial Console, nhưng hoá ra chỉ là trục trặc mạng tạm thời phía máy người dùng, tự hết khi thử lại.

Điều rút ra

Không có lỗi nào trong danh sách này đến từ một quyết định kiến trúc sai — gần như toàn bộ là chi tiết nhỏ: nhầm cửa sổ, một giá trị lưu cứng không được cập nhật theo, một câu lệnh viết cho hệ điều hành khác. Cách xử lý luôn giống nhau: xác định

Nhật ký triển khai

Reading time: 9 minutes

Toàn bộ chặng đường từ một máy chủ EC2 trống, đến một website Bludit hoàn chỉnh, có tên miền, HTTPS, và một honeypot SSH tự viết blog về chính những kẻ đang cố tấn công nó. Phạm vi: 14–19/8/2026.

Trạng thái hiện tại

MụcGiá trị
Domainkhaipham.duckdns.org
Elastic IP54.66.147.65
SSH quản trịport 2222, chỉ cho IP của chủ
Honeypot Cowrieport 22 công khai → 2223 nội bộ
CMSBludit, theme Flavor
Tự động hoácron mỗi 15 phút, systemd khi reboot

I. Dựng nền tảng — server và website

1. Khởi tạo EC2 và cài Bludit CMS

Từ dashboard EC2 trống, launch instance t3.micro chạy Amazon Linux 2023 (region Sydney), tạo key pair, mở security group cho SSH và HTTP. Cài nginx + php-fpm, tải mã nguồn Bludit trực tiếp từ GitHub, dựng cấu hình nginx route qua PHP.

Vướng mắc chính: bản Bludit từ nhánh master đi kèm sẵn tài khoản demo admin/admin — đổi mật khẩu ngay sau khi đăng nhập lần đầu. Lỗi "Session initialization failed" hoá ra do PHP-FPM chạy dưới user nginx nhưng thư mục session PHP mặc định chỉ cho apache ghi — sửa quyền thư mục là xong.

2. Elastic IP, tên miền và HTTPS thật

Gắn Elastic IP trước để IP không đổi mỗi lần restart — nhưng việc gắn IP mới lập tức làm vỡ giao diện, vì Bludit lưu cứng IP cũ làm base URL trong site.php, khiến CSS/JS bị trình duyệt chặn. Sửa bằng một dòng sed thay IP cũ bằng IP mới.

Đăng ký subdomain miễn phí trên DuckDNS, trỏ về Elastic IP. Cài Certbot qua Python venv (Amazon Linux không có sẵn gói này), lấy chứng chỉ Let's Encrypt. Lần chạy đầu thất bại vì nginx.conf vẫn còn server_name _; — một giá trị thật, không phải chỗ để trống, nên Certbot không khớp được block nào. Sau khi bật HTTPS, giao diện vỡ lần nữa vì cùng lý do — base URL vẫn lưu http:// thay vì https://.

Bài học lặp lại: bất cứ thứ gì lưu cứng base URL của site sẽ "cắn" bạn hai lần — một lần khi đổi IP, một lần khi đổi giao thức.

II. Honeypot — dựng cái bẫy

3. Nhường port 22 lại — chuyển SSH thật sang 2222

Trước khi đặt bẫy, SSH thật được chuyển sang port 2222, kiểm tra kết nối ổn định từ một cửa sổ terminal riêng trước khi đóng port 22 cũ, tránh tự khoá mình ra khỏi server.

sudo sed -i '/^#Port 22$/a Port 22\nPort 2222' /etc/ssh/sshd_config
sudo systemctl restart sshd
sudo sed -i '/^Port 22$/d' /etc/ssh/sshd_config
sudo systemctl restart sshd

4. Cài Cowrie — SSH giả để bẫy kẻ quét mạng

Tạo user riêng cowrie (khoá mật khẩu đăng nhập), cài Python 3.11 vì Cowrie mới nhất yêu cầu ≥3.10 trong khi Amazon Linux chỉ có 3.9 mặc định. Port SSH mặc định của Cowrie (2222) trùng với SSH thật vừa chuyển sang — đổi Cowrie sang port nội bộ 2223. Dùng iptables chuyển hướng port 22 công khai sang 2223 nội bộ.

sudo iptables -t nat -A PREROUTING -p tcp --dport 22 -j REDIRECT --to-port 2223

Kiểm chứng ngay: honeypot chấp nhận đăng nhập với mật khẩu bất kỳ, giả lập hệ thống Debian cũ (kernel 2.6.26) để dụ kẻ tấn công ở lại lâu hơn.

5. Script tự động biến log thành bài blog

Một script Python đọc log JSON của Cowrie, đếm kết nối và IP nguồn trong ngày, ghi trực tiếp vào file nội dung bài viết và database metadata của Bludit — không qua trang quản trị. Cài cronie (Amazon Linux không có cron sẵn), đặt lịch chạy mỗi 15 phút.

III. Bảo mật & vận hành lâu dài

6. Thêm một lớp khoá trước cửa quản trị

Gắn HTTP Basic Auth ở tầng nginx cho riêng /admin — trước khi chạm được form đăng nhập Bludit, trình duyệt phải qua thêm một lớp xác thực khác. Xác minh bằng curl -I để thấy đúng 401 Unauthorized.

7. Sống lại sau khi reboot

Cả Cowrie lẫn rule iptables ban đầu chỉ chạy tạm — restart server là mất. Biến cả hai thành systemd service, bật enable để tự khởi động cùng hệ thống.

8. Để mỗi báo cáo tự nói rõ nó đã cũ hay còn sống

Bài "Honeypot report" của hôm nay cập nhật liên tục, còn bài của ngày đã qua đứng yên vĩnh viễn — dễ gây nhầm là dữ liệu trùng lặp. Script được bổ sung: mỗi lần chạy, tự kiểm tra báo cáo của các ngày đã qua chưa có dấu "đã chốt", rồi tự thêm ghi chú cố định vào cuối bài đó.

IV. Nội dung, giao diện & để Google tìm thấy

9. Viết lại hành trình thành bài blog thật

Hai bài viết thủ công kể lại quá trình build: "Building my first honeypot on AWS" và "Getting a real domain and real HTTPS", cùng bài "Every command" gom toàn bộ lệnh đã dùng để tra cứu nhanh.

10. Đổi giao diện và cá nhân hoá

Chuyển từ theme mặc định Alternative sang Flavor — tối giản hơn, dùng Tailwind. Đổi tên site từ "BLUDIT" thành tên riêng, viết lại banner "Honeypot Live Stats" cho khớp hệ màu theme mới.

11. Khai báo với Google

Bật plugin Sitemap có sẵn của Bludit để tự sinh sitemap.xml. Đăng ký Google Search Console, xác minh quyền sở hữu bằng file HTML tải lên thư mục gốc, nộp sitemap — miễn phí hoàn toàn.

Nhìn lại

Điểm chung xuyên suốt: hầu hết sự cố không đến từ một lệnh sai, mà từ việc một nơi nào đó lưu cứng một giá trị — IP, giao thức, tên miền — rồi thứ đó thay đổi mà không ai báo cho nơi lưu biết. Cách xử lý mỗi lần cũng giống nhau: tìm đúng nơi lưu, sửa, rồi xác minh lại bằng công cụ độc lập thay vì chỉ tin cảm giác "chắc là được rồi".

Server hiện tự vận hành: honeypot ghi log, script mỗi 15 phút biến log thành bài viết, systemd giữ mọi thứ sống qua reboot.

Getting a real domain and real HTTPS

Reading time: 2 minutes

Next goal: stop serving this off a bare IP and get it behind a real domain with real HTTPS.

Free domain

Used DuckDNS for a free subdomain. First attempt at pointing it went into the wrong field entirely — DuckDNS splits IPv4 and IPv6 into separate boxes, and the server's IP ended up typed into the IPv6 one by mistake. Fixed by moving it to the right field.

Elastic IP first

Before pointing a domain at anything, allocated an Elastic IP and associated it with the instance, so the address wouldn't shift on a stop/start. Associating it changed the public IP immediately — and broke the site's styling, because Bludit had the old IP baked into its site config as the base URL. Every CSS and JS request was still trying to load from an address that no longer pointed here.

sudo sed -i 's/OLD_IP/NEW_IP/g' bl-content/databases/site.php

Certbot

Amazon Linux doesn't ship certbot in its repos, so it went in through a Python venv instead:

sudo dnf install -y python3 augeas-libs
sudo python3 -m venv /opt/certbot/
sudo /opt/certbot/bin/pip install --upgrade pip
sudo /opt/certbot/bin/pip install certbot certbot-nginx
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot

First run failed — certbot couldn't find a matching nginx server block, because nginx.conf still had server_name _;, a wildcard that doesn't match a real domain name. Swapped it for the actual domain, reloaded nginx, then re-ran the install step and the cert deployed cleanly.

The mixed-content trap, again

Switching to https:// broke styling a second time, same root cause as the IP change: the site's base URL was still saved as http://, so the browser blocked every asset as insecure mixed content. One more sed against site.php, this time swapping the scheme, fixed it for good.

What I actually learned

Whatever stores your site's base URL will bite you twice — once when the IP changes, once when the scheme does. Elastic IP before DNS, DNS before certs, in that order, saves a redo. And server_name _; is a real value, not a placeholder — certbot takes it literally.

Every command

Reading time: 2 minutes

A reference dump of every command from the honeypot and domain/HTTPS posts — no narrative, just the commands, grouped by post.

From: Building my first honeypot on AWS

sudo sed -i '/^#Port 22$/a Port 22\nPort 2222' /etc/ssh/sshd_config
sudo systemctl restart sshd
sudo sed -i '/^Port 22$/d' /etc/ssh/sshd_config
sudo systemctl restart sshd
sudo useradd -m -s /bin/bash cowrie
sudo passwd -l cowrie
sudo dnf install -y git python3.11 python3-pip python3-devel openssl-devel libffi-devel gcc gcc-c++ make
sudo su - cowrie
git clone https://github.com/cowrie/cowrie
cd cowrie
python3.11 -m venv cowrie-env
source cowrie-env/bin/activate
pip install -r requirements.txt
pip install -e .
cp src/cowrie/data/etc/cowrie.cfg.dist etc/cowrie.cfg
sed -i 's/listen_endpoints = tcp:2222:interface=0.0.0.0/listen_endpoints = tcp:2223:interface=0.0.0.0/' etc/cowrie.cfg
cowrie start
sudo iptables -t nat -A PREROUTING -p tcp --dport 22 -j REDIRECT --to-port 2223

From: Getting a real domain and real HTTPS

sudo sed -i 's/OLD_IP/NEW_IP/g' bl-content/databases/site.php
sudo dnf install -y python3 augeas-libs
sudo python3 -m venv /opt/certbot/
sudo /opt/certbot/bin/pip install --upgrade pip
sudo /opt/certbot/bin/pip install certbot certbot-nginx
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot
sudo certbot --nginx -d DOMAIN
sudo certbot install --cert-name DOMAIN
sudo sed -i 's/http:\/\/DOMAIN/https:\/\/DOMAIN/g' bl-content/databases/site.php

Automating the blog

sudo dnf install -y cronie
sudo systemctl enable --now crond
echo '*/15 * * * * root /usr/bin/python3 /usr/local/bin/honeypot_blog.py >> /var/log/honeypot_blog.log 2>&1' | sudo tee /etc/cron.d/honeypot-blog

Honeypot report: 2026-08-19

Reading time: 2 minutes

219 connections hit the honeypot on 2026-08-19, from 59 unique IP(s).

Top source IPs

91.92.47.123 — 98 connections
27.79.3.95 — 11 connections
36.94.140.29 — 11 connections
116.110.152.194 — 6 connections
3.232.93.173 — 6 connections

Commands attempted

uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m
uname -s -v -n -r -m

Auto-generated from the Cowrie session logs. Updates automatically while the day is still in progress.


This day has ended — the numbers above are final and will not change further.