
나는 지금 약 일주일 동안 이것과 싸우고 있습니다. Samba 기반 Active Directory에 대해 인증하기 위해 RADIUS 서버를 얻으려고 하는데 작동하지 않습니다. 우리의 인프라 때문에 PAP는 작동하지 않습니다. AD는 알려진 양호한 일반 텍스트 비밀번호를 제공하지 않기 때문에 CHAP가 작동하지 않습니다. 그래서 MSCHAP가 남습니다.
RADIUS 서버는 자체 VM에 있습니다. 해당 VM은 Winbind를 사용하여 도메인에 연결되어 있습니다. 나는 다음을 가지고 있습니다 /etc/raddb/mods-available/mschap
:
$ cat /etc/raddb/mods-available/mschap|grep -Ev '^\s*(#|$)'
mschap {
ntlm_auth = "/usr/bin/ntlm_auth --request-nt-key --username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} --challenge=%{%{mschap:Challenge}:-00} --nt-response=%{%{mschap:NT-Response}:-00}"
winbind_username = "%{mschap:User-Name}"
winbind_domain = "[domain]"
winbind_retry_with_normalised_username = yes
pool {
start = ${thread[pool].start_servers}
min = ${thread[pool].min_spare_servers}
max = ${thread[pool].max_servers}
spare = ${thread[pool].max_spare_servers}
uses = 0
retry_delay = 30
lifetime = 86400
cleanup_interval = 300
idle_timeout = 600
}
}
클라이언트가 인증을 시도하면 관련 radiusd -X
출력은 다음과 같습니다.
Listening on auth address * port 1812 bound to server default
Listening on acct address * port 1813 bound to server default
Listening on auth address :: port 1812 bound to server default
Listening on acct address :: port 1813 bound to server default
Listening on auth address 127.0.0.1 port 18120 bound to server inner-tunnel
Ready to process requests
(0) Received Access-Request Id 22 from 192.168.6.179:43922 to 192.168.6.192:1812 length 180
(0) Service-Type = Framed-User
(0) Framed-Protocol = PPP
(0) NAS-Port = 15728668
(0) NAS-Port-Type = Virtual
(0) User-Name = "duncan"
(0) Calling-Station-Id = "192.168.6.100"
(0) Called-Station-Id = "192.168.6.179"
(0) MS-CHAP-Challenge = 0x7fd91ada13b38b1800f2f5c1b9a107e4
(0) MS-CHAP2-Response = 0x01000ff84b43a7f4d54b20da108b5f6a76480000000000000000b366008c649fc36a4a9bfb044f65dc8daf3aee10ad679141
(0) NAS-Identifier = "MikroTik"
(0) NAS-IP-Address = 192.168.6.179
(0) # Executing section authorize from file /usr/local/etc/raddb/sites-enabled/default
(0) authorize {
(0) policy filter_username {
(0) if (&User-Name) {
(0) if (&User-Name) -> TRUE
(0) if (&User-Name) {
(0) if (&User-Name =~ / /) {
(0) if (&User-Name =~ / /) -> FALSE
(0) if (&User-Name =~ /@[^@]*@/ ) {
(0) if (&User-Name =~ /@[^@]*@/ ) -> FALSE
(0) if (&User-Name =~ /\.\./ ) {
(0) if (&User-Name =~ /\.\./ ) -> FALSE
(0) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/)) {
(0) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/)) -> FALSE
(0) if (&User-Name =~ /\.$/) {
(0) if (&User-Name =~ /\.$/) -> FALSE
(0) if (&User-Name =~ /@\./) {
(0) if (&User-Name =~ /@\./) -> FALSE
(0) } # if (&User-Name) = notfound
(0) } # policy filter_username = notfound
(0) [preprocess] = ok
(0) mschap: Found MS-CHAP attributes. Setting 'Auth-Type = mschap'
(0) [mschap] = ok
(0) [digest] = noop
(0) files: users: Matched entry DEFAULT at line 181
(0) [files] = ok
(0) [expiration] = noop
(0) [logintime] = noop
(0) pap: WARNING: No "known good" password found for the user. Not setting Auth-Type
(0) pap: WARNING: Authentication will fail unless a "known good" password is available
(0) [pap] = noop
(0) } # authorize = ok
(0) Found Auth-Type = mschap
(0) # Executing group from file /usr/local/etc/raddb/sites-enabled/default
(0) authenticate {
(0) mschap: Creating challenge hash with username: duncan
(0) mschap: Client is using MS-CHAPv2
(0) mschap: Executing: /usr/bin/ntlm_auth --request-nt-key --username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} --challenge=%{%{mschap:Challenge}:-00} --nt-response=%{%{mschap:NT-Response}:-00}:
(0) mschap: EXPAND --username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}}
(0) mschap: --> --username=duncan
(0) mschap: Creating challenge hash with username: duncan
(0) mschap: EXPAND --challenge=%{%{mschap:Challenge}:-00}
(0) mschap: --> --challenge=6c2a06548de859d5
(0) mschap: EXPAND --nt-response=%{%{mschap:NT-Response}:-00}
(0) mschap: --> --nt-response=b366008c649fc36a4a9bfb044f65dc8daf3aee10ad679141
(0) mschap: ERROR: Program returned code (1) and output 'Logon failure (0xc000006d)'
(0) mschap: External script failed
(0) mschap: ERROR: External script says: Logon failure (0xc000006d)
(0) mschap: ERROR: MS-CHAP2-Response is incorrect
(0) [mschap] = reject
(0) } # authenticate = reject
(0) Failed to authenticate the user
(0) Using Post-Auth-Type Reject
(0) # Executing group from file /usr/local/etc/raddb/sites-enabled/default
(0) Post-Auth-Type REJECT {
(0) attr_filter.access_reject: EXPAND %{User-Name}
(0) attr_filter.access_reject: --> duncan
(0) attr_filter.access_reject: Matched entry DEFAULT at line 11
(0) [attr_filter.access_reject] = updated
(0) } # Post-Auth-Type REJECT = updated
(0) Delaying response for 1.000000 seconds
Waking up in 0.6 seconds.
Waking up in 0.3 seconds.
(0) Sending delayed response
(0) Sent Access-Reject Id 22 from 192.168.6.192:1812 to 192.168.6.179:43922 length 103
(0) MS-CHAP-Error = "\001E=691 R=1 C=06f7ce6fa5be464d72e8def2f9634910 V=3 M=Authentication rejected"
Waking up in 3.9 seconds.
(0) Cleaning up request packet ID 22 with timestamp +8
Ready to process requests
그리고 Samba 로그 레벨 5 출력은 다음과 같습니다.
[2018/03/19 11:13:13.166062, 3] ../libcli/auth/schannel_state_tdb.c:190(schannel_fetch_session_key_tdb)
schannel_fetch_session_key_tdb: restored schannel info key SECRETS/SCHANNEL/GS-RADIUS
[2018/03/19 11:13:13.166160, 3] ../source4/auth/ntlm/auth.c:271(auth_check_password_send)
auth_check_password_send: Checking password for unmapped user [AD]\[duncan]@[\\GS-RADIUS]
[2018/03/19 11:13:13.166171, 5] ../source4/auth/ntlm/auth_util.c:57(map_user_info_cracknames)
map_user_info_cracknames: Mapping user [AD]\[duncan] from workstation [\\GS-RADIUS]
auth_check_password_send: mapped user is: [AD]\[duncan]@[\\GS-RADIUS]
[2018/03/19 11:13:13.166994, 5] ../source4/auth/ntlm/auth.c:67(auth_get_challenge)
auth_get_challenge: returning previous challenge by module netr_LogonSamLogonWithFlags (normal)
[2018/03/19 11:13:13.167006, 5] ../lib/util/util.c:555(dump_data)
[0000] 2D F2 C3 E3 15 05 ED 58 -......X
[2018/03/19 11:13:13.167502, 2] ../libcli/auth/ntlm_check.c:424(ntlm_password_check)
ntlm_password_check: NTLMv1 passwords NOT PERMITTED for user duncan
[2018/03/19 11:13:13.167518, 3] ../libcli/auth/ntlm_check.c:431(ntlm_password_check)
ntlm_password_check: NEITHER LanMan nor NT password supplied for user duncan
[2018/03/19 11:13:13.167630, 5] ../source4/dsdb/common/util.c:5252(dsdb_update_bad_pwd_count)
Not updating badPwdCount on CN=duncan,CN=Users,DC=ad,DC=goldblattsystems,DC=com after wrong password
[2018/03/19 11:13:13.167656, 2] ../source4/auth/ntlm/auth.c:430(auth_check_password_recv)
auth_check_password_recv: sam_ignoredomain authentication for user [AD\duncan] FAILED with error NT_STATUS_WRONG_PASSWORD
[2018/03/19 11:13:13.348906, 3] ../source4/smbd/service_stream.c:66(stream_terminate_connection)
Terminating connection - 'ldapsrv_call_loop: tstream_read_pdu_blob_recv() - NT_STATUS_CONNECTION_DISCONNECTED'
[2018/03/19 11:13:13.348929, 3] ../source4/smbd/process_single.c:114(single_terminate)
single_terminate: reason[ldapsrv_call_loop: tstream_read_pdu_blob_recv() - NT_STATUS_CONNECTION_DISCONNECTED]
이 문제의 원인은 무엇입니까? 어떻게 해결할 수 있나요?
답변1
ntlm_auth
에서 행 을 활성화 /etc/raddb/mods-available/mschap
하거나 설정할 ntlm auth = yes
필요 가 없습니다 smb.conf
.MSCHAPv2는 NTLMv2를 지원하지 않는 것 같습니다., 너하다에서 다음을 설정해야 합니다 smb.conf
.
ntlm auth = mschapv2-and-ntlmv2-only
인용하려면smb.conf 맨페이지:
ntlm_auth
"클라이언트가 MSCHAPv2 인증(예: 도구) 을 제공한다고 약속하는 경우에만 NTLMv1을 허용하세요 ."
ntlm_auth
그러나 최신 Sambas 및 최신 버전의 Freeradius에서는 명시적 으로 활성화할 필요가 없습니다 .Freeradius 3.0.8 이상에서는 Winbind와 직접 대화할 수 있습니다.. Winbind의 파이프에 대한 읽기 권한을 부여하는 것을 잊지 마세요! 예. 데비안에서는 setfacl -m u:freerad:rx /var/lib/samba/winbindd_privileged/
.
전체적으로 radtest -t mschap testaccount mypass 127.0.0.1 0 testing123
Samba를 AD DC 및 Freeradius로 실행하는 Debian Buster 상자에서 Access-Accept를 수신하기 위해 mschap 모듈 구성에 대한 모든 변경 사항은 다음과 같습니다.
diff --git a/freeradius/3.0/mods-available/mschap b/freeradius/3.0/mods-available/mschap
index d7efcb1..e297ed4 100644
--- a/freeradius/3.0/mods-available/mschap
+++ b/freeradius/3.0/mods-available/mschap
@@ -21,12 +21,12 @@ mschap {
# if mppe is enabled require_encryption makes
# encryption moderate
#
-# require_encryption = yes
+ require_encryption = yes
# require_strong always requires 128 bit key
# encryption
#
-# require_strong = yes
+ require_strong = yes
# The module can perform authentication itself, OR
# use a Windows Domain Controller. This configuration
@@ -81,8 +81,8 @@ mschap {
# or later to be installed. Make sure that ntlm_auth above is
# commented out.
#
-# winbind_username = "%{mschap:User-Name}"
-# winbind_domain = "%{mschap:NT-Domain}"
+ winbind_username = "%{mschap:User-Name}"
+ winbind_domain = "%{%{mschap:NT-Domain}:-MYDOMAIN}"
# When using single sign-on with a winbind connection and the
# client uses a different casing for the username than the
@@ -91,7 +91,7 @@ mschap {
# user in the correct casing in the backend, and retry
# authentication with that username.
#
-# winbind_retry_with_normalised_username = no
+ winbind_retry_with_normalised_username = yes
#
# Information for the winbind connection pool. The configuration
( winbind_retry_with_normalised_username
이 테스트 상황에서는 아마도 관련이 없을 수 있습니다.)
MYDOMAIN
Kerberos와 같은 형식이 아닌 기존 NT4 형식의 도메인 이름입니다 DOMAIN.TLD
. Freeradius를 DC에서 직접 실행하지 않더라도 서버가 도메인에 올바르게 가입되어 있는 한 Freeradius의 실제 mschap 모듈 구성은 여전히 동일해야 합니다. DC가 Windows인 경우에는 분명히 smb.conf가 없지만 NTLMv1을 사용하는 기능은도메인 기능 수준그리고사용자가 보호된 사용자 그룹에 속해 있는지 여부.
Wi-Fi 인증에 MSCHAPv2를 사용하려는 경우상호 인증된 터널 내에서만 사용해야 합니다.가짜 액세스 포인트로부터 보호합니다. EAP 유형은 다음을 참조하세요.위키피디아클라이언트 제한 사항에 대한 요약은 다음의 두 번째 답변을 참조하세요.PEAP 대신 EAP-TTLS를 사용하는 이유는 무엇입니까?
답변2
ntlm auth = yes
smb.conf의 전역 섹션 설정 으로 "고정"되었습니다. ntlmv1을 허용하지 않는 상태로 돌아가고 싶습니다. 누군가 ntlmv1 없이 이 작업을 수행할 수 있는 방법이 있다면 자신의 답변을 게시해 주세요.