Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng

Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng (http://quantrinet.com/forum/index.php)
-   Module 5: AD Federation Services, ADLD (http://quantrinet.com/forum/forumdisplay.php?f=259)
-   -   Active Directory Federation Services (AD FS) trong Windows Server 2008 (http://quantrinet.com/forum/showthread.php?t=2912)

hoctinhoc 26-06-2009 08:32 PM

Active Directory Federation Services (AD FS) trong Windows Server 2008
 
Active Directory Federation Services (AD FS)
trong Windows Server 2008
***

I.Giới thiệu
Active Directory Federation Services (AD FS) là một giải pháp cho phép người dùng truy cập các ứng dụng web chỉ cần một lần đăng nhập cho dù người dùng và ứng dụng nằm trong các mạng hoặc tổ chức hoàn toàn khác nhau.
Thông thường khi một ứng dụng thuộc một mạng và người dùng thuộc một mạng khác, người dùng được yêu cầu nhập một tài khoản thứ hai để truy cập ứng dụng (đăng nhập thứ cấp).
Với ADFS người dùng không còn được yêu cầu đăng nhập thứ cấp bằng tài khoản thứ hai này nữa bởi mối quan hệ tin cậy đã được thiết lập giữa các mạng. Trong môi trường liên đoàn (federated), mỗi tổ chức tiếp tục quản lý các tài khoản riêng của mình nhưng mỗi tổ chức vẫn có thể bảo vệ ứng dụng và thừa nhận tài khoản truy cập từ các tổ chức khác.
Quá trình xác thực một mạng trong khi truy cập tài nguyên của một mạng khác mà không bắt người dùng phải đăng nhập thứ cấp gọi là single sign-on (SSO). ADFS hỗ trợ giải pháp SSO trên nền web trong một phiên làm việc của người dùng.
Đối với ADFS có hai loại tổ chức:
-Tổ chức tài nguyên (resource organization): là tổ chức đang sở hữu và quản lý tài nguyên có thể được truy cập từ các đối tác tin cậy.
-Tổ chức tài khoản (account organization): là tổ chức đang sở hữu và quản lý tài khoản có thể truy cập tài nguyên từ các tổ chức tài nguyên ở trên.
Bài lab này có 5 bước:
1.Các tác vụ cần thực hiện trước khi cài đặt ADFS
2.Cài đặt role ADFS và cấu hình certificate
3.Cấu hình web server
4.Cấu hình federation server
5.Truy cập ứng dụng từ máy client

II.Chuẩn bị
Ta cần 4 máy với các yêu cầu sau:
Tên computer
ADFS client/server role
Hệ điều hành
IPv4/SM
DNS
PC49
Client
- Windows XP SP2
- Windows Vista
192.168.1.49/24
- Preferred: 192.168.1.34
- Alternate: 192.168.1.32
PC34
Federation server and domain controller
W2K8 Enterprise
192.168.1.34/24
192.168.1.34
PC31
Web server
W2K8 Enterprise
192.168.1.31/24
192.168.1.32
PC32
Federation server and domain controller
W2K8 Enterprise
192.168.1.32/24
192.168.1.32

III.Thực hiện
1.Các tác vụ cần thực hiện trước khi cài đặt ADFS
B1: Install AD DS lên máy PC32, domain name nhatnghe32.local -> PC32.nhatnghe32.local. Domain nhatnghe32.local đóng vai trò resource organization.
B2: Install AD DS lên máy PC34, domain name nn34.local -> PC34.nn34.local. Domain nn34.local đóng vai trò account organization.
B3: Trên máy PC34:
-tạo security global group TreyClaimAppUsers
-tạo user u1, đưa u1 vào group TreyClaimAppUsers
B4: Join máy PC31 vào domain nhatnghe32.local -> PC31.nhatnghe32.local. Cài đặt IIS.
B5: Join máy PC49 vào domain nn34.local -> PC49.nn34.local

2.Cài đặt role ADFS và cấu hình certificate
2.1. Cài đặt ADFS
Lần lượt thực hiện trên 2 máy DC: PC32 và PC34. Sau khi cài Federation Service, 2 máy DC này trở thành federation server.
B1: Mở Server Manager -> Roles -> Add Roles -> Next
B2: Chọn Active Directory Federation Services -> Next -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image002.jpg

B3: Chọn Federation Service -> chọn Add Required Role services -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image004.jpg

B4: Chọn Create a self-signed certificate for SSL encryption -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image006.jpg

B5: Chọn Create a self-signed token-signing certificate -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image008.jpg

B6: Chọn Create a new trust policy -> Next -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image010.jpg

B7: Chọn Next -> Install -> Close
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image012.jpg

2.2. Cấu hình IIS (SSL) trên 2 federation server
Lần lượt thực hiện trên 2 máy DC: PC32 và PC34.
B1: Mở IIS Manager -> PC32 -> Sites -> Default Web Site
B2: Double click SSL Settings
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image014.jpg

B3: Chọn Require SSL, mục Client certificates chọn Accept -> Apply
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image016.jpg

2.3. Cài đặt AD FS Web Agent
Thực hiện trên máy Web server (PC31).
B1: Mở Server Manager -> Roles -> Add Roles -> Next
B2: Chọn Active Directory Federation Services -> Next -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image018.jpg

B3: Chọn Claims-aware Agent -> Next -> Install -> Close
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image020.jpg

B4: Add thêm role service Client Certificate Mapping Authentication vào role Web Server (IIS)
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image022.jpg

2.4. Tạo, xuất, và nhập certificate
1. Tạo server authentication certificate cho web server (PC31)
Thực hiện trên máy Web server (PC31).
B1: Mở IIS Manager -> PC31
B2: Double click Server Certificates
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image024.jpg

B3: Trong phần Actions chọn Create Self-Signed Certificate
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image026.jpg

B4: Nhập PC31 -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image028.jpg

B5: Kiểm tra web server đã có certificate
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image030.jpg

2. Xuất token-signing certificate cùa account server (PC34) thành file
Thực hiện trên máy account server (PC34).
B1: Mở Active Directory Federation Services
B2: Right click Federation Service -> Properties
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image032.jpg

B3: Tab General -> click View
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image034.jpg

B4: Tab Details -> click Copy to File -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image036.jpg

B5: Click No, do not export the private key -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image038.jpg

B6: Click DER encoded binary X.509 (.CER) -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image040.jpg

B7: Nhập C:\pc34_ts.cer -> Next -> Finish -> OK -> OK -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image042.jpg

3. Xuất server authentication certificate của resource server (PC32) thành file
Thực hiện trên máy resource server (PC32).
B1: Mở IIS Manager -> PC32
B2: Double click Server Certificates
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image044.jpg

B3: Right click PC32.nhatnghe32.local -> Export
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image046.jpg

B4: Nhập C:\PC32.pfx vào mục Export to, nhập password và confirm password -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image048.jpg

4. Nhập server authentication certificate của resource server (PC32) vào web server (PC31)
Thực hiện trên máy web server (PC31).
B1: Start -> Run -> mmc -> OK
B2: Click menu File -> Add/Remove Snap-in
B3: Click Certificates -> Add -> Computer account -> Next -> Local computer -> Finish -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image050.jpg

B4: Certificates (Local Computer) -> Trusted Root Certification Authorities -> Right click Certificates -> All Tasks -> Import -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image052.jpg

B5: Nhập \\pc32\c$\pc32.pfx -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image054.jpg

B6: Nhập password -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image056.jpg

B7: Next -> Finish -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image058.jpg

B8: Kiểm tra thấy đã có certificate của resource server (PC32)
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image060.jpg

3.Cấu hình web server
Thực hiện trên máy web server (PC31).
3.1. Cấu hình IIS trên web server
B1: Mở IIS Manager -> PC31 -> Sites -> Right click Default Web Site -> Edit Bidings
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image062.jpg

B2: Click Add
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image064.jpg

B3: Mục Type chọn https, mục SSL certificate chọn PC31 -> OK -> Close
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image066.jpg

B4: Double click SSL Settings
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image068.jpg

B5: Chọn Require SSL, mục Client certificates chọn Accept -> Apply
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image070.jpg

3.2. Tạo và cấu hình ứng dụng
B1: Tạo folder claimapp trong C:\inetpub\wwwroot. Chép 3 file ... vào folder C:\inetpub\wwwroot\ claimapp
B2: Mở IIS Manager -> PC31 -> Sites -> Right Default Web Site -> Add Application
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image072.jpg

B3: Mục Alias nhập ClaimApp, mục Application pool chọn Classic .NET AppPool, mục Physical path chọn C:\inetpub\wwwroot\claimapp -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image074.jpg

4.Cấu hình federation server
4.1. Cấu hình federation service cho domain nn34.local (account domain)
Thực hiện trên máy account server (PC34).
1. Cấu hình trust policy cho domain nn34.local
B1: Mở AD FS -> Federation Service -> right click Trust Policy -> Properties
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image076.jpg

B2: Tab General, mục Federation Service URI, nhập urn:federation:nn34
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image078.jpg

B3: Tab Display Name, mục Display name for this trust policy, nhập pc34 -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image080.jpg

2. Tạo group cho ứng dụng
B1: Federation Service -> Trust Policy -> My Organization -> right click Organization Claims -> New -> Organization Claim
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image082.jpg

B2: Mục Claim name, nhập nhatnghe32 ClaimApp Claim -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image084.jpg

B3: Xác nhận đã có “nhatnghe32 ClaimApp Claim”
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image086.jpg

3. Thêm và cấu hình AD DS account store
Thêm AD DS account store
B1: Federation Service -> Trust Policy -> My Organization -> right click Account Stores -> New -> Account Store -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image088.jpg

B2: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image090.jpg

B3: Click Next -> Finish
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image092.jpg

B4: Xác nhận AD DS account store đã được thêm vào
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image094.jpg

Cấu hình AD DS account store
B1: Federation Service -> Trust Policy -> My Organization -> Account Stores -> right click Active Directory -> New -> Group Claim Extraction
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image096.jpg

B2: Click Add -> nhập TreyClaimAppUsers -> OK -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image098.jpg

B3: Xác nhận đã có group TreyClaimAppUsers
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image100.jpg

4.2. Cấu hình federation service cho domain nhatnghe32.local (resource domain)
Thực hiện trên máy resource server (PC32).
1. Cấu hình trust policy cho domain nhatnghe32.local
B1: Mở AD FS -> Federation Service -> right click Trust Policy -> Properties
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image102.jpg

B2: Tab General, mục Federation Service URI nhập urn:federation:nhatnghe32
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image104.jpg

B3: Tab Display Name, mục Display name for this trust policy nhập pc32 -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image106.jpg

2. Tạo group cho ứng dụng
B1: AD FS -> Federation Service -> Trust Policy -> My Organization -> right click Organization Claims -> New -> Organization Claim
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image108.jpg

B2: Mục Claim name nhập nn34 ClaimApp Claim -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image110.jpg

B3: Xác nhận đã có “nn34 ClaimApp Claim”
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image112.jpg

3. Thêm AD DS account store
B1: AD FS -> Federation Service -> Trust Policy -> My Organization -> right click Account Stores -> New -> Account Stores -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image114.jpg

B2: Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image090.jpg

B3: Next -> Finish
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image092.jpg

B4: Xác nhận AD DS account store đã được thêm vào
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image116.jpg

4. Thêm và cấu hình ứng dụng
Thêm ứng dụng
B1: AD FS -> Federation Service -> Trust Policy -> My Organization -> right click Applications -> New -> Application -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image118.jpg

B2: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image120.jpg

B3: Mục Application display name nhập Claims-aware Application. Mục Application URL nhập https://pc31.nhatnghe32.local/claimapp/ -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image122.jpg

B4: Chọn User principal name (UPN) -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image124.jpg

B5: Click Next -> Finish
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image126.jpg

B6: Xác nhận ứng dụng đã được thêm vào
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image128.jpg

Cấu hình ứng dụng
B1: Trong Applications -> Claims-aware Application -> right click nn34 ClaimApp Claim -> Enable
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image130.jpg

B2: Xác nhận ứng dụng đã được enable
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image132.jpg

4.3. Cấu hình federation trust
1. Xuất trust policy từ nn34
B1: AD FS -> Federation Service -> right click Trust Policy -> Export Basic Partner Policy
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image134.jpg

B2: Click Browse -> nhập C:\pc34 -> Save -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image136.jpg

2. Nhập trust policy nn34 vào nhatnghe32
B1: AD FS -> Federation Service -> Trust Policy -> Partner Organizations -> righr click Account Partners -> New -> Account Partner -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image138.jpg

B2: Mục Partner interoperability policy file nhập \\pc34\c$\pc34.xml -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image140.jpg

B3: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image142.jpg

B4: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image144.jpg

B5: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image146.jpg

B6: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image148.jpg

B7: Nhập nn34.local -> Add -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image150.jpg

B8: Nhập nn34.local -> Add -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image152.jpg

B9: Click Next -> Finish
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image154.jpg

B10: Account Partner đã được thêm vào
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image156.jpg

3. Tạo một claim mapping trong nhatnghe32
Máy pc32.
B1: ADFS -> Federation Service -> Trust Policy -> Partner Organizations -> Account Partners -> right click pc34 -> New -> Incoming Group Claim Mapping
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image158.jpg

B2: Mục Incoming group claim name nhập ClaimAppMapping -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image160.jpg

B3: ClaimAppMapping đã được thêm vào
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image162.jpg

4. Xuất partner policy từ nhatnghe32
Máy pc32.
B1: ADFS -> Federation Service -> Trust Policy -> Partner Organizations -> Account Partners -> right click pc34 -> Export Policy
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image164.jpg

B2: Click Browse -> nhập C:\pc32 -> Save -> OK
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image166.jpg

5. Nhập partner policy nhatnghe32 sang nn34
Máy pc34.
B1: ADFS -> Federation Service -> Trust Policy -> Partner Organizations -> right click Resource Partners -> New -> Resource Partner -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image168.jpg

B2: Click Yes -> mục Partner interoperability policy file nhập \\pc32\c$\pc32.xml -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image170.jpg

B3: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image172.jpg

B4: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image174.jpg

B5: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image176.jpg

B6:
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image178.jpg

B7: Click Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image180.jpg

B8: Mục Mapping chọn nhatnghe32 ClaimApp Claim -> Next
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image182.jpg

B9: Click Next -> Finish
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image184.jpg

B10: Resource Partner đã được thêm vào
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image186.jpg

5.Truy cập ứng dụng từ máy client
5.1. Cấu hình IE để tin cậy server pc34.nn34.local
Máy client pc49.nn34.local
B1: Logon u1
B2: Mở IE -> Tools -> Internet Options -> Security -> Local Intranet -> Sites -> Advanced -> Add this Web site to the zone: nhập https://pc34.nn34.local -> Add -> OK -> OK -> OK

5.2. Truy cập ứng dụng từ client Windows XP
Máy client pc49.nn34.local
B1: Logon u1
B2: Mở IE -> nhập https://pc31.nhatnghe32.local/claimapp -> mục Choose your home realm chọn pc34 -> Submit
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image188.jpg
B3: Xuất hiện ứng dụng SSO Sample
http://tuan.nhatnghe.vn/AD%20FS%20in...s/image190.jpg


Nhất Nghệ Support Team
Châu Tuấn


Bây giờ là 07:15 PM. Giờ GMT +7

Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.