--- a/net/pfSense-pkg-freeradius3/files/usr/local/pkg/freeradius.inc +++ b/net/pfSense-pkg-freeradius3/files/usr/local/pkg/freeradius.inc @@ -XXX,6 +XXX,7 @@ $settingsconfig = config_get_path('installedpackages/freeradiussettings/config/0'); $varotpenable = ($settingsconfig['varotpenable'] == 'on') ? true : false; + $varotpantireplay = ($settingsconfig['varotpantireplay'] == 'on') ? '1' : '0'; // ... existing code ... @@ -XXX,7 +XXX,7 @@ exec googleauth { wait = yes input_pairs = request output_pairs = reply - program = "{$varFREERADIUS_SCRIPTS}/googleauth.py %{request:User-Name} %{reply:MOTP-Init-Secret} %{reply:MOTP-PIN} %{request:User-Password}" + program = "{$varFREERADIUS_SCRIPTS}/googleauth.py %{request:User-Name} %{reply:MOTP-Init-Secret} %{reply:MOTP-PIN} %{request:User-Password} {$varotpantireplay}" shell_escape = yes } ================================================================================ INSTRUCTIONS DÉTAILLÉES POUR MODIFIER freeradius.inc ================================================================================ Le fichier freeradius.inc est volumineux (~4000 lignes). Voici comment trouver et modifier les bonnes sections : MODIFICATION 1 : Lire le nouveau paramètre ------------------------------------------ Chercher avec grep : $ grep -n "varotpenable" freeradius.inc Vous trouverez une ligne comme : $varotpenable = ($settingsconfig['varotpenable'] == 'on') ? true : false; AJOUTER juste après cette ligne : $varotpantireplay = ($settingsconfig['varotpantireplay'] == 'on') ? '1' : '0'; MODIFICATION 2 : Passer le paramètre au script googleauth.py ------------------------------------------------------------ Chercher avec grep : $ grep -n "googleauth.py" freeradius.inc Vous trouverez une ligne comme : program = "{$varFREERADIUS_SCRIPTS}/googleauth.py %{request:User-Name} %{reply:MOTP-Init-Secret} %{reply:MOTP-PIN} %{request:User-Password}" REMPLACER par : program = "{$varFREERADIUS_SCRIPTS}/googleauth.py %{request:User-Name} %{reply:MOTP-Init-Secret} %{reply:MOTP-PIN} %{request:User-Password} {$varotpantireplay}" (Ajout de " {$varotpantireplay}" à la fin) VÉRIFICATION ------------ Après modification, le bloc exec googleauth devrait ressembler à : exec googleauth { wait = yes input_pairs = request output_pairs = reply program = "{$varFREERADIUS_SCRIPTS}/googleauth.py %{request:User-Name} %{reply:MOTP-Init-Secret} %{reply:MOTP-PIN} %{request:User-Password} {$varotpantireplay}" shell_escape = yes } COMMANDES SED POUR AUTOMATISER (à adapter selon numéros de ligne exacts) ------------------------------------------------------------------------ # Backup d'abord ! cp freeradius.inc freeradius.inc.bak # Modification 1 : Ajouter la variable (après la ligne varotpenable) sed -i '/\$varotpenable = .*varotpenable.*on/a\ $varotpantireplay = ($settingsconfig['"'"'varotpantireplay'"'"'] == '"'"'on'"'"') ? '"'"'1'"'"' : '"'"'0'"'"';' freeradius.inc # Modification 2 : Ajouter le paramètre à l'appel googleauth.py sed -i 's|googleauth.py %{request:User-Name} %{reply:MOTP-Init-Secret} %{reply:MOTP-PIN} %{request:User-Password}"|googleauth.py %{request:User-Name} %{reply:MOTP-Init-Secret} %{reply:MOTP-PIN} %{request:User-Password} {$varotpantireplay}"|g' freeradius.inc # Vérifier grep -A2 -B2 "varotpantireplay" freeradius.inc grep "googleauth.py" freeradius.inc