================================================================================
MODIFICATION DE freeradiussettings.xml
================================================================================

LOCALISATION
------------

Chercher la section OTP existante avec :
$ grep -n "varotpenable" freeradiussettings.xml

Vous trouverez un bloc <field> comme :

    <field>
        <fielddescr>Enable mOTP</fielddescr>
        <fieldname>varotpenable</fieldname>
        ...
    </field>

AJOUTER le nouveau bloc APRÈS ce champ </field> et AVANT le prochain <field>


BLOC XML À INSÉRER
------------------

Copier-coller exactement ce bloc :

		<field>
			<fielddescr>Enable OTP Anti-Replay Protection</fielddescr>
			<fieldname>varotpantireplay</fieldname>
			<description>
				<![CDATA[
				Enable anti-replay protection for OTP authentication (Google Authenticator and mOTP).<br/>
				<span class="text-info">When enabled, each OTP code can only be used once within its validity window (90 seconds).</span><br/>
				<span class="text-warning">This provides RFC 6238 compliance and prevents replay attacks where an intercepted code could be reused.</span><br/>
				<span class="text-info">(Default: unchecked - disabled for backward compatibility)</span>
				]]>
			</description>
			<type>checkbox</type>
			<default_value></default_value>
		</field>


RÉSULTAT ATTENDU
----------------

La section devrait ressembler à ceci après modification :

        ...
		<field>
			<fielddescr>Enable mOTP</fielddescr>
			<fieldname>varotpenable</fieldname>
			<description>
				<![CDATA[
				Check this to enable mOTP / Google Authenticator authentication for users.<br/>
				...existing description...
				]]>
			</description>
			<type>checkbox</type>
			<enablefields>...</enablefields>
		</field>
		<field>
			<fielddescr>Enable OTP Anti-Replay Protection</fielddescr>
			<fieldname>varotpantireplay</fieldname>
			<description>
				<![CDATA[
				Enable anti-replay protection for OTP authentication (Google Authenticator and mOTP).<br/>
				<span class="text-info">When enabled, each OTP code can only be used once within its validity window (90 seconds).</span><br/>
				<span class="text-warning">This provides RFC 6238 compliance and prevents replay attacks where an intercepted code could be reused.</span><br/>
				<span class="text-info">(Default: unchecked - disabled for backward compatibility)</span>
				]]>
			</description>
			<type>checkbox</type>
			<default_value></default_value>
		</field>
        ... (autres champs) ...


COMMANDE SED POUR AUTOMATISER
-----------------------------

# Backup
cp freeradiussettings.xml freeradiussettings.xml.bak

# Cette commande est complexe car elle insère plusieurs lignes
# Il est recommandé d'éditer manuellement avec nano/vim

# Vérification après modification
grep -A5 "varotpantireplay" freeradiussettings.xml


VALIDATION XML
--------------

Après modification, vérifier que le XML est valide :
$ xmllint --noout freeradiussettings.xml

Si pas d'erreur = OK
Si erreur = vérifier les balises et l'encodage CDATA
