/usr/share/augeas/lenses/dist/hosts_access.aug is in augeas-lenses 0.10.0-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | (*
Module: Hosts_Access
Parses /etc/hosts.{allow,deny}
Author: Raphael Pinson <raphink@gmail.com>
About: Reference
This lens tries to keep as close as possible to `man 5 hosts_access` where possible.
About: License
This file is licenced under the LGPLv2+, like the rest of Augeas.
About: Lens Usage
To be documented
About: Configuration files
This lens applies to /etc/hosts.{allow,deny}. See <filter>.
*)
module Hosts_Access =
autoload xfm
(************************************************************************
* Group: USEFUL PRIMITIVES
*************************************************************************)
(* View: colon *)
let colon = del /[ \t]*:[ \t]*/ ": "
(* View: comma *)
let comma = del /([ \t]|(\\\\\n))*,([ \t]|(\\\\\n))*/ ", "
(* View: sto_to_eol *)
let sto_to_eol = store /[^ \t\n:][^\n]*[^ \t\n]|[^ \t\n:]/
(* View: except
* 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 ]
(************************************************************************
* Group: ENTRY TYPES
*************************************************************************)
(* View: daemon *)
let daemon =
let host = [ label "host"
. Util.del_str "@"
. store Rx.word ] in
[ label "process"
. store Rx.word
. host? ]
(* View: daemon_list
A list of <daemon>s *)
let daemon_list = Build.opt_list daemon comma
(* View: client *)
let client =
let user = [ label "user"
. store Rx.word
. Util.del_str "@" ] in
[ label "client"
. user?
. store Rx.word ]
(* View: client_list
A list of <client>s *)
let client_list = Build.opt_list client comma
(* View: shell_command *)
let shell_command = [ label "shell_command"
. sto_to_eol ]
(* View: entry *)
let entry = [ seq "line"
. daemon_list
. (except daemon_list)?
. colon
. client_list
. (except client_list)?
. (colon . shell_command)?
. Util.eol ]
(************************************************************************
* Group: LENS AND FILTER
*************************************************************************)
(* View: lns *)
let lns = (Util.empty | Util.comment | entry)*
(* View: filter *)
let filter = incl "/etc/hosts.allow"
. incl "/etc/hosts.deny"
let xfm = transform lns filter
|