Parses PostgreSQL’s pg_hba.conf
Author: Aurelien Bompard aure@bompa rd.org About: Reference The file format is described in PostgreSQL’s documentation: lienhttp://www.postgresql.org
Pg_Hba | Parses PostgreSQL’s pg_hba.conf |
License | This file is licensed under the LGPL v2+, like the rest of Augeas. |
Configuration files | This lens applies to pg_hba.conf. |
Generic primitives | |
ipaddr | CIDR or ip+netmask |
hostname | Hostname, FQDN or part of an FQDN possibly starting with a dot. |
Columns definitions | |
ipaddr_or_hostname | |
database | TODO: support for quoted strings |
user | TODO: support for quoted strings |
address | |
option | part of method |
method | can contain an option |
Records definitions | |
record_local | when type is “local”, there is no “address” field |
remtypes | non-local connection types |
record_remote | |
record | A sequence of record_local or record_remote entries |
filter | The pg_hba.conf conf file |
lns | The pg_hba.conf lens |
This lens applies to pg_hba.conf. See filter for exact locations.
let option = let value_start = label "value" . Sep.equal in [ label "option" . store Rx.word . (Quote.quote_spaces value_start)? ]
part of method
let method = [ label "method" . store /[A-Za-z][A-Za-z0-9]+/ . ( Sep.tab . option )* ]
can contain an option
let record = [ seq "entries" . (record_local | record_remote) . eol ]
A sequence of record_local or record_remote entries
CIDR or ip+netmask
let ipaddr = /[0-9a-fA-F:.]+(\/[0-9]+|[ \t]+[0-9.]+)/
Hostname, FQDN or part of an FQDN possibly starting with a dot.
let hostname = /\.?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*/
let ipaddr_or_hostname = ipaddr | hostname
TODO: support for quoted strings
let database = comma_sep_list "database"
TODO: support for quoted strings
let user = comma_sep_list "user"
let address = [ label "address" . store ipaddr_or_hostname ]
part of method
let option = let value_start = label "value" . Sep.equal in [ label "option" . store Rx.word . (Quote.quote_spaces value_start)? ]
can contain an option
let method = [ label "method" . store /[A-Za-z][A-Za-z0-9]+/ . ( Sep.tab . option )* ]
when type is “local”, there is no “address” field
let record_local = [ label "type" . store "local" ] . Sep.tab . database . Sep.tab . user . Sep.tab . method
non-local connection types
let remtypes = "host" | "hostssl" | "hostnossl"
let record_remote = [ label "type" . store remtypes ] . Sep.tab . database . Sep.tab . user . Sep.tab . address . Sep.tab . method
A sequence of record_local or record_remote entries
let record = [ seq "entries" . (record_local | record_remote) . eol ]
The pg_hba.conf lens
let lns = ( record | Util.comment | Util.empty ) *