เปิด LDAPS บน Windows Server 2022 แบบละเอียด
LDAPS (LDAP over SSL/TLS) คือการเข้ารหัสการสื่อสารของ LDAP เพื่อเพิ่มความปลอดภัยในการตรวจสอบสิทธิ์ผู้ใช้งานและการเข้าถึงข้อมูล Active Directory
ในปัจจุบัน Microsoft และผู้ผลิตระบบต่างๆ แนะนำให้ใช้ LDAPS แทน LDAP แบบปกติ เนื่องจากสามารถป้องกันการดักจับ Username และ Password ผ่านเครือข่ายได้
บทความนี้จะอธิบายวิธีเปิด LDAPS บน Windows Server 2022 แบบละเอียด พร้อมวิธีตรวจสอบและแก้ไขปัญหาที่พบบ่อย
📌 LDAPS คืออะไร
LDAPS คือ
LDAP over SSL/TLS
เป็นการนำ LDAP มาเข้ารหัสข้อมูลด้วย Certificate
ตัวอย่าง
LDAP
Port 389
ข้อมูลถูกส่งแบบไม่เข้ารหัส
ส่วน
LDAPS
Port 636
ข้อมูลถูกเข้ารหัสทั้งหมด
🎯 ทำไมต้องใช้ LDAPS
ข้อดีของ LDAPS
✅ เข้ารหัส Username
✅ เข้ารหัส Password
✅ ป้องกัน Packet Sniffing
✅ ปลอดภัยกว่า LDAP
✅ รองรับ Compliance หลายมาตรฐาน
✅ รองรับระบบสมัยใหม่
หลายองค์กรที่ comsiam ดูแล เปลี่ยนระบบทั้งหมดจาก LDAP มาเป็น LDAPS เพื่อเพิ่มความปลอดภัยของ Active Directory
🏗️ การทำงานของ LDAPS
ตัวอย่าง
Application
│
▼
LDAPS
Port 636
│
▼
Domain Controller
│
▼
Active Directory
ทุกข้อมูลจะถูกเข้ารหัสก่อนส่ง
📋 สิ่งที่ต้องเตรียมก่อนเปิด LDAPS
① Domain Controller
ต้องติดตั้ง Active Directory แล้ว
② DNS ทำงานปกติ
③ Certificate สำหรับ Domain Controller
④ Enterprise CA หรือ Certificate ภายนอก
🔍 ตรวจสอบ Certificate ปัจจุบัน
เปิด Run
รัน
certlm.msc
📂 ตรวจสอบ Personal Store
ไปที่
Certificates
└ Personal
ตรวจสอบว่ามี Certificate อยู่หรือไม่
🚀 วิธีติดตั้ง Certificate Services
หากยังไม่มี CA
เปิด
Server Manager
เลือก
Add Roles and Features
ติดตั้ง
Active Directory Certificate Services
🔐 ติดตั้ง Enterprise CA
เลือก
Certification Authority
จากนั้นติดตั้งให้เรียบร้อย
📜 ขอ Certificate สำหรับ Domain Controller
เปิด MMC
เพิ่ม Snap-in
Certificates (Computer)
🔄 Request Certificate
เลือก
Request New Certificate
เลือก Template
Domain Controller
หรือ
Domain Controller Authentication
✅ ตรวจสอบ Certificate
Certificate ต้องมี
Server Authentication
และ
Subject Name
ที่ตรงกับชื่อ Domain Controller
ตัวอย่าง
dc01.company.local
🔄 Restart Domain Controller
หลังติดตั้ง Certificate
Restart Server
หรือ
Restart Service
net stop ntds
(เฉพาะบางกรณี)
โดยทั่วไป Restart เครื่องจะง่ายที่สุด
🔍 ตรวจสอบว่า LDAPS ทำงานหรือไม่
รัน
netstat -an | find "636"
ผลลัพธ์ควรมี
TCP 0.0.0.0:636
🚀 ทดสอบด้วย LDP
เปิด
ldp.exe
เลือก
Connection
→ Connect
กรอก
Server : dc01.company.local
Port : 636
ติ๊ก
SSL
จากนั้นกด OK
✅ ผลลัพธ์ที่ถูกต้อง
หากเชื่อมต่อสำเร็จ
จะเห็นข้อความ
Connection successful
🌐 ทดสอบ Port 636
รัน
Test-NetConnection dc01.company.local -Port 636
ผลลัพธ์
TcpTestSucceeded : True
⚠️ ปัญหาที่พบบ่อย
① Port 636 ไม่เปิด
ตรวจสอบ Certificate
② Connection Failed
ตรวจสอบ Firewall
③ SSL Handshake Error
Certificate ไม่ถูกต้อง
④ Certificate Expired
ต่ออายุ Certificate
🔍 ตรวจสอบ Event Viewer
เปิด
Event Viewer
ดู
Directory Service
และ
System
🔒 Firewall ที่ต้องเปิด
LDAP
389/TCP
LDAPS
636/TCP
Global Catalog
3268/TCP
3269/TCP
📋 Checklist ก่อนใช้งาน LDAPS
① Domain Controller Online
② DNS ปกติ
③ Certificate ถูกต้อง
④ Port 636 เปิด
⑤ Firewall อนุญาต
⑥ LDP Test ผ่าน
⑦ SSL ใช้งานได้
📈 Best Practices สำหรับ LDAPS
① ใช้ LDAPS แทน LDAP
② ต่ออายุ Certificate ก่อนหมดอายุ
③ ใช้ Enterprise CA
④ ตรวจสอบ Event Viewer เป็นประจำ
⑤ จำกัดสิทธิ์ Service Account
⑥ ทดสอบ Authentication สม่ำเสมอ
หลายองค์กรที่ comsiam ดูแล กำหนดให้ทุกระบบใหม่เชื่อมต่อ Active Directory ผ่าน LDAPS เท่านั้น เพื่อให้สอดคล้องกับมาตรฐานความปลอดภัยสมัยใหม่
🎯 สรุป
LDAPS บน Windows Server 2022 ช่วยเพิ่มความปลอดภัยให้กับ Active Directory ด้วยการเข้ารหัสข้อมูลทั้งหมดที่ส่งผ่าน LDAP ทำให้ Username, Password และข้อมูลผู้ใช้งานไม่ถูกดักจับผ่านเครือข่าย
การติดตั้ง Certificate ที่ถูกต้อง เปิด Port 636 และตรวจสอบการทำงานผ่าน LDP จะช่วยให้ LDAPS ทำงานได้อย่างเสถียรและปลอดภัย รองรับการเชื่อมต่อจากระบบต่างๆ ภายในองค์กรได้อย่างมีประสิทธิภาพ