Lab 17.3 VPN client to site ASA 8.2 authen with Active Directory Windows 2K8R2

root

Leader IT/Architect
Dec 31, 2012
1,153
72
48
Hôm nay rảnh rỗi, ngủ dậy không có việc gì làm. Nhớ lại có 1 a/e trên forum nhờ làm cái VPN client to site trên ASA 802 xác thực user với Active Directory trên Windows server 2008R2. Thế là bắt tay vào lab thôi. Hy vọng bài lab có ích với mọi người, nếu cần hỗ trợ gì thì cứ để lại comment trên forum hoặc facebook:https://www.facebook.com/pages/Svuit/248785748660011?ref=hl mình hay lên face hơn :D

I. Mô hình

- Mô hình


- Yêu cầu
  • cấu hình IP như sơ đồ
  • cấu hình VPN client to site trên ASA 802 sử dụng pre-share key:svuit.vn
  • cấu hình ASA để khi client VPN vào ASA sẽ sử dụng user trên Active Directory của Windows 2008R2 xác thực
  • Cấu hình để VPN client có thể truy cập vào vùng inside của ASA
II. Triển khai
1. Cấu hình IP và Active Directory
- Cấu hình IP trên ASA

ciscoasa(config)# int e0/0
ciscoasa(config-if)# ip address 192.168.80.254
ciscoasa(config-if)# nameif outside
ciscoasa(config-if)# no shut

ciscoasa(config-if)# int e0/1
ciscoasa(config-if)# nameif inside
ciscoasa(config-if)# ip add 192.168.10.254 255.255.255.0
ciscoasa(config-if)# no shut

ciscoasa(config-if)# fixup protocol icmp


- Về việc cấu hình Active Directory trên Windows server 2008R2 thì các bạn tự làm nhé! Nó khá đơn giản, các bạn thể tham khảo trên Forum này.
- Đảm bảo AD và ASA thấy nhau


- Và đây là AD của mình cấu hình




2. Cấu hình VPN

- Cấu hình VPN trên ASA 8.02, các bạn có thể xem lại các bài lab cũ về cấu hình VPN client-to-site trên ASA 8.02 tại đây http://svuit.vn/lab-71/lab-17-1-ipsec-vpn-client-site-asa-8-02-a-626.html
- Cấu hình VPN client to site Phase 1:

// Cấu hình VPN client to site Phase 1
ciscoasa(config)# isakmp policy 1 authentication pre-share
ciscoasa(config)# isakmp policy 1 encryption 3des
ciscoasa(config)# isakmp policy 1 hash sha
ciscoasa(config)# isakmp policy 1 group 2
ciscoasa(config)# isakmp policy 1 lifetime 86400
ciscoasa(config)# isakmp enable outside

- Cấu hình VPN client to site Phase 2:

// pool cấp IP cho VPN client
ciscoasa(config)# ip local pool VPN-POOL 10.0.0.10-10.0.0.20

// ACL cho phép VPN client truy cập vào đâu
ciscoasa(config)# access-list ACL-VPN extended permit ip 192.168.10.0 255.255.255.0 10.0.0.0 255.255.255.0

ciscoasa(config)# crypto ipsec transform-set Phase1-SET esp-3des esp-md5-hmac
ciscoasa(config)# tunnel-group REMOTE-VPN type ipsec-ra
ciscoasa(config)# tunnel-group REMOTE-VPN general-attributes
ciscoasa(config-general)# address-pool VPN-POOL
ciscoasa(config)# tunnel-group REMOTE-VPN ipsec-attributes
ciscoasa(config-ipsec)# pre-shared-key svuit.vn

ciscoasa(config)# crypto dynamic-map DYNAMIC1 1 set transform-set Phase1-SET
ciscoasa(config)# crypto dynamic-map DYNAMIC1 1 set reverse-route

ciscoasa(config)# crypto map MYMAP 1 ipsec-isakmp dynamic DYNAMIC1
ciscoasa(config)# crypto map MYMAP interface outside

- Cấu hình VPN client-to-site chứng thực với Active Directory của Windows Server 2008R2

ciscoasa(config)# aaa-server LDAP protocol ldap

// IP của Active Directory Windows Server 2008R2
ciscoasa(config-aaa-server-group)#aaa-server LDAP (inside) host 192.168.10.10

// Active Directory của mình có domain là: svuit.org
ciscoasa(config-aaa-server-host)# ldap-base-dn dc=svuit, dc=org

// chứng thực với Active Directory với OU Users trên domain svuit.org
ciscoasa(config-aaa-server-host)# ldap-login-dn CN=Administrator,CN=Users,DC=svuit,DC=org

// Nhập passowrd của administrator trên AD 2008R2
ciscoasa(config-aaa-server-host)# ldap-login-password svuit.vn
ciscoasa(config-aaa-server-host)# ldap-naming-attribute sAMAccountName
ciscoasa(config-aaa-server-host)# ldap-scope subtree
ciscoasa(config-aaa-server-host)# server-type microsoft

- Thêm 1 cái Group Policy để áp các chính xác cho user khi quay VPN vào cty

