Parses /etc/hosts.{allow,deny}
Author: Raphael Pinson raphink@gmail.com
| Hosts_Access | Parses /etc/hosts.{allow,deny} |
| Reference | This lens tries to keep as close as possible to `man 5 hosts_access` where possible. |
| License | This file is licenced under the LGPLv2+, like the rest of Augeas. |
| Lens Usage | To be documented |
| Configuration files | This lens applies to /etc/hosts.{allow,deny}. |
| USEFUL PRIMITIVES | |
| colon | |
| comma | |
| sto_to_eol | |
| except | The except operator makes it possible to write very compact rules. |
| ENTRY TYPES | |
| daemon | |
| daemon_list | A list of daemons |
| client | |
| client_list | A list of clients |
| shell_command | |
| entry | |
| LENS AND FILTER | |
| lns | |
| filter |
This lens applies to /etc/hosts.{allow,deny}. See filter.
let daemon_list = Build.opt_list daemon comma
A list of daemons
let client_list = Build.opt_list client comma
A list of clients
let colon = del /[ \t]*:[ \t]*/ ": "
let comma = del /([ \t]|(\\\\\n))*,([ \t]|(\\\\\n))*/ ", "
let sto_to_eol = store /[^ \t\n:][^\n]*[^ \t\n]|[^ \t\n:]/
The except operator makes it possible to write very compact rules.
let except (lns:lens) = [ label "except" . Sep.space . del /except/i "EXCEPT" . Sep.space . lns ]
let daemon = let host = [ label "host" . Util.del_str "@" . store Rx.word ] in [ label "process" . store Rx.word . host? ]
A list of daemons
let daemon_list = Build.opt_list daemon comma
let client = let user = [ label "user" . store Rx.word . Util.del_str "@" ] in [ label "client" . user? . store Rx.word ]
A list of clients
let client_list = Build.opt_list client comma
let shell_command = [ label "shell_command" . sto_to_eol ]
let entry = [ seq "line" . daemon_list . (except daemon_list)? . colon . client_list . (except client_list)? . (colon . shell_command)? . Util.eol ]
let lns = (Util.empty | Util.comment | entry)*