forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3a465cc
committed
libpq: Add support for require_auth to control authorized auth methods
The new connection parameter require_auth allows a libpq client todefine a list of comma-separated acceptable authentication types for usewith the server. There is no negotiation: if the server does notpresent one of the allowed authentication requests, the connectionattempt done by the client fails.The following keywords can be defined in the list:- password, for AUTH_REQ_PASSWORD.- md5, for AUTH_REQ_MD5.- gss, for AUTH_REQ_GSS[_CONT].- sspi, for AUTH_REQ_SSPI and AUTH_REQ_GSS_CONT.- scram-sha-256, for AUTH_REQ_SASL[_CONT|_FIN].- creds, for AUTH_REQ_SCM_CREDS (perhaps this should be removed entirelynow).- none, to control unauthenticated connections.All the methods that can be defined in the list can be negated, like"!password", in which case the server must NOT use the listedauthentication type. The special method "none" allows/disallows the useof unauthenticated connections (but it does not govern transport-levelauthentication via TLS or GSSAPI).Internally, the patch logic is tied to check_expected_areq(), that wasused for channel_binding, ensuring that an incoming request iscompatible with conn->require_auth. It also introduces a new flag,conn->client_finished_auth, which is set by various authenticationroutines when the client side of the handshake is finished. Thissignals to check_expected_areq() that an AUTH_REQ_OK from the server isexpected, and allows the client to complain if the server bypassesauthentication entirely, with for example the reception of a too-earlyAUTH_REQ_OK message.Regression tests are added in authentication TAP tests for all thekeywords supported (except "creds", because it is around only forcompatibility reasons). A new TAP script has been added for SSPI, asthere was no script dedicated to it yet. It relies on SSPI being thedefault authentication method on Windows, as set by pg_regress.Author: Jacob ChampionReviewed-by: Peter Eisentraut, David G. Johnston, Michael PaquierDiscussion:https://postgr.es/m/9e5a8ccddb8355ea9fa4b75a1e3a9edc88a70cd3.camel@vmware.com1 parent7274009 commit3a465cc
File tree
12 files changed
+779
-0
lines changed- doc/src/sgml
- src
- include/libpq
- interfaces/libpq
- test
- authentication
- t
- kerberos/t
- ldap/t
- ssl/t
12 files changed
+779
-0
lines changedLines changed: 115 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1220 | 1220 |
| |
1221 | 1221 |
| |
1222 | 1222 |
| |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
1223 | 1328 |
| |
1224 | 1329 |
| |
1225 | 1330 |
| |
| |||
7774 | 7879 |
| |
7775 | 7880 |
| |
7776 | 7881 |
| |
| 7882 | + | |
| 7883 | + | |
| 7884 | + | |
| 7885 | + | |
| 7886 | + | |
| 7887 | + | |
| 7888 | + | |
| 7889 | + | |
| 7890 | + | |
| 7891 | + | |
7777 | 7892 |
| |
7778 | 7893 |
| |
7779 | 7894 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
123 | 123 |
| |
124 | 124 |
| |
125 | 125 |
| |
| 126 | + | |
126 | 127 |
| |
127 | 128 |
| |
128 | 129 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
282 | 282 |
| |
283 | 283 |
| |
284 | 284 |
| |
| 285 | + | |
285 | 286 |
| |
286 | 287 |
| |
287 | 288 |
| |
|
Lines changed: 139 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
136 | 136 |
| |
137 | 137 |
| |
138 | 138 |
| |
| 139 | + | |
| 140 | + | |
139 | 141 |
| |
| 142 | + | |
140 | 143 |
| |
141 | 144 |
| |
142 | 145 |
| |
| |||
321 | 324 |
| |
322 | 325 |
| |
323 | 326 |
| |
| 327 | + | |
| 328 | + | |
| 329 | + | |
324 | 330 |
| |
325 | 331 |
| |
326 | 332 |
| |
| |||
735 | 741 |
| |
736 | 742 |
| |
737 | 743 |
| |
| 744 | + | |
| 745 | + | |
738 | 746 |
| |
739 | 747 |
| |
740 | 748 |
| |
| |||
805 | 813 |
| |
806 | 814 |
| |
807 | 815 |
| |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
808 | 851 |
| |
809 | 852 |
| |
810 | 853 |
| |
| |||
814 | 857 |
| |
815 | 858 |
| |
816 | 859 |
| |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
817 | 953 |
| |
818 | 954 |
| |
819 | 955 |
| |
| |||
1008 | 1144 |
| |
1009 | 1145 |
| |
1010 | 1146 |
| |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
1011 | 1150 |
| |
1012 | 1151 |
| |
1013 | 1152 |
| |
|
0 commit comments
Comments
(0)