Pg_Hba

Parses PostgreSQL’s pg_hba.conf

Author: Aurelien Bompard aure.nosp@m.lien@bompa.nosp@m.rd.org

Summary
Pg_HbaParses PostgreSQL’s pg_hba.conf
Referencehttp://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html
LicenseThis file is licensed under the LGPLv2+, like the rest of Augeas.
Configuration filesThis lens applies to pg_hba.conf.
Generic primitives
ipaddrCIDR or ip+netmask
Columns definitions
databaseTODO: support for quoted strings
userTODO: support for quoted strings
address
optionpart of method
methodcan contain an option
Records definitions
record_localwhen type is “local”, there is no “address” field
remtypesnon-local connection types
record_remote
recordA sequence of record_local or record_remote entries
filterThe pg_hba.conf conf file
lnsThe pg_hba.conf lens

Reference

The file format is described in PostgreSQL’s documentation

http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html

License

This file is licensed under the LGPLv2+, like the rest of Augeas.

Configuration files

This lens applies to pg_hba.conf.  See filter for exact locations.

Generic primitives

ipaddr

let ipaddr = /[0-9a-fA-F:\.]+(\/[0-9]+|[ \t]+[0-9\.]+)/

CIDR or ip+netmask

Columns definitions

database

let database = comma_sep_list "database"

TODO: support for quoted strings

user

let user = comma_sep_list "user"

TODO: support for quoted strings

address

let address = [ label "address" . store ipaddr ]

option

let option = [ label "option" . store word ]

part of method

method

let method = [ label "method" . store Rx.word . ( Sep.tab . option )? ]

can contain an option

Records definitions

record_local

let record_local = [ label "type" . store "local" ] . Sep.tab . database . Sep.tab . user . Sep.tab . method

when type is “local”, there is no “address” field

remtypes

let remtypes = "host" | "hostssl" | "hostnossl"

non-local connection types

record_remote

let record_remote = [ label "type" . store remtypes ] . Sep.tab . database . Sep.tab . user . Sep.tab . address . Sep.tab . method

record

let record = [ seq "entries" . (record_local | record_remote) . eol ]

A sequence of record_local or record_remote entries

filter

The pg_hba.conf conf file

lns

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

The pg_hba.conf lens

let ipaddr = /[0-9a-fA-F:\.]+(\/[0-9]+|[ \t]+[0-9\.]+)/
CIDR or ip+netmask
let database = comma_sep_list "database"
TODO: support for quoted strings
let user = comma_sep_list "user"
TODO: support for quoted strings
let address = [ label "address" . store ipaddr ]
let option = [ label "option" . store word ]
part of method
let method = [ label "method" . store Rx.word . ( Sep.tab . option )? ]
can contain an option
let record_local = [ label "type" . store "local" ] . Sep.tab . database . Sep.tab . user . Sep.tab . method
when type is “local”, there is no “address” field
let remtypes = "host" | "hostssl" | "hostnossl"
non-local connection types
let record_remote = [ label "type" . store remtypes ] . Sep.tab . database . Sep.tab . user . Sep.tab . address . Sep.tab . method
let record = [ seq "entries" . (record_local | record_remote) . eol ]
A sequence of record_local or record_remote entries
let lns = (record | Util.comment Util.empty) *
The pg_hba.conf lens
The pg_hba.conf conf file
Close