/usr/share/augeas/lenses/dist/tests/test_pg_hba.aug is in augeas-lenses 1.4.0-0ubuntu1.1.
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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | module Test_pg_hba =
(* Main test *)
let conf ="# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all ident sameuser
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# Remote connections by hostname:
host all all foo.example.com md5
# Remote connections by suffix of hostname/fqdn:
host all all .example.com md5
# IPv6 local connections:
host all all ::1/128 md5
"
test Pg_Hba.lns get conf =
{ "#comment" = "TYPE DATABASE USER CIDR-ADDRESS METHOD" }
{}
{ "1"
{ "type" = "local" }
{ "database" = "all" }
{ "user" = "all" }
{ "method" = "ident"
{ "option" = "sameuser" } }
}
{ "#comment" = "IPv4 local connections:" }
{ "2"
{ "type" = "host" }
{ "database" = "all" }
{ "user" = "all" }
{ "address" = "127.0.0.1/32" }
{ "method" = "md5" }
}
{ "#comment" = "Remote connections by hostname:" }
{ "3"
{ "type" = "host" }
{ "database" = "all" }
{ "user" = "all" }
{ "address" = "foo.example.com" }
{ "method" = "md5" }
}
{ "#comment" = "Remote connections by suffix of hostname/fqdn:" }
{ "4"
{ "type" = "host" }
{ "database" = "all" }
{ "user" = "all" }
{ "address" = ".example.com" }
{ "method" = "md5" }
}
{ "#comment" = "IPv6 local connections:" }
{ "5"
{ "type" = "host" }
{ "database" = "all" }
{ "user" = "all" }
{ "address" = "::1/128" }
{ "method" = "md5" }
}
(* ------------------------------------------------------------- *)
(* Simple local test *)
test Pg_Hba.lns get "local all all trust\n" =
{ "1"
{ "type" = "local" }
{ "database" = "all" }
{ "user" = "all" }
{ "method" = "trust" }
}
(* Remote test with comma-sparated database names *)
test Pg_Hba.lns get "hostssl db1,db2,db3 +pgusers 127.0.0.1/32 trust\n" =
{ "1"
{ "type" = "hostssl" }
{ "database" = "db1" }
{ "database" = "db2" }
{ "database" = "db3" }
{ "user" = "+pgusers" }
{ "address" = "127.0.0.1/32" }
{ "method" = "trust" }
}
(* Test with comma-sparated user names *)
test Pg_Hba.lns get "hostnossl sameuser u1,u2,u3 127.0.0.1/32 trust\n" =
{ "1"
{ "type" = "hostnossl" }
{ "database" = "sameuser" }
{ "user" = "u1" }
{ "user" = "u2" }
{ "user" = "u3" }
{ "address" = "127.0.0.1/32" }
{ "method" = "trust" }
}
(* Test with quoted database and user names *)
test Pg_Hba.lns get "host \"sameuser\" \"all\" 127.0.0.1/32 trust\n" =
{ "1"
{ "type" = "host" }
{ "database" = "\"sameuser\"" }
{ "user" = "\"all\"" }
{ "address" = "127.0.0.1/32" }
{ "method" = "trust" }
}
(* Test with IP + netmask address format *)
test Pg_Hba.lns get "host all all 192.168.1.1 255.255.0.0 trust\n" =
{ "1"
{ "type" = "host" }
{ "database" = "all" }
{ "user" = "all" }
{ "address" = "192.168.1.1 255.255.0.0" }
{ "method" = "trust" }
}
(* Test with fqdn as address *)
test Pg_Hba.lns get "host all all foo.example.com md5\n" =
{ "1"
{ "type" = "host" }
{ "database" = "all" }
{ "user" = "all" }
{ "address" = "foo.example.com" }
{ "method" = "md5" }
}
(* Test with fqdn suffix as address *)
test Pg_Hba.lns get "host all all .example.com md5\n" =
{ "1"
{ "type" = "host" }
{ "database" = "all" }
{ "user" = "all" }
{ "address" = ".example.com" }
{ "method" = "md5" }
}
(* Local types may not have and address *)
test Pg_Hba.lns get "local all all 127.0.0.1/32 trust\n" = *
(* Remote types must have an address *)
test Pg_Hba.lns get "host all all trust\n" = *
(* The space between the IP and the netmask must not be considered as a
column separator ("method" is missing here) *)
test Pg_Hba.lns get "host all all 192.168.1.1 255.255.0.0\n" = *
(* Ticket #313: support authentication method options *)
test Pg_Hba.lns get "host all all .dev.example.com gss include_realm=0 krb_realm=EXAMPLE.COM map=somemap
host all all .dev.example.com ldap ldapserver=auth.example.com ldaptls=1 ldapprefix=\"uid=\" ldapsuffix=\",ou=people,dc=example,dc=com\"\n" =
{ "1"
{ "type" = "host" }
{ "database" = "all" }
{ "user" = "all" }
{ "address" = ".dev.example.com" }
{ "method" = "gss"
{ "option" = "include_realm"
{ "value" = "0" } }
{ "option" = "krb_realm"
{ "value" = "EXAMPLE.COM" } }
{ "option" = "map"
{ "value" = "somemap" } } } }
{ "2"
{ "type" = "host" }
{ "database" = "all" }
{ "user" = "all" }
{ "address" = ".dev.example.com" }
{ "method" = "ldap"
{ "option" = "ldapserver"
{ "value" = "auth.example.com" } }
{ "option" = "ldaptls"
{ "value" = "1" } }
{ "option" = "ldapprefix"
{ "value" = "uid=" } }
{ "option" = "ldapsuffix"
{ "value" = ",ou=people,dc=example,dc=com" } } } }
(* Unsupported yet *)
(* test Pg_Hba.lns get "host \"db with spaces\" \"user with spaces\" 127.0.0.1/32 trust\n" =? *)
(* test Pg_Hba.lns get "host \"db,with,commas\" \"user,with,commas\" 127.0.0.1/32 trust\n" =? *)
|