2 # Sample rule file for the -m (remapping option)
4 # This file has three fields: operation, regex, remapping
6 # The operation is a combination of the following letters:
8 # r - rewrite the matched string with the remapping pattern
9 # i - case-insensitive matching
10 # g - repeat until no match (used with "r")
11 # e - exit (with success) if we match this pattern, do not process
13 # s - start over from the first rule if we match this pattern
14 # a - abort (refuse the request) if we match this rule
15 # G - this rule applies to TFTP GET requests only
16 # P - this rule applies to TFTP PUT requests only
18 # The regex is a regular expression in the style of egrep(1).
20 # The remapping is a pattern, all characters are verbatim except \
21 # \0 copies the full string that matched the regex
22 # \1..\9 copies the 9 first (..) expressions in the regex
25 # "#" begins a comment, unless \-escaped
27 ri ^[a-z]: # Remove "drive letters"
28 rg \\ / # Convert backslashes to slashes
29 rg \# @ # Convert hash marks to @ signs
30 rg /../ /..no../ # Convert /../ to /..no../
31 e ^ok/ # These are always ok
32 r ^[^/] /tftpboot/\0 # Convert non-absolute files
33 a \.pvt$ # Reject requests for private files