是否有以编程方式操作 pg_hba.conf 的工具(如果不是最接近的)?

Kar*_*ter 1 authentication postgresql

我正在寻找高于程序化文件操作、命令或 python 库级别的任何内容。似乎没有编辑文件的替代方法(假设http://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf.html会提到替代方法)。

Cri*_*itu 6

尝试奥吉斯。它提供Python 绑定和命令行界面 - augtool

[dba@pgsql ~]$ augtool
augtool> defvar pghba /files/var/lib/pgsql/data/pg_hba.conf
augtool> ####################################
augtool> ls $pghba
#comment[1] = this is a comment
1/ = (none)
2/ = (none)
#comment[2] = this another comment
3/ = (none)
augtool> ####################################
augtool> ls $pghba/1
type = local
database = all
user = all
method = trust
augtool> ####################################
augtool> insert 01 after $pghba/2
augtool> set $pghba/01/type host
augtool> set $pghba/01/database db1
augtool> set $pghba/01/user user1
augtool> set $pghba/01/address 127.0.0.1
augtool> set $pghba/01/method md5
augtool> ####################################
augtool> save
Saved 1 file(s)
Run Code Online (Sandbox Code Playgroud)

(评论以 开头#