ปัญหา: เข้าถึง Service ที่ใช้ Network Shares บน Middle-tier Server แล้วถูกขอ Credentials แล้วได้ ACCESS_DENIED
3 สถานการณ์ที่พบบ่อย
Scenario 1: IIS Website
- Home Directory 指向 Remote Share (Pass-through Auth + Constrained Delegation for CIFS)
- App Pool ใช้ Service Account
- Domain Account Trusted for Delegation สำหรับ CIFS บน File Server
Scenario 2: Web App
- Web App เข้าถึง File Server เป็น User
- App Pool ใช้ Service Account + Trusted for Delegation CIFS
- Constrained Delegation for CIFS กำหนดบน Service Account
Scenario 3: Server-side Application
- Client เข้าถึง App > App เข้าถึง Remote Shares เป็น User
- App รันภายใต้ Service Account
- Service Account Trusted for Delegation + CIFS Delegation
Root Cause
ปัญหาระหว่าง MrxSmb 2.0 และ Kerberos เมื่อมี Constrained Delegation
2 Workarounds จาก Microsoft
Workaround 1 (แนะนำ): ใช้ Machine Account แทน Service Account
บน Domain Controller ของ Web Server:
- Active Directory Users and Computers > Computers Folder
- Right-click Web Server Computer > Properties > Delegation Tab
- ติ๊ก "Trust this computer for delegation to specified services only"
- เลือก "Use Kerberos only" > OK
- Add > Users or Computers > ใส่ชื่อ File Server > OK
- เลือก CIFS Service > OK
Workaround 2 (ไม่แนะนำ): ใช้ Service Account + Protocol Transition
ขั้นตอน 1 - Computer Account: เหมือน Workaround 1 แต่เลือก "Use any authentication protocol" (Protocol Transition)
ขั้นตอน 2 - Service Account: Users Folder > Service Account > Properties > Delegation > "Trust this computer for delegation to specified services only" > "Use Kerberos only" > Add File Server > CIFS Service
คำเตือน: Workaround 2 ต้องการ Protocol Transition ซึ่งลดความปลอดภัย