Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows Server

ตั้งค่า FTP over SSL (FTPS) บน Windows Server 2012 R2

ข้อเสียหลักของ FTP คือขาดการป้องกันและเข้ารหัสข้อมูลที่ถ่ายโอน Username และ Password ส่งเป็น Clear Text สำหรับการถ่ายโอนข้อมูล (โดยเฉพาะผ่านช่องสัญญาณสาธารณะ) ควรใช้โปรโตคอลที่ปลอดภัยกว่า เช่น FTPS หรือ SFTP

FTPS Protocol (FTP over SSL/TLS) คือส่วนขยายของ FTP มาตรฐาน แต่การเชื่อมต่อระหว่าง Client และ Server ได้รับการป้องกัน (เข้ารหัส) ด้วย SSL/TLS ใช้ Port 21 เดียวกัน Note: อย่าสับสน FTPS กับ SFTP (SSH FTP) ที่เป็นส่วนขยายของ SSH ไม่เกี่ยวข้องกับ FTP

ติดตั้ง FTP Server Role

ติดตั้ง Role FTP Server ใน Windows Server 2012 ไม่มีปัญยา (อธิบายไว้แล้วในที่อื่น)

สร้างและติดตั้ง SSL Certificate ใน IIS

  1. เปิด IIS Manager → Server → Server Certificates
  2. สร้าง Self-Signed Certificate (สำหรับ Demo) → Create Self-Signed Certificate
  3. ตั้งชื่อ Certificate และเลือก Type Web Hosting
  4. Certificate จะหมดอายุใน 1 ปี สำหรับ Production ควรใช้ Certificate จาก CA ที่เชื่อถือได้

สร้าง FTP Site รองรับ SSL

  1. ใน IIS Manager → คลิกขวา Sites → Add FTP Site
  2. ตั้งชื่อ และระบุ Path Root Directory (เช่น C:\inetpub\ftproot)
  3. เลือก Certificate ที่สร้างไว้ในส่วน SSL Certificates
  4. เลือก Authentication Type และ User Permissions (ค่าเริ่มต้น SSL บังคับ เข้ารหัสทั้ง Command และ Data)

FTPS และ Firewall

FTP ใช้ 2 TCP Connections: Command และ Data แต่ละ Data Channel เปิด Port แยกต่างหาก Firewall ทั่วไป Inspect FTP Traffic ได้ แต่อยู่ FTPS ข้อมูลเข้ารหัส Firewall ไม่สามารถวิเคราะห์ได้ → ไม่รู้ว่าจะเปิด Port ไหน

แก้ไข: กำหนด Port Range สำหรับ FTP Server ใน FTP Firewall Support ของ IIS Site แล้ว iisreset

Windows Firewall Rules ที่เกี่ยวข้อง:

  • FTP Server (FTP Traffic-In)
  • FTP Server Passive (FTP Passive Traffic-In)
  • FTP Server Secure (FTP SSL Traffic-In)

เปิด Port 21, 990 และ 50000-50100 (Port Range ที่กำหนด) บน Front Firewall

ทดสอบการเชื่อมต่อ FTPS ด้วย FileZilla

  1. เปิด FileZilla → File → Site Manager → New Site
  2. ระบุ: Host (FTPS Server), Protocol: Require explicit FTP over TLS, User, Ask for password
  3. Connect → ใส่ Password → ยอมรับ Certificate Warning (Self-Signed)
  4. Log แสดง: Status: Initializing TLS... Status: Verifying certificate... Status: TLS connection established. → เชื่อมต่อสำเร็จ