// Tạo group policy cho user VPN
ciscoasa(config)# group-policy POLICY-VPN internal
ciscoasa(config)# group-policy POLICY-VPN attributes
ciscoasa(config-group-policy)# split-tunnel-policy tunnelspecified
ciscoasa(config-group-policy)# split-tunnel-network-list value ACL-VPN
ciscoasa(config-group-policy)# dns-server value 8.8.8.8 8.8.4.4

// Áp phê các policy trên vào group REMOTE-VPN và thực hiện chứng thực bằng AD với group này
ciscoasa(config)#tunnel-group REMOTE-VPN general-attributes
ciscoasa(config-tunnel-general)# default-group-policy POLICY-VPN
ciscoasa(config-tunnel-general)#authentication-server-group LDAP

III. Kiểm tra
1. Test chứng thực trên ASA
- Các bạn có thể sử dụng lệnh sau để kiểm tra xem ASA có chứng thực với Active Directory 2008R2 thành công không. Như của mình là ok, đã chứng thực thành công

Code:
ciscoasa#[COLOR=#ff0000] test aaa-server authentication LDAP host 192.168.10.10[/COLOR]
Username: Administrator
Password: ***********
INFO: Attempting Authentication test to IP address <192.168.10.10> (timeout: 12 seconds)
INFO: [I][COLOR=#00ff00]Authentication Successful[/COLOR][/I]
2. kiểm tra VPN Client authentication với Active Directory 2008R2
- Bây giờ các bạn qua máy client và thực hiện quay VPN


- Các bạn điền username/password mà các bạn tạo trên Active Directory của Windows server 2008R2 nhé


- Và mình đã VPN thành công với user và pass mình đã tạo trên AD


- Client VPN được phép truy cập những tài nguyên có subnet: 192.168.10.0/24


- Các bạn kiểm tra sẽ thấy IP-Pool VPN mà ASA cấp, và client VPN có thể truy cập tới inside của ASA. Ví dụ mình ping tới AD2k8 nằm trong inside của ASA thành công

 
3. Debug
- Và đây là phần debug trên ASA nếu bạn có vấn đề trong việc cấu hình chứng thực với AD 2008R2
- Xác thực thành công

Code:
ciscoasa# [COLOR=#ff0000]debug ldap 255

[/COLOR]
debug ldap  enabled at level 255
ciscoasa#
[13] Session Start
[13] New request Session, context 0xd4e3dd68, reqType = 1
[13] Fiber started
[13] Creating LDAP context with [COLOR=#00ff00]uri=ldap://192.168.10.10:389[/COLOR]
[13] Connect to LDAP server: [COLOR=#00ff00]ldap://192.168.10.10:389, status = Successful[/COLOR]
[13] defaultNamingContext: [COLOR=#00ff00]value = DC=svuit,DC=org[/COLOR]
[13] supportedLDAPVersion: value = 3
[13] supportedLDAPVersion: value = 2
[13] supportedSASLMechanisms: value = GSSAPI
[13] supportedSASLMechanisms: value = GSS-SPNEGO
[13] supportedSASLMechanisms: value = EXTERNAL
[13] supportedSASLMechanisms: value = DIGEST-MD5
[13] Binding as administrator
[13] Performing Simple authentication for Administrator to 192.168.10.10
[13] LDAP Search:
        [COLOR=#00ff00]Base DN = [dc=svuit, dc=org]
        Filter  = [sAMAccountName=svuit]
        Scope   = [SUBTREE][/COLOR]
[13] User DN = [CN=svuit,CN=Users,DC=svuit,DC=org]
[13] [COLOR=#00ff00]Talking to Active Directory server 192.168.10.10[/COLOR]
[13] Reading password policy for svuit, dn:[COLOR=#00ff00]CN=svuit,CN=Users,DC=svuit,DC=org[/COLOR]
[13] Read bad password count 0
[13] Binding as user
[13] Performing Simple authentication for svuit to 192.168.10.10
[13] Checking password policy for user svuit
[13] Binding as administrator
[13] Performing Simple authentication for Administrator to 192.168.10.10
[13] Authentication successful for svuit to 192.168.10.10
[13] Retrieving user attributes from server 192.168.10.10
[13] now: Sun, 07 Dec 2014 11:50:52 GMT, lastset: Sun, 07 Dec 2014 10:37:19 GMT, delta=4413, maxage=1244057088 secs
[13] expire in: 3624387 secs, 42 days
[13] Retrieved Attributes:
[13]    objectClass: value = top
[13]    objectClass: value = person
[13]    objectClass: value = organizationalPerson
[13]    objectClass: value = user
[13]    cn: value = svuit
[13]    givenName: value = svuit
[13]    distinguishedName: value = CN=svuit,CN=Users,DC=svuit,DC=org
[13]    instanceType: value = 4
[13]    whenCreated: value = 20141207103719.0Z
[13]    whenChanged: value = 20141207103745.0Z
[13]    displayName: value = svuit
[13]    uSNCreated: value = 81970
[13]    uSNChanged: value = 81976
[13]    name: value = svuit
[13]    objectGUID: value = 4.{.../A.]YEr...
[13]    userAccountControl: value = 66048
[13]    badPwdCount: value = 0
[13]    codePage: value = 0
[13]    countryCode: value = 0
[13]    badPasswordTime: value = 0
[13]    lastLogoff: value = 0
[13]    lastLogon: value = 0
[13]    pwdLastSet: value = 130624222399765403
[13]    primaryGroupID: value = 513
[13]    objectSid: value = .....................=%.^...
[13]    accountExpires: value = 9223372036854775807
[13]    logonCount: value = 0
[13]    sAMAccountName: value = svuit
[13]    sAMAccountType: value = 805306368
[13]    userPrincipalName: value = svuit@svuit.org
[13]    objectCategory: value = CN=Person,CN=Schema,CN=Configuration,DC=svuit,DC=org
[13]    dSCorePropagationData: value = 16010101000000.0Z
[13]    lastLogonTimestamp: value = 130624222656385854
[13] Fiber exit Tx=695 bytes Rx=2536 bytes, status=1
[13] Session End

- Nếu user nhập sai password

Code:
ciscoasa# [COLOR=#ff0000]debug ldap 255[/COLOR]

[15] Session Start
[15] New request Session, context 0xd4e3dd68, reqType = 1
[15] Fiber started
[15] Creating LDAP context with uri=ldap://192.168.10.10:389
[15] Connect to LDAP server: ldap://192.168.10.10:389, status = Successful
[15] defaultNamingContext: value = DC=svuit,DC=org
[15] supportedLDAPVersion: value = 3
[15] supportedLDAPVersion: value = 2
[15] supportedSASLMechanisms: value = GSSAPI
[15] supportedSASLMechanisms: value = GSS-SPNEGO
[15] supportedSASLMechanisms: value = EXTERNAL
[15] supportedSASLMechanisms: value = DIGEST-MD5
[15] Binding as administrator
[15] Performing Simple authentication for Administrator to 192.168.10.10
[15] LDAP Search:
        Base DN = [dc=svuit, dc=org]
        Filter  = [sAMAccountName=svuit]
        Scope   = [SUBTREE]
[15] User DN = [CN=svuit,CN=Users,DC=svuit,DC=org]
[15] Talking to Active Directory server 192.168.10.10
[15] Reading password policy for svuit, dn:CN=svuit,CN=Users,DC=svuit,DC=org
[15] Read bad password count 0


[15] Binding as user
[15] Performing Simple authentication for svuit to 192.168.10.10
[15] [COLOR=#00ff00]Simple authentication for svuit returned code (49) Invalid credentials[/COLOR]
[15] Binding as administrator
[15] Performing Simple authentication for Administrator to 192.168.10.10
[15] Reading bad password count for svuit, dn: CN=svuit,CN=Users,DC=svuit,DC=org
[15] Received badPwdCount=1 for user svuit
[15] badPwdCount=0 before, badPwdCount=1 after for svuit
[15] Invalid password for svuit
[15] Fiber exit Tx=772 bytes Rx=2730 bytes, status=-1
[15] Session End
- Nếu không có user đó trên AD 2008R2

Code:
ciscoasa# [COLOR=#ff0000]debug ldap 255

[/COLOR]
[16] Session Start
[16] New request Session, context 0xd4e3dd68, reqType = 1
[16] Fiber started
[16] Creating LDAP context with uri=ldap://192.168.10.10:389
[16] Connect to LDAP server: ldap://192.168.10.10:389, status = Successful
[16] defaultNamingContext: value = DC=svuit,DC=org
[16] supportedLDAPVersion: value = 3
[16] supportedLDAPVersion: value = 2
[16] supportedSASLMechanisms: value = GSSAPI
[16] supportedSASLMechanisms: value = GSS-SPNEGO
[16] supportedSASLMechanisms: value = EXTERNAL
[16] supportedSASLMechanisms: value = DIGEST-MD5
[16] Binding as administrator
[16] Performing Simple authentication for Administrator to 192.168.10.10
[16] LDAP Search:
        Base DN = [dc=svuit, dc=org]
        Filter  = [sAMAccountName=svuit12313]
        Scope   = [SUBTREE]
[COLOR=#00ff00][16] Requested attributes not found[/COLOR]
[16] Fiber exit Tx=283 bytes Rx=766 bytes, status=-1
[16] Session End
 

About us

  • Securityzone.vn là một trang web chuyên về an ninh mạng và công nghệ thông tin. Trang web này cung cấp các bài viết, tin tức, video, diễn đàn và các dịch vụ liên quan đến lĩnh vực này. Securityzone.vn là một trong những cộng đồng IT lớn và uy tín tại Việt Nam, thu hút nhiều người quan tâm và tham gia. Securityzone.vn cũng là nơi để các chuyên gia, nhà nghiên cứu, sinh viên và người yêu thích an ninh mạng có thể trao đổi, học hỏi và chia sẻ kiến thức, kinh nghiệm và giải pháp về các vấn đề bảo mật trong thời đại số.

Quick Navigation

User Menu