Hosts_Access

Parses /etc/hosts.{allow,deny}

Author: Raphael Pinson rap.nosp@m.hink@gmai.nosp@m.l.com

Summary
Hosts_AccessParses /etc/hosts.{allow,deny}
ReferenceThis lens tries to keep as close as possible to `man 5 hosts_access` where possible.
LicenseThis file is licenced under the LGPLv2+, like the rest of Augeas.
Lens UsageTo be documented
Configuration filesThis lens applies to /etc/hosts.{allow,deny}.
USEFUL PRIMITIVES
colon
comma
sto_to_eol
exceptThe except operator makes it possible to write very compact rules.
ENTRY TYPES
daemon
daemon_listA list of daemons
client
client_listA list of clients
shell_command
entry
LENS AND FILTER
lns
filter

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}.  See filter.

USEFUL PRIMITIVES

colon

let colon = del /[ \t]*:[ \t]*/ ": "

comma

let comma = del /([ \t]|(\\\\\n))*,([ \t]|(\\\\\n))*/ ", "

sto_to_eol

let sto_to_eol = store /[^ \t\n:][^\n]*[^ \t\n]|[^ \t\n:]/

except

let except (lns:lens) = [ label "except" . Sep.space . del /except/i "EXCEPT" . Sep.space . lns ]

The except operator makes it possible to write very compact rules.

ENTRY TYPES

daemon

let daemon = let host = [ label "host" . Util.del_str "@" . store Rx.word ] in [ label "process" . store Rx.word . host? ]

daemon_list

let daemon_list = Build.opt_list daemon comma

A list of daemons

client

let client = let user = [ label "user" . store Rx.word . Util.del_str "@" ] in [ label "client" . user? . store Rx.word ]

client_list

let client_list = Build.opt_list client comma

A list of clients

shell_command

let shell_command = [ label "shell_command" . sto_to_eol ]

entry

let entry = [ seq "line" . daemon_list . (except daemon_list)? . colon . client_list . (except client_list)? . (colon . shell_command)? . Util.eol ]

LENS AND FILTER

lns

let lns = (Util.empty | Util.comment | entry)*

filter

let colon = del /[ \t]*:[ \t]*/ ": "
let comma = del /([ \t]|(\\\\\n))*,([ \t]|(\\\\\n))*/ ", "
let sto_to_eol = store /[^ \t\n:][^\n]*[^ \t\n]|[^ \t\n:]/
let except (lns:lens) = [ label "except" . Sep.space . del /except/i "EXCEPT" . Sep.space . lns ]
The except operator makes it possible to write very compact rules.
let daemon = let host = [ label "host" . Util.del_str "@" . store Rx.word ] in [ label "process" . store Rx.word . host? ]
let daemon_list = Build.opt_list daemon comma
A list of daemons
let client = let user = [ label "user" . store Rx.word . Util.del_str "@" ] in [ label "client" . user? . store Rx.word ]
let client_list = Build.opt_list client comma
A list of clients
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)*
Close