FreeRADIUS3 - FEHLER: Beim Parsen der Ausgabe von exec ist ein Operator erwartet worden.

FreeRADIUS3 - FEHLER: Beim Parsen der Ausgabe von exec ist ein Operator erwartet worden.

FreeRADIUS 3 für OTP-Authentifizierung, die Authentifizierung ist erfolgreich, FreeRADIUS kann die Antwort jedoch nicht analysieren.

Beim Senden des Testbefehls und Überwachen der Debug-Ausgabe ( radiusd -X) tritt ein Fehler wie unten gezeigt auf, bei dem die Ausgabe nicht analysiert wird, obwohl die Antwort des externen Programms zufriedenstellend zu sein scheint:

# 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 {
.
.
.

Antwort1

Von demFreeRADIUS-Mailingliste, die Antwort von MultiOTP 'Filter-Id += "<user_group>",NT_KEY: A7C014D1209A4078F1003810BDB08BE6 'ist für FreeRADIUS 3 nicht gültig, könnte aber mit FreeRADIUS 2 gut funktioniert haben.

Ich habe dieses Problem umgangen, indem ich ein Wrapper-Skript verwendet habe, um die Ausgabe von [MultiOTP[(https://github.com/multiOTP/multiotp), gibt nur den Teil „Filter-Id += "Erica-Users" für den „exec“-Schritt des Abschnitts „Authentifizierung“ zurück und gibt nur den Teil „NT_KEY: A7C014D1209A4078F1003810BDB08BE6“ für den „mschap“-Schritt des Schritts „Autorisieren“ innerhalb des FreeRADIUS-Authentifizierungsprozesses zurück.

Beachten Sie die Dokumentation für FreeRADIUS 3 mit MultiOTP imMultiOTP README.mdund wiederholt auf derFreeRADIUS Wikisind dies zum Zeitpunkt des Schreibens nicht und es werden keine Dateinamen vorgeschlagen, die tatsächlich mit FreeRADIUS 3 verwendet werden.

Die Konfigurationsschritte für MultiOTP selbst sind korrekt.

FreeRADIUS 3verfügt über eine ausgezeichnete Online-DokumentationHierund eine höfliche und hilfsbereiteMailingliste.

Für alle, die mit demselben Problem zu kämpfen haben, sind hier einige Codeausschnitte für eine FreeRADIUS 3-Konfiguration. Ich habe die Konfigurationsdatei des virtuellen Servers nicht angezeigt, da diese für eine bestimmte Umgebung spezifischer sein kann.

/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
  }
}

Antwort2

Nur für den Fall, dass andere die Meldung „FEHLER: Ausgabe konnte nicht analysiert werden“ erhalten, überprüfen Sie bitte die Option „Protokoll anzeigen“ in multiotp.ini. Wenn diese aktiviert ist, kann sie ebenfalls das Problem verursachen.

verweisen: https://github.com/multiOTP/multiotp/issues/125

verwandte Informationen