+
+mod_random
+
+Cryptographically secure random token generation
+
+Extension
+mod_random.c
+random_module
+
+
+ This module generates cryptographically secure random tokens and
+ injects them into environment variables and/or HTTP response headers
+ for each request. It is designed for security-critical applications
+ that require unpredictable, high-entropy tokens.
+
+ Common use cases include CSRF (Cross-Site Request Forgery) protection,
+ request identifiers for logging and tracing, nonces for Content Security
+ Policy headers, and one-time tokens for various security mechanisms.
+
+ The module uses the system's cryptographically secure pseudo-random
+ number generator (CSPRNG) via apr_generate_random_bytes(),
+ providing 128 bits of entropy by default (16 bytes). It supports multiple
+ output formats (base64, hex, base64url, custom alphabet), optional
+ timestamp inclusion, TTL-based caching for performance, and HMAC-SHA256
+ token signing with metadata.
+
+
+mod_unique_id
+mod_ssl
+Environment Variables
+
+
+Features
+
+ - CSPRNG-based token generation (cryptographically secure)
+ - Multiple output formats: base64, hex, base64url, custom alphabet
+ - Configurable token length (1-1024 bytes)
+ - Optional timestamp prefix
+ - Custom prefix and suffix support
+ - TTL-based caching for performance optimization
+ - HMAC-SHA256 token signing with expiry metadata
+ - URL pattern filtering (conditional generation)
+ - Multiple tokens per request
+ - Thread-safe with per-token mutex protection
+ - Output to environment variables and/or HTTP headers
+
+
+
+
+Security Considerations
+ Cryptographic Strength: The module uses
+ apr_generate_random_bytes() which provides cryptographically
+ secure random data from the operating system's entropy source. The default
+ 128-bit entropy ensures negligible collision probability.
+
+ Not Guaranteed Unique: While collision probability is
+ extremely low with sufficient entropy, tokens are not guaranteed to be
+ globally unique. For guaranteed unique identifiers, use
+ mod_unique_id instead.
+
+ Token Validation: When using
+ RandomEncodeMetadata with
+ RandomSigningKey, tokens
+ include an HMAC-SHA256 signature that can be validated to ensure integrity
+ and detect tampering.
+
+ Cache Security: Cached tokens (via
+ RandomTTL) are stored in
+ memory and protected by thread-safe mutexes. The module handles clock
+ backward scenarios (NTP corrections) by invalidating affected cache entries.
+
+
+
+Usage Examples
+
+ Basic CSRF Token
+
+<Location "/secure">
+ RandomAddToken CSRF_TOKEN
+</Location>
+
+
+
+ This generates a base64-encoded 16-byte token in the
+ CSRF_TOKEN environment variable for all requests to
+ /secure.
+
+ Token in HTTP Header
+
+<Location "/api">
+ RandomLength 32
+ RandomFormat base64url
+ RandomAddToken CSRF_TOKEN header=X-CSRF-Token
+</Location>
+
+
+
+ This generates a 32-byte base64url token and outputs it both to the
+ CSRF_TOKEN environment variable and the
+ X-CSRF-Token HTTP response header.
+
+ Cached Token with TTL
+
+<Location "/forms">
+ RandomTTL 300
+ RandomAddToken FORM_TOKEN
+</Location>
+
+
+
+ This generates a token that is cached for 5 minutes (300 seconds),
+ reducing CPU overhead for frequently accessed resources.
+
+ Signed Token with Expiry
+
+<Location "/payments">
+ RandomEncodeMetadata On
+ RandomExpiry 3600
+ RandomSigningKey "your-secret-hmac-key-here"
+ RandomAddToken PAYMENT_TOKEN
+</Location>
+
+
+
+ This generates a token that includes expiry metadata and an HMAC-SHA256
+ signature, allowing server-side validation of token age and integrity.
+
+ Custom Alphabet Token
+
+<Location "/codes">
+ RandomFormat custom
+ RandomAlphabet "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
+ RandomAlphabetGrouping 4
+ RandomLength 16
+ RandomAddToken PROMO_CODE
+</Location>
+
+
+
+ This generates a human-readable token using a custom alphabet
+ (excluding confusing characters like 0/O, 1/I/L) with grouping every
+ 4 characters for readability.
+
+ Using with mod_headers for CSP Nonce
+
+<Location "/app">
+ RandomLength 16
+ RandomFormat base64url
+ RandomAddToken CSP_NONCE header=X-CSP-Nonce
+ Header set Content-Security-Policy "script-src 'nonce-%{CSP_NONCE}e';"
+</Location>
+
+
+
+ This generates a unique nonce for Content Security Policy and includes
+ it both in the CSP header and as a custom header for client-side access.
+
+ Request ID for Logging and Tracing
+
+<Location "/">
+ RandomLength 16
+ RandomFormat hex
+ RandomAddToken REQUEST_ID header=X-Request-ID
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %{REQUEST_ID}e" combined_with_id
+ CustomLog logs/access_log combined_with_id
+</Location>
+
+
+
+ This generates a unique request ID that is sent to the client via
+ the X-Request-ID header and logged for request tracing and debugging.
+
+ Multiple Tokens with mod_headers
+
+<Location "/secure-api">
+ # CSRF token for form protection
+ RandomAddToken CSRF_TOKEN header=X-CSRF-Token
+
+ # Request ID for tracing
+ RandomFormat base64url
+ RandomAddToken REQUEST_ID header=X-Request-ID
+
+ # Session nonce with expiry
+ RandomEncodeMetadata On
+ RandomExpiry 1800
+ RandomSigningKey "your-hmac-secret-key"
+ RandomAddToken SESSION_NONCE header=X-Session-Nonce
+</Location>
+
+
+
+ This demonstrates using multiple tokens with different configurations
+ for various security purposes in a single location.
+
+
+
+RandomAddToken
+Add a random token to the request
+RandomAddToken var-name [key=value ...]
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ This directive creates a random token and stores it in the specified
+ environment variable. Optional parameters can override global defaults
+ for this specific token.
+
+ The var-name parameter is required and
+ specifies the environment variable name where the token will be stored.
+ Additional optional parameters can be specified as key=value
+ pairs:
+
+
+ length=N
+ - Token length in bytes (1-1024). Overrides
+ RandomLength.
+
+ format=format
+ - Output format:
base64, hex,
+ base64url, or custom. Overrides
+ RandomFormat.
+
+ header=name
+ - HTTP response header name to output the token.
+
+ timestamp=on|off
+ - Include Unix timestamp prefix. Overrides
+ RandomIncludeTimestamp.
+
+ prefix=string
+ - Custom prefix. Overrides
+ RandomPrefix.
+
+ suffix=string
+ - Custom suffix. Overrides
+ RandomSuffix.
+
+ ttl=seconds
+ - Cache TTL in seconds (0-86400). Overrides
+ RandomTTL.
+
+
+ Example
+
+# Simple token
+RandomAddToken MY_TOKEN
+
+# Token with custom parameters
+RandomAddToken API_TOKEN length=32 format=hex header=X-API-Token
+
+# Multiple tokens
+RandomAddToken CSRF_TOKEN
+RandomAddToken REQUEST_ID format=base64url
+
+
+
+ Note: Up to 50 tokens can be defined per configuration
+ context to prevent DoS attacks via excessive configuration.
+
+
+
+
+RandomLength
+Default token length in bytes
+RandomLength bytes
+RandomLength 16
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Sets the default number of random bytes to generate for tokens.
+ Valid range is 1-1024 bytes.
+
+ The default of 16 bytes provides 128 bits of entropy, which is
+ sufficient for most security applications. Larger values provide more
+ entropy but result in longer encoded tokens.
+
+ Example
+
+# 256-bit entropy
+RandomLength 32
+
+
+
+
+
+
+RandomFormat
+Default token output format
+RandomFormat base64|hex|base64url|custom
+RandomFormat base64
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Sets the default encoding format for tokens:
+
+
+ base64
+ - Standard base64 encoding (RFC 4648). Output contains A-Z, a-z,
+ 0-9, +, /, and = padding. Good for general use.
+
+ hex
+ - Hexadecimal encoding (0-9, a-f). Output is twice the byte length.
+ Good for debugging and readability.
+
+ base64url
+ - URL-safe base64 (RFC 4648). Uses - and _ instead of + and /,
+ no padding. Ideal for URLs and HTTP headers.
+
+ custom
+ - Custom alphabet encoding. Requires
+ RandomAlphabet.
+ Good for human-readable tokens.
+
+
+ Example
+
+RandomFormat base64url
+
+
+
+
+
+
+RandomIncludeTimestamp
+Include timestamp prefix in tokens
+RandomIncludeTimestamp On|Off
+RandomIncludeTimestamp Off
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ When enabled, prepends the current Unix timestamp (seconds since epoch)
+ to the token, separated by a hyphen.
+
+ This is useful for debugging, log correlation, or approximate age
+ verification without cryptographic metadata.
+
+ Example
+
+RandomIncludeTimestamp On
+# Generates tokens like: 1701234567-Ab3dEf...
+
+
+
+ Note: For precise expiry validation with cryptographic
+ verification, use RandomEncodeMetadata
+ instead.
+
+
+
+
+RandomPrefix
+Default prefix for all tokens
+RandomPrefix string
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Adds a fixed prefix to all generated tokens. Useful for token
+ identification or versioning.
+
+ Example
+
+RandomPrefix "csrf_"
+# Generates tokens like: csrf_Ab3dEf...
+
+
+
+
+
+
+RandomSuffix
+Default suffix for all tokens
+RandomSuffix string
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Adds a fixed suffix to all generated tokens. Useful for token
+ versioning or format identification.
+
+ Example
+
+RandomSuffix "_v2"
+# Generates tokens like: Ab3dEf..._v2
+
+
+
+
+
+
+RandomTTL
+Cache TTL for tokens in seconds
+RandomTTL seconds
+RandomTTL 0
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Enables token caching with the specified time-to-live in seconds.
+ Valid range is 0-86400 (24 hours). A value of 0 disables caching.
+
+ Caching reduces CPU overhead and entropy consumption for frequently
+ accessed resources. Each token has its own cache protected by a mutex
+ for thread safety.
+
+ The module handles clock backward scenarios (NTP corrections) by
+ automatically invalidating affected cache entries.
+
+ Example
+
+# Cache tokens for 5 minutes
+RandomTTL 300
+
+
+
+ Security Note: Cached tokens are reused for all
+ requests within the TTL period. For per-request uniqueness, keep TTL at 0.
+
+
+
+
+RandomOnlyFor
+Generate tokens only for matching URL patterns
+RandomOnlyFor regex
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Conditionally generates tokens only when the request URI matches the
+ specified extended regular expression (POSIX ERE).
+
+ This is useful for fine-grained control over token generation,
+ such as limiting to specific API endpoints.
+
+ Example
+
+<Location "/api">
+ # Only generate for /api/v1/* endpoints
+ RandomOnlyFor "^/api/v1/"
+ RandomAddToken API_TOKEN
+</Location>
+
+
+
+
+
+
+RandomAlphabet
+Custom character set for custom format
+RandomAlphabet characters
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Defines a custom alphabet for custom format encoding.
+ Required when RandomFormat
+ is set to custom.
+
+ The alphabet must contain at least 2 unique characters and no more
+ than 256. Duplicate characters are rejected.
+
+ Example
+
+# Crockford's Base32 (human-readable, no ambiguous characters)
+RandomFormat custom
+RandomAlphabet "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
+
+
+
+ Note: Alphabets that are not powers of 2 in size
+ may introduce slight bias in character distribution.
+
+
+
+
+RandomAlphabetGrouping
+Group custom alphabet output every N characters
+RandomAlphabetGrouping N
+RandomAlphabetGrouping 0
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ When using custom format, inserts a hyphen separator
+ every N characters for improved readability. Valid range is
+ 0-128. A value of 0 disables grouping.
+
+ Example
+
+RandomFormat custom
+RandomAlphabet "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
+RandomAlphabetGrouping 4
+# Generates tokens like: A3D5-7K9M-P2Q8-...
+
+
+
+
+
+
+RandomEncodeMetadata
+Encode expiry metadata into tokens
+RandomEncodeMetadata On|Off
+RandomEncodeMetadata Off
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ When enabled, encodes expiry timestamp and optional HMAC-SHA256
+ signature into the token. Requires
+ RandomExpiry to be set
+ greater than 0.
+
+ If RandomSigningKey is
+ configured, the token includes an HMAC-SHA256 signature that can be
+ validated to ensure integrity.
+
+ Token format: expiry:random:signature (with signature)
+ or expiry:random (without signature).
+
+ Example
+
+RandomEncodeMetadata On
+RandomExpiry 3600
+RandomSigningKey "your-secret-key"
+
+
+
+
+
+
+RandomExpiry
+Token expiration time in seconds
+RandomExpiry seconds
+RandomExpiry 0
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Sets the token expiration time in seconds when using
+ RandomEncodeMetadata.
+ Valid range is 0-31536000 (1 year). A value of 0 means no expiry.
+
+ Example
+
+# 1-hour expiry
+RandomExpiry 3600
+
+
+
+
+
+
+RandomSigningKey
+HMAC-SHA256 signing key for token validation
+RandomSigningKey key
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Sets the secret key used for HMAC-SHA256 signature generation when
+ RandomEncodeMetadata is
+ enabled.
+
+ The key should be a strong, random string. It must be kept secret
+ and should be the same across all servers that need to validate tokens.
+
+ Example
+
+RandomSigningKey "your-secret-hmac-key-change-this"
+
+
+
+ Security Warning: Store the signing key securely.
+ Consider using environment variables or include files with restricted
+ permissions instead of hardcoding it in the main configuration.
+
+
+
+
diff --git a/docs/manual/mod/mod_random.xml.fr b/docs/manual/mod/mod_random.xml.fr
new file mode 100644
index 00000000000..2f3718de3c7
--- /dev/null
+++ b/docs/manual/mod/mod_random.xml.fr
@@ -0,0 +1,688 @@
+
+
+
+
+
+
+
+
+
+
+mod_random
+
+Génération de jetons aléatoires cryptographiquement sécurisés
+
+Extension
+mod_random.c
+random_module
+
+
+ Ce module génère des jetons aléatoires cryptographiquement
+ sécurisés et les injecte dans les variables d'environnement et/ou
+ les en-têtes de réponse HTTP pour chaque requête. Il est conçu
+ pour les applications critiques en matière de sécurité qui
+ nécessitent des jetons imprévisibles à haute entropie.
+
+ Les cas d'utilisation courants incluent la protection CSRF (Cross-Site
+ Request Forgery), les identifiants de requête pour la journalisation et
+ le traçage, les nonces pour les en-têtes Content Security Policy,
+ et les jetons à usage unique pour divers mécanismes de sécurité.
+
+ Le module utilise le générateur de nombres pseudo-aléatoires
+ cryptographiquement sécurisé (CSPRNG) du système via
+ apr_generate_random_bytes(), fournissant 128 bits d'entropie
+ par défaut (16 octets). Il supporte plusieurs formats de sortie (base64,
+ hex, base64url, alphabet personnalisé), l'inclusion optionnelle d'horodatage,
+ la mise en cache basée sur TTL pour les performances, et la signature de
+ jetons HMAC-SHA256 avec métadonnées.
+
+
+mod_unique_id
+mod_ssl
+Variables d'environnement
+
+
+Fonctionnalités
+
+ - Génération de jetons basée sur CSPRNG (cryptographiquement sécurisé)
+ - Plusieurs formats de sortie : base64, hex, base64url, alphabet personnalisé
+ - Longueur de jeton configurable (1-1024 octets)
+ - Préfixe d'horodatage optionnel
+ - Support de préfixe et suffixe personnalisés
+ - Mise en cache basée sur TTL pour optimisation des performances
+ - Signature de jetons HMAC-SHA256 avec métadonnées d'expiration
+ - Filtrage par motif d'URL (génération conditionnelle)
+ - Jetons multiples par requête
+ - Sécurisé pour les threads avec protection mutex par jeton
+ - Sortie vers variables d'environnement et/ou en-têtes HTTP
+
+
+
+
+Considérations de sécurité
+ Robustesse cryptographique : Le module utilise
+ apr_generate_random_bytes() qui fournit des données
+ aléatoires cryptographiquement sécurisées à partir de la
+ source d'entropie du système d'exploitation. L'entropie par défaut de
+ 128 bits garantit une probabilité de collision négligeable.
+
+ Unicité non garantie : Bien que la probabilité de
+ collision soit extrêmement faible avec une entropie suffisante, les jetons
+ ne sont pas garantis d'être globalement uniques. Pour des identifiants
+ uniques garantis, utilisez mod_unique_id à la place.
+
+ Validation de jetons : Lors de l'utilisation de
+ RandomEncodeMetadata avec
+ RandomSigningKey, les jetons
+ incluent une signature HMAC-SHA256 qui peut être validée pour assurer
+ l'intégrité et détecter les falsifications.
+
+ Sécurité du cache : Les jetons en cache (via
+ RandomTTL) sont stockés en
+ mémoire et protégés par des mutex sécurisés pour les threads.
+ Le module gère les scénarios de recul d'horloge (corrections NTP) en
+ invalidant les entrées de cache affectées.
+
+
+
+Exemples d'utilisation
+
+ Jeton CSRF basique
+
+<Location "/secure">
+ RandomAddToken CSRF_TOKEN
+</Location>
+
+
+
+ Ceci génère un jeton de 16 octets encodé en base64 dans la
+ variable d'environnement CSRF_TOKEN pour toutes les requêtes
+ vers /secure.
+
+ Jeton dans un en-tête HTTP
+
+<Location "/api">
+ RandomLength 32
+ RandomFormat base64url
+ RandomAddToken CSRF_TOKEN header=X-CSRF-Token
+</Location>
+
+
+
+ Ceci génère un jeton de 32 octets en base64url et l'envoie à la
+ fois dans la variable d'environnement CSRF_TOKEN et dans
+ l'en-tête de réponse HTTP X-CSRF-Token.
+
+ Jeton en cache avec TTL
+
+<Location "/forms">
+ RandomTTL 300
+ RandomAddToken FORM_TOKEN
+</Location>
+
+
+
+ Ceci génère un jeton qui est mis en cache pendant 5 minutes
+ (300 secondes), réduisant la charge CPU pour les ressources fréquemment
+ accédées.
+
+ Jeton signé avec expiration
+
+<Location "/payments">
+ RandomEncodeMetadata On
+ RandomExpiry 3600
+ RandomSigningKey "votre-clé-secrète-hmac-ici"
+ RandomAddToken PAYMENT_TOKEN
+</Location>
+
+
+
+ Ceci génère un jeton qui inclut des métadonnées d'expiration et
+ une signature HMAC-SHA256, permettant la validation côté serveur de l'âge
+ et de l'intégrité du jeton.
+
+ Jeton avec alphabet personnalisé
+
+<Location "/codes">
+ RandomFormat custom
+ RandomAlphabet "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
+ RandomAlphabetGrouping 4
+ RandomLength 16
+ RandomAddToken PROMO_CODE
+</Location>
+
+
+
+ Ceci génère un jeton lisible par l'homme en utilisant un alphabet
+ personnalisé (évitant les caractères ambigus comme 0/O, 1/I/L) avec
+ groupement tous les 4 caractères pour améliorer la lisibilité.
+
+ Utilisation avec mod_headers pour CSP Nonce
+
+<Location "/app">
+ RandomLength 16
+ RandomFormat base64url
+ RandomAddToken CSP_NONCE header=X-CSP-Nonce
+ Header set Content-Security-Policy "script-src 'nonce-%{CSP_NONCE}e';"
+</Location>
+
+
+
+ Ceci génère un nonce unique pour la Content Security Policy et l'inclut
+ à la fois dans l'en-tête CSP et comme en-tête personnalisé pour accès
+ côté client.
+
+ ID de requête pour journalisation et traçage
+
+<Location "/">
+ RandomLength 16
+ RandomFormat hex
+ RandomAddToken REQUEST_ID header=X-Request-ID
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %{REQUEST_ID}e" combined_with_id
+ CustomLog logs/access_log combined_with_id
+</Location>
+
+
+
+ Ceci génère un identifiant de requête unique envoyé au client via
+ l'en-tête X-Request-ID et journalisé pour le traçage et le débogage.
+
+ Jetons multiples avec mod_headers
+
+<Location "/secure-api">
+ # Jeton CSRF pour protection des formulaires
+ RandomAddToken CSRF_TOKEN header=X-CSRF-Token
+
+ # ID de requête pour traçage
+ RandomFormat base64url
+ RandomAddToken REQUEST_ID header=X-Request-ID
+
+ # Nonce de session avec expiration
+ RandomEncodeMetadata On
+ RandomExpiry 1800
+ RandomSigningKey "votre-clé-secrète-hmac"
+ RandomAddToken SESSION_NONCE header=X-Session-Nonce
+</Location>
+
+
+
+ Ceci démontre l'utilisation de jetons multiples avec différentes
+ configurations pour divers objectifs de sécurité dans un seul emplacement.
+
+
+
+RandomAddToken
+Ajoute un jeton aléatoire à la requête
+RandomAddToken nom-var [clé=valeur ...]
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Cette directive crée un jeton aléatoire et le stocke dans la variable
+ d'environnement spécifiée. Des paramètres optionnels peuvent remplacer
+ les valeurs par défaut globales pour ce jeton spécifique.
+
+ Le paramètre nom-var est obligatoire et
+ spécifie le nom de la variable d'environnement où le jeton sera stocké.
+ Des paramètres optionnels supplémentaires peuvent être spécifiés
+ sous forme de paires clé=valeur :
+
+
+ length=N
+ - Longueur du jeton en octets (1-1024). Remplace
+ RandomLength.
+
+ format=format
+ - Format de sortie :
base64, hex,
+ base64url, ou custom. Remplace
+ RandomFormat.
+
+ header=nom
+ - Nom de l'en-tête de réponse HTTP pour sortir le jeton.
+
+ timestamp=on|off
+ - Inclure un préfixe d'horodatage Unix. Remplace
+ RandomIncludeTimestamp.
+
+ prefix=chaîne
+ - Préfixe personnalisé. Remplace
+ RandomPrefix.
+
+ suffix=chaîne
+ - Suffixe personnalisé. Remplace
+ RandomSuffix.
+
+ ttl=secondes
+ - TTL du cache en secondes (0-86400). Remplace
+ RandomTTL.
+
+
+ Exemple
+
+# Jeton simple
+RandomAddToken MY_TOKEN
+
+# Jeton avec paramètres personnalisés
+RandomAddToken API_TOKEN length=32 format=hex header=X-API-Token
+
+# Jetons multiples
+RandomAddToken CSRF_TOKEN
+RandomAddToken REQUEST_ID format=base64url
+
+
+
+ Note : Jusqu'à 50 jetons peuvent être définis par
+ contexte de configuration pour prévenir les attaques DoS via une
+ configuration excessive.
+
+
+
+
+RandomLength
+Longueur par défaut du jeton en octets
+RandomLength octets
+RandomLength 16
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Définit le nombre par défaut d'octets aléatoires à générer pour
+ les jetons. La plage valide est de 1 à 1024 octets.
+
+ La valeur par défaut de 16 octets fournit 128 bits d'entropie, ce qui
+ est suffisant pour la plupart des applications de sécurité. Des valeurs
+ plus grandes fournissent plus d'entropie mais résultent en jetons encodés
+ plus longs.
+
+ Exemple
+
+# Entropie de 256 bits
+RandomLength 32
+
+
+
+
+
+
+RandomFormat
+Format de sortie par défaut du jeton
+RandomFormat base64|hex|base64url|custom
+RandomFormat base64
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Définit le format d'encodage par défaut pour les jetons :
+
+
+ base64
+ - Encodage base64 standard (RFC 4648). La sortie contient A-Z, a-z,
+ 0-9, +, /, et padding =. Bon pour usage général.
+
+ hex
+ - Encodage hexadécimal (0-9, a-f). La sortie fait deux fois la
+ longueur en octets. Bon pour le débogage et la lisibilité.
+
+ base64url
+ - Base64 sécurisé pour URL (RFC 4648). Utilise - et _ au lieu de
+ + et /, sans padding. Idéal pour URLs et en-têtes HTTP.
+
+ custom
+ - Encodage avec alphabet personnalisé. Nécessite
+ RandomAlphabet.
+ Bon pour jetons lisibles par l'homme.
+
+
+ Exemple
+
+RandomFormat base64url
+
+
+
+
+
+
+RandomIncludeTimestamp
+Inclure un préfixe d'horodatage dans les jetons
+RandomIncludeTimestamp On|Off
+RandomIncludeTimestamp Off
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Lorsqu'activé, ajoute l'horodatage Unix actuel (secondes depuis epoch)
+ au début du jeton, séparé par un trait d'union.
+
+ Ceci est utile pour le débogage, la corrélation des journaux, ou la
+ vérification approximative de l'âge sans métadonnées cryptographiques.
+
+ Exemple
+
+RandomIncludeTimestamp On
+# Génère des jetons comme : 1701234567-Ab3dEf...
+
+
+
+ Note : Pour une validation d'expiration précise avec
+ vérification cryptographique, utilisez
+ RandomEncodeMetadata à la place.
+
+
+
+
+RandomPrefix
+Préfixe par défaut pour tous les jetons
+RandomPrefix chaîne
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Ajoute un préfixe fixe à tous les jetons générés. Utile pour
+ l'identification ou le versioning des jetons.
+
+ Exemple
+
+RandomPrefix "csrf_"
+# Génère des jetons comme : csrf_Ab3dEf...
+
+
+
+
+
+
+RandomSuffix
+Suffixe par défaut pour tous les jetons
+RandomSuffix chaîne
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Ajoute un suffixe fixe à tous les jetons générés. Utile pour le
+ versioning ou l'identification du format des jetons.
+
+ Exemple
+
+RandomSuffix "_v2"
+# Génère des jetons comme : Ab3dEf..._v2
+
+
+
+
+
+
+RandomTTL
+TTL du cache pour les jetons en secondes
+RandomTTL secondes
+RandomTTL 0
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Active la mise en cache des jetons avec le temps de vie spécifié en
+ secondes. La plage valide est 0-86400 (24 heures). Une valeur de 0
+ désactive la mise en cache.
+
+ La mise en cache réduit la charge CPU et la consommation d'entropie
+ pour les ressources fréquemment accédées. Chaque jeton a son propre cache
+ protégé par un mutex pour la sécurité des threads.
+
+ Le module gère les scénarios de recul d'horloge (corrections NTP) en
+ invalidant automatiquement les entrées de cache affectées.
+
+ Exemple
+
+# Mettre en cache les jetons pendant 5 minutes
+RandomTTL 300
+
+
+
+ Note de sécurité : Les jetons en cache sont réutilisés
+ pour toutes les requêtes pendant la période TTL. Pour une unicité par
+ requête, conservez TTL à 0.
+
+
+
+
+RandomOnlyFor
+Générer des jetons uniquement pour les motifs d'URL correspondants
+RandomOnlyFor regex
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Génère conditionnellement des jetons uniquement lorsque l'URI de la
+ requête correspond à l'expression régulière étendue spécifiée (POSIX ERE).
+
+ Ceci est utile pour un contrôle fin de la génération de jetons, comme
+ limiter à des points de terminaison API spécifiques.
+
+ Exemple
+
+<Location "/api">
+ # Générer uniquement pour les points de terminaison /api/v1/*
+ RandomOnlyFor "^/api/v1/"
+ RandomAddToken API_TOKEN
+</Location>
+
+
+
+
+
+
+RandomAlphabet
+Jeu de caractères personnalisé pour format custom
+RandomAlphabet caractères
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Définit un alphabet personnalisé pour l'encodage au format
+ custom. Requis lorsque
+ RandomFormat est défini sur
+ custom.
+
+ L'alphabet doit contenir au moins 2 caractères uniques et pas plus de
+ 256. Les caractères en double sont rejetés.
+
+ Exemple
+
+# Base32 de Crockford (lisible, sans caractères ambigus)
+RandomFormat custom
+RandomAlphabet "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
+
+
+
+ Note : Les alphabets dont la taille n'est pas une
+ puissance de 2 peuvent introduire un léger biais dans la distribution
+ des caractères.
+
+
+
+
+RandomAlphabetGrouping
+Grouper la sortie de l'alphabet personnalisé tous les N caractères
+RandomAlphabetGrouping N
+RandomAlphabetGrouping 0
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Lors de l'utilisation du format custom, insère un séparateur
+ trait d'union tous les N caractères pour améliorer la lisibilité.
+ La plage valide est 0-128. Une valeur de 0 désactive le groupement.
+
+ Exemple
+
+RandomFormat custom
+RandomAlphabet "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
+RandomAlphabetGrouping 4
+# Génère des jetons comme : A3D5-7K9M-P2Q8-...
+
+
+
+
+
+
+RandomEncodeMetadata
+Encoder les métadonnées d'expiration dans les jetons
+RandomEncodeMetadata On|Off
+RandomEncodeMetadata Off
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Lorsqu'activé, encode l'horodatage d'expiration et la signature
+ HMAC-SHA256 optionnelle dans le jeton. Nécessite que
+ RandomExpiry soit défini
+ supérieur à 0.
+
+ Si RandomSigningKey est
+ configuré, le jeton inclut une signature HMAC-SHA256 qui peut être
+ validée pour assurer l'intégrité.
+
+ Format du jeton : expiration:aléatoire:signature
+ (avec signature) ou expiration:aléatoire (sans signature).
+
+ Exemple
+
+RandomEncodeMetadata On
+RandomExpiry 3600
+RandomSigningKey "votre-clé-secrète"
+
+
+
+
+
+
+RandomExpiry
+Temps d'expiration du jeton en secondes
+RandomExpiry secondes
+RandomExpiry 0
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Définit le temps d'expiration du jeton en secondes lors de l'utilisation
+ de RandomEncodeMetadata.
+ La plage valide est 0-31536000 (1 an). Une valeur de 0 signifie pas
+ d'expiration.
+
+ Exemple
+
+# Expiration de 1 heure
+RandomExpiry 3600
+
+
+
+
+
+
+RandomSigningKey
+Clé de signature HMAC-SHA256 pour validation de jetons
+RandomSigningKey clé
+
+server config
+virtual host
+directory
+.htaccess
+
+All
+
+
+ Définit la clé secrète utilisée pour la génération de signature
+ HMAC-SHA256 lorsque
+ RandomEncodeMetadata est activé.
+
+ La clé doit être une chaîne forte et aléatoire. Elle doit être
+ gardée secrète et doit être identique sur tous les serveurs qui doivent
+ valider les jetons.
+
+ Exemple
+
+RandomSigningKey "votre-clé-secrète-hmac-à-changer"
+
+
+
+ Avertissement de sécurité : Stockez la clé de
+ signature de manière sécurisée. Envisagez d'utiliser des variables
+ d'environnement ou des fichiers inclus avec permissions restreintes au
+ lieu de la coder en dur dans la configuration principale.
+
+
+
+
diff --git a/docs/manual/mod/mod_random.xml.meta b/docs/manual/mod/mod_random.xml.meta
new file mode 100644
index 00000000000..578bd47cda1
--- /dev/null
+++ b/docs/manual/mod/mod_random.xml.meta
@@ -0,0 +1,13 @@
+
+
+
+