2017-05-23 8 views
0

비슷한 문제가 있습니다. one입니다. 제 경우에는 API 측면에서 모든 논리를 수행하려고합니다. API는 괜찮아 보이고 유효하지 않은 사용자를 거부하면 이미 잘 작동합니다. 문제는 API에서 반환되는 속성을 사용하여 인증하는 것입니다. FreeRADIUS의 rest 모듈은 응답이 일부 속성을 반환하고 인증에 실패한 것을 현실화 한 후 업데이트 명령을 실행합니다.FreeRADIUS 업데이트 실패시 인증 실패

내 설정은 다음과 같습니다

authorize { 
rest 
    if (ok) { 
     update control { 
      Auth-Type := rest 
     } 
    } 
} 

논리는 다음과 같습니다 후 인증 할을 수행 체크인 사용자가 종료 (API는 상태 코드 (204)로 응답) 경우 승인합니다. 인증은 사용자 이름 & 암호를 API에 보냅니다. API는 일부 정보를 확인한 다음 모든 것이 정상이면 상태 코드 200 및 속성을 올바른 JSON 형식으로 반환합니다. 나는 상태 코드 (204) 대신 200 사용자가 normaly 인증 (그러나 어떤 속성없이)로 응답 내 API를 설정 Curiosly 경우

로그인 : 어떤 힌트를 사전에

(0) Received Access-Request Id 91 from 127.0.0.1:57293 to 127.0.0.1:1812 length 75 
(0) User-Name = "admin" 
(0) User-Password = "1234" 
(0) NAS-IP-Address = 10.99.99.1 
(0) NAS-Port = 0 
(0) Message-Authenticator = 0x506aba80999c45a4c52d7c5544073969 
(0) # Executing section authorize from file /usr/local/etc/raddb/sites-enabled/nano 
(0) authorize { 
rlm_rest (rest): Reserved connection (0) 
(0) rest: Expanding URI components 
(0) rest: EXPAND http://127.0.0.1:4000 
(0) rest: --> http://127.0.0.1:4000 
(0) rest: EXPAND /check/%{User-Name} 
(0) rest: --> /check/admin 
(0) rest: Sending HTTP GET to "http://127.0.0.1:4000/check/admin" 
(0) rest: Processing response header 
(0) rest: Status : 204 (No Content) 
rlm_rest (rest): Released connection (0) 
Need 5 more connections to reach 10 spares 
rlm_rest (rest): Opening additional connection (5), 1 of 27 pending slots used 
rlm_rest (rest): Connecting to "http://127.0.0.1:4000/" 
(0)  [rest] = ok 
(0)  if (ok) { 
(0)  if (ok) -> TRUE 
(0)  if (ok) { 
(0)  update control { 
(0)   Auth-Type := rest 
(0)  } # update control = noop 
(0)  } # if (ok) = noop 
(0) } # authorize = ok 
(0) Found Auth-Type = rest 
(0) # Executing group from file /usr/local/etc/raddb/sites-enabled/nano 
(0) authenticate { 
rlm_rest (rest): Reserved connection (1) 
(0) rest: Expanding URI components 
(0) rest: EXPAND http://127.0.0.1:4000 
(0) rest: --> http://127.0.0.1:4000 
(0) rest: EXPAND /auth/%{User-Name}/%{User-Password} 
(0) rest: --> /auth/admin/1234 
(0) rest: Sending HTTP GET to "http://127.0.0.1:4000/auth/admin/1234" 
(0) rest: Processing response header 
(0) rest: Status : 200 (OK) 
(0) rest: Type : json (application/json) 
(0) rest: Parsing attribute "WISPr-Bandwidth-Max-Down" 
(0) rest: EXPAND 3000 
(0) rest: --> 3000 
(0) rest: WISPr-Bandwidth-Max-Down := 3000 
(0) rest: Parsing attribute "WISPr-Bandwidth-Max-Up" 
(0) rest: EXPAND 1000 
(0) rest: --> 1000 
(0) rest: WISPr-Bandwidth-Max-Up := 1000 
rlm_rest (rest): Released connection (1) 
(0)  [rest] = updated 
(0) } # authenticate = updated 
(0) Failed to authenticate the user 
(0) Using Post-Auth-Type Reject 
(0) Post-Auth-Type sub-section not found. Ignoring. 
(0) # Executing group from file /usr/local/etc/raddb/sites-enabled/nano 
(0) Delaying response for 1.000000 seconds 
Waking up in 0.3 seconds. 
Waking up in 0.6 seconds. 
(0) Sending delayed response 
(0) Sent Access-Reject Id 91 from 127.0.0.1:1812 to 127.0.0.1:57293 length 44 
(0) WISPr-Bandwidth-Max-Down = 3000 
(0) WISPr-Bandwidth-Max-Up = 1000 
Waking up in 3.9 seconds. 
(0) Cleaning up request packet ID 91 with timestamp +9 

감사합니다.

답변

1

그래, v4.0.x에서 수정 한 것 같습니다. '업데이트 된'이 허용 가능한 반환 코드가 아닌 것은 기존 문제였습니다.

당신은 다음과 리턴 코드와 우선 순위를 재정의 할 수

authenticate { 
    Auth-Type rest { 
     rest { 
      updated = 1 
     } 
     if (updated) { 
      ok 
     } 
    } 
} 

설명하기 - '확인'을 각각 반환 코드를 '무 조작', 서로 다른 우선 순위와 행동을 가지고 ... 등 '실패' 섹션에 따라. 모듈의 리턴 코드는 우선 순위가 높은 경우에만 섹션 리턴 코드를 갱신합니다.

서버가 즉시 섹션을 종료하도록하는 마법 우선 순위 '리턴'이 있습니다. 인증 섹션에서 대부분의 리턴 코드에 대해 설정됩니다.

나머지 모듈에 대한 호출 우선 순위를 재정 의하여 인터프리터가 if (updated) 조건을 평가하지 않고 인증에서 복귀하지 않도록해야합니다. 위의 예제에서 우리는 우선 순위를 1로 설정하여 나중에 덮어 쓸 수 있도록합니다.

+0

감사합니다 Arran은 매력처럼 작동합니다. v4를 사용했지만 동일한 구성으로 분할 오류가 계속 발생했습니다. 3V로 다운 그레이드하고 상황이 좀 나아졌습니다. – FGSants

+0

흠, segv를 github 문제에 붙여 넣으세요. https://github.com/FreeRADIUS/freeradius-server/issues –