การเข้าถึง Sshwifty
- เปิดเบราว์เซอร์แล้วไปที่:
https://<SERVER_IP> - คาดว่าจะมีคำเตือน SSL จากเบราว์เซอร์ (self-signed certificate)
- ต้องมีการยืนยันตัวตน (Basic Auth popup)
- วิธียืนยันตัวตน: HTTP Basic Auth
- ข้อมูล credentials ถูกเก็บอย่างปลอดภัยใน:
/root/.cloudzy-creds
ไฟล์และไดเรกทอรีสำคัญ
- ไดเรกทอรี่การติดตั้ง:
/root/sshwifty - ไฟล์ Docker Compose:
/root/sshwifty/docker-compose.yml - ข้อมูลประจำตัวที่บันทึกไว้:
/root/.cloudzy-creds - เซิร์ฟเวอร์เสมือน Nginx:
/etc/nginx/sites-available/sshwifty.conf - ไฟล์ Basic Auth:
/etc/nginx/auth/sshwifty.htpasswd - ใบรับรอง TLS:
/etc/nginx/ssl
หมายเหตุด้านความปลอดภัย
- Only Nginx ฟังบนพอร์ตสาธารณะ
- การเข้าถึงได้รับการป้องกันด้วย Basic Auth
- TLS ใช้ใบรับรองแบบ self-signed
- ข้อมูลรับรองความถูกต้องถูกจัดเก็บด้วยสิทธิ์การเข้าถึงที่จำกัด
เปิดใช้งาน SSL พร้อมโดเมน
1. ชี้โดเมนของคุณไปที่ IP ของเซิร์ฟเวอร์
2. แก้ไขไฟล์คอนฟิก Nginx และแทนที่ทั้งสองส่วน server_name <IP>; ด้วยโดเมนของคุณ (<your-domain>) สำหรับทั้งบล็อก HTTP (port 80) และ HTTPS (port 443):
vim /etc/nginx/sites-available/sshwifty.conf
3. ติดตั้ง Certbot:
apt install -y certbot python3-certbot-nginx
4. รันคำสั่งต่อไปนี้เพื่อสร้างใบรับรอง Let's Encrypt ที่ถูกต้อง:
certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com
5. แทนที่พาธ SSL ในไฟล์คอนฟิก Nginx:
vim /etc/nginx/sites-available/sshwifty.conf
# Before:
# ssl_certificate /etc/nginx/ssl/fullchain.pem;
# ssl_certificate_key /etc/nginx/ssl/privkey.pem;
# After:
# ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
6. รีสตาร์ท Nginx เพื่อให้การเปลี่ยนแปลงมีผล:
systemctl restart nginx
7. เปิดเบราว์เซอร์และไปที่: https://yourdomain.com