FreeRADIUS3 - 오류: 연산자가 필요한 exec의 출력 구문 분석에 실패했습니다.

FreeRADIUS3 - 오류: 연산자가 필요한 exec의 출력 구문 분석에 실패했습니다.

OTP 인증을 위한 FreeRADIUS 3, 인증은 성공하지만 FreeRADIUS는 응답을 구문 분석하지 못합니다.

테스트 명령을 보내고 디버그 출력( radiusd -X)을 모니터링하면 아래와 같은 오류가 발생하는데, 외부 프로그램의 응답이 만족스러운 것처럼 보임에도 불구하고 출력이 구문 분석되지 않습니다.

# below, totp.py generates a TOTP for johnboy, to aid testing
# using pyotp package to make testing easier...

radtest -t mschap johnboy $(./totp.py) localhost 0 testing123
.
.
.
(4) eap: No EAP-Message, not doing EAP
(4)     [eap] = noop
(4)     [expiration] = noop
(4)     [logintime] = noop
(4) multiotp: Executing: /usr/local/bin/multiotp.php '%{User-Name}' '%{User-Password}' -request-nt-key -src=%{Packet-Src-IP-Address} -chap-challenge=%{CHAP-Challenge} -chap-password=%{CHAP-Password} -ms-chap-challenge=%{MS-CHAP-Challenge} -ms-chap-response=%{MS-CHAP-Response} -ms-chap2-response=%{MS-CHAP2-Response}:
(4) multiotp: EXPAND %{User-Name}
(4) multiotp:    --> johnboy
(4) multiotp: EXPAND %{User-Password}
(4) multiotp:    --> 
(4) multiotp: EXPAND -src=%{Packet-Src-IP-Address}
(4) multiotp:    --> -src=127.0.0.1
(4) multiotp: EXPAND -chap-challenge=%{CHAP-Challenge}
(4) multiotp:    --> -chap-challenge=
(4) multiotp: EXPAND -chap-password=%{CHAP-Password}
(4) multiotp:    --> -chap-password=
(4) multiotp: EXPAND -ms-chap-challenge=%{MS-CHAP-Challenge}
(4) multiotp:    --> -ms-chap-challenge=0xf54c102e95a800d8
(4) multiotp: EXPAND -ms-chap-response=%{MS-CHAP-Response}
(4) multiotp:    --> -ms-chap-response=0x0001000000000000000000000000000000000000000000000000e3004419ce4b084c0b073836fd40f3828fcc7c4223b0dcc5
(4) multiotp: EXPAND -ms-chap2-response=%{MS-CHAP2-Response}
(4) multiotp:    --> -ms-chap2-response=
(4) multiotp: ERROR: Failed parsing output from: /usr/local/bin/multiotp.php '%{User-Name}' '%{User-Password}' -request-nt-key -src=%{Packet-Src-IP-Address} -chap-challenge=%{CHAP-Challenge} -chap-password=%{CHAP-Password} -ms-chap-challenge=%{MS-CHAP-Challenge} -ms-chap-response=%{MS-CHAP-Response} -ms-chap2-response=%{MS-CHAP2-Response}: Expecting opera
tor
(4) multiotp: ERROR: Program returned code (0) and output 'Filter-Id += "<user_group>",NT_KEY: A7C014D1209A4078F1003810BDB08BE6  '
(4)     [multiotp] = fail
(4)   } # authorize = fail
(4) Using Post-Auth-Type Reject
(4) # Executing group from file /etc/raddb/sites-enabled/default
(4)   Post-Auth-Type REJECT {
.
.
.

답변1

로부터FreeRADIUS 메일링 리스트, MultiOTP의 응답은 'Filter-Id += "<user_group>",NT_KEY: A7C014D1209A4078F1003810BDB08BE6 'FreeRADIUS 3에서는 유효하지 않지만 FreeRADIUS 2에서는 작동했을 수 있습니다.

나는 래퍼 스크립트를 사용하여 [MultiOTP[(https://github.com/multiOTP/multiotp), 'authenticate' 섹션의 'exec' 단계에 대해 'Filter-Id += "Erica-Users' 부분만 반환하고, 'authorize' 단계의 'mschap' 단계에 대해 'NT_KEY: A7C014D1209A4078F1003810BDB08BE6' 부분만 반환합니다. FreeRADIUS 인증 프로세스.

MultiOTP가 포함된 FreeRADIUS 3에 대한 문서는 주목할 가치가 있습니다.멀티OTP 읽어보기.md, 그리고FreeRADIUS 위키, 이 글을 쓰는 시점에는 그렇지 않으며 실제로 FreeRADIUS 3에서 사용되는 파일 이름을 제안하지 않습니다.

MultiOTP 자체의 구성 단계는 정확합니다.

프리라디우스 3온라인에 훌륭한 문서가 있습니다여기, 정중하고 도움이 되는메일링 리스트.

동일한 문제를 겪고 있는 사람을 위해 FreeRADIUS 3 구성에 대한 몇 가지 코드 조각이 있습니다. 특정 환경에 더 구체적일 수 있는 가상 서버 구성 파일은 표시하지 않았습니다.

/usr/local/bin/multiotp_wrapper_mschap.sh:

#!/bin/bash

# Extract Filter-Id

user_name=$1
user_password=$2
packet_src_ip_address=$3
ms_chap_challange=$4
ms_chap_response=$5

/usr/local/bin/multiotp.php ${user_name} ${user_password} -request-nt-key -src=${packet_src_ip_address} -ms-chap-challenge=${ms_chap_challange} -ms-chap-response=${ms_chap_response} | sed -e 's/.*,//'

/usr/local/bin/multiotp_wrapper_exec.sh

#!/bin/bash

# Extract NT_KEY

user_name=$1
user_password=$2
packet_src_ip_address=$3
ms_chap_challange=$4
ms_chap_response=$5

/usr/local/bin/multiotp.php ${user_name} ${user_password} -request-nt-key -src=${packet_src_ip_address} -ms-chap-challenge=${ms_chap_challange} -ms-chap-response=${ms_chap_response} | sed -e 's/,NT_KEY.*$//'

/etc/raddb/mods-enabled/multiotp:

exec multiotp {  
  wait = yes
  input_pairs = request
  output_pairs = reply
  program = "/usr/local/bin/multiotp_wrapper_exec.sh '%{User-Name}' '%{User-Password}' %{Packet-Src-IP-Address} %{MS-CHAP-Challenge} %{MS-CHAP-Response}"
  shell_escape = yes
}

/etc/raddb/mods-enabled/multiotpmschap:

mschap multiotpmschap {
  # ntlm_auth = "/usr/local/bin/multiotp.php '%{User-Name}' '%{User-Password}' -request-nt-key -src=%{Packet-Src-IP-Address} -chap-challenge=%{CHAP-Challenge} -chap-password=%{CHAP-Password} -ms-chap-challenge=%{MS-CHAP-Challenge} -ms-chap-response=%{MS-CHAP-Response} -ms-chap2-response=%{MS-CHAP2-Response}"
  ntlm_auth = "/usr/local/bin/multiotp_wrapper_mschap.sh '%{User-Name}' '%{User-Password}' %{Packet-Src-IP-Address} %{MS-CHAP-Challenge} %{MS-CHAP-Response}"
  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
  }
}

답변2

다른 사람이 "오류: 출력 구문 분석 실패"를 받은 경우 multiotp.ini에서 "로그 표시" 옵션을 확인하십시오. 활성화된 경우 문제가 발생할 수도 있습니다.

나타내다: https://github.com/multiOTP/multiotp/issues/125

관련 정보