forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9afffcb
committed
Add some information about authenticated identity via log_connections
The "authenticated identity" is the string used by an authenticationmethod to identify a particular user. In many common cases, this is thesame as the PostgreSQL username, but for some third-party authenticationmethods, the identifier in use may be shortened or otherwise translated(e.g. through pg_ident user mappings) before the server stores it.To help administrators see who has actually interacted with the system,this commit adds the capability to store the original identity whenauthentication succeeds within the backend's Port, and generates a logentry when log_connections is enabled. The log entries generated looksomething like this (where a local user named "foouser" is connecting tothe database as the database user called "admin"): LOG: connection received: host=[local] LOG: connection authenticated: identity="foouser" method=peer (/data/pg_hba.conf:88) LOG: connection authorized: user=admin database=postgres application_name=psqlPort->authn_id is set according to the authentication method: bsd: the PostgreSQL username (aka the local username) cert: the client's Subject DN gss: the user principal ident: the remote username ldap: the final bind DN pam: the PostgreSQL username (aka PAM username) password (and all pw-challenge methods): the PostgreSQL username peer: the peer's pw_name radius: the PostgreSQL username (aka the RADIUS username) sspi: either the down-level (SAM-compatible) logon name, if compat_realm=1, or the User Principal Name if compat_realm=0The trust auth method does not set an authenticated identity. Neitherdoes clientcert=verify-full.Port->authn_id could be used for other purposes, like a superuser-onlyextra column in pg_stat_activity, but this is left as future work.PostgresNode::connect_{ok,fails}() have been modified to let tests checkthe backend log files for required or prohibited patterns, using thenew log_like and log_unlike parameters. This uses a method based on atruncation of the existing server log file, like issues_sql_like().Tests are added to the ldap, kerberos, authentication and SSL testsuites.Author: Jacob ChampionReviewed-by: Stephen Frost, Magnus Hagander, Tom Lane, Michael PaquierDiscussion:https://postgr.es/m/c55788dd1773c521c862e8e0dddb367df51222be.camel@vmware.com1 parent8ee9b66 commit9afffcb
File tree
11 files changed
+416
-74
lines changed- doc/src/sgml
- src
- backend/libpq
- include/libpq
- test
- authentication/t
- kerberos/t
- ldap/t
- perl
- ssl/t
11 files changed
+416
-74
lines changedLines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6755 | 6755 |
| |
6756 | 6756 |
| |
6757 | 6757 |
| |
6758 |
| - | |
| 6758 | + | |
| 6759 | + | |
6759 | 6760 |
| |
6760 | 6761 |
| |
6761 | 6762 |
| |
|
Lines changed: 129 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
| 37 | + | |
37 | 38 |
| |
38 | 39 |
| |
| 40 | + | |
39 | 41 |
| |
40 | 42 |
| |
41 | 43 |
| |
| |||
47 | 49 |
| |
48 | 50 |
| |
49 | 51 |
| |
| 52 | + | |
50 | 53 |
| |
51 | 54 |
| |
52 | 55 |
| |
| |||
337 | 340 |
| |
338 | 341 |
| |
339 | 342 |
| |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
340 | 388 |
| |
341 | 389 |
| |
342 | 390 |
| |
| |||
757 | 805 |
| |
758 | 806 |
| |
759 | 807 |
| |
| 808 | + | |
| 809 | + | |
| 810 | + | |
760 | 811 |
| |
761 | 812 |
| |
762 | 813 |
| |
| |||
816 | 867 |
| |
817 | 868 |
| |
818 | 869 |
| |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
819 | 874 |
| |
820 | 875 |
| |
821 | 876 |
| |
| |||
1174 | 1229 |
| |
1175 | 1230 |
| |
1176 | 1231 |
| |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
1177 | 1236 |
| |
1178 | 1237 |
| |
| 1238 | + | |
1179 | 1239 |
| |
1180 | 1240 |
| |
1181 | 1241 |
| |
| |||
1285 | 1345 |
| |
1286 | 1346 |
| |
1287 | 1347 |
| |
| 1348 | + | |
1288 | 1349 |
| |
1289 | 1350 |
| |
1290 | 1351 |
| |
| |||
1514 | 1575 |
| |
1515 | 1576 |
| |
1516 | 1577 |
| |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
1517 | 1598 |
| |
1518 | 1599 |
| |
1519 | 1600 |
| |
| |||
1901 | 1982 |
| |
1902 | 1983 |
| |
1903 | 1984 |
| |
1904 |
| - | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
1905 | 1992 |
| |
| 1993 | + | |
1906 | 1994 |
| |
1907 | 1995 |
| |
1908 | 1996 |
| |
| |||
1926 | 2014 |
| |
1927 | 2015 |
| |
1928 | 2016 |
| |
1929 |
| - | |
1930 | 2017 |
| |
1931 | 2018 |
| |
1932 | 2019 |
| |
| |||
1958 | 2045 |
| |
1959 | 2046 |
| |
1960 | 2047 |
| |
1961 |
| - | |
1962 |
| - | |
1963 |
| - | |
1964 |
| - | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
1965 | 2054 |
| |
1966 |
| - | |
| 2055 | + | |
1967 | 2056 |
| |
1968 | 2057 |
| |
1969 | 2058 |
| |
| |||
2220 | 2309 |
| |
2221 | 2310 |
| |
2222 | 2311 |
| |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
2223 | 2315 |
| |
2224 | 2316 |
| |
2225 | 2317 |
| |
| |||
2255 | 2347 |
| |
2256 | 2348 |
| |
2257 | 2349 |
| |
| 2350 | + | |
2258 | 2351 |
| |
2259 | 2352 |
| |
2260 | 2353 |
| |
| |||
2761 | 2854 |
| |
2762 | 2855 |
| |
2763 | 2856 |
| |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
2764 | 2860 |
| |
2765 | 2861 |
| |
2766 | 2862 |
| |
| |||
2824 | 2920 |
| |
2825 | 2921 |
| |
2826 | 2922 |
| |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
2827 | 2947 |
| |
2828 | 2948 |
| |
2829 | 2949 |
| |
| |||
2995 | 3115 |
| |
2996 | 3116 |
| |
2997 | 3117 |
| |
| 3118 | + | |
| 3119 | + | |
2998 | 3120 |
| |
2999 | 3121 |
| |
3000 | 3122 |
| |
|
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3141 | 3141 |
| |
3142 | 3142 |
| |
3143 | 3143 |
| |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
| 140 | + | |
140 | 141 |
| |
141 | 142 |
| |
142 | 143 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
159 | 159 |
| |
160 | 160 |
| |
161 | 161 |
| |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
162 | 175 |
| |
163 | 176 |
| |
164 | 177 |
| |
|
0 commit comments
Comments
(0)