- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit3a0e385
committed
Log details for client certificate failures
Currently, debugging client certificate verification failures ismostly limited to looking at the TLS alert code on the client side.For simple deployments, sometimes it's enough to see "sslv3 alertcertificate revoked" and know exactly what needs to be fixed, but ifyou add any more complexity (multiple CA layers, misconfigured CAcertificates, etc.), trying to debug what happened based on the TLSalert alone can be an exercise in frustration.Luckily, the server has more information about exactly what failed inthe chain, and we already have the requisite callback implemented as astub. We fill that in, collect the data, and pass the constructederror message back to the main code via a static variable. This letsus add our error details directly to the final "could not accept SSLconnection" log message, as opposed to issuing intermediate LOGs.It ends up looking like LOG: connection received: host=localhost port=43112 LOG: could not accept SSL connection: certificate verify failed DETAIL: Client certificate verification failed at depth 1: unable to get local issuer certificate. Failed certificate data (unverified): subject "/CN=Test CA for PostgreSQL SSL regression test client certs", serial number 2315134995201656577, issuer "/CN=Test root CA for PostgreSQL SSL regression test suite".The length of the Subject and Issuer strings is limited to preventmalicious client certs from spamming the logs. In case the truncationmakes things ambiguous, the certificate's serial number is alsologged.Author: Jacob Champion <pchampion@vmware.com>Discussion:https://www.postgresql.org/message-id/flat/d13c4a5787c2a3f83705124f0391e0738c796751.camel@vmware.com1 parent507ba16 commit3a0e385
File tree
7 files changed
+210
-7
lines changed- src
- backend/libpq
- test/ssl
- conf
- ssl
- t
- SSL/Backend
7 files changed
+210
-7
lines changedLines changed: 109 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 |
| |
85 | 88 |
| |
86 | 89 |
| |
| |||
541 | 544 |
| |
542 | 545 |
| |
543 | 546 |
| |
| 547 | + | |
544 | 548 |
| |
545 | 549 |
| |
546 | 550 |
| |
| |||
549 | 553 |
| |
550 | 554 |
| |
551 | 555 |
| |
| 556 | + | |
552 | 557 |
| |
553 | 558 |
| |
554 | 559 |
| |
| |||
1076 | 1081 |
| |
1077 | 1082 |
| |
1078 | 1083 |
| |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
1079 | 1119 |
| |
1080 | 1120 |
| |
1081 | 1121 |
| |
1082 |
| - | |
1083 |
| - | |
1084 |
| - | |
| 1122 | + | |
| 1123 | + | |
1085 | 1124 |
| |
1086 | 1125 |
| |
1087 | 1126 |
| |
| |||
1090 | 1129 |
| |
1091 | 1130 |
| |
1092 | 1131 |
| |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
1093 | 1199 |
| |
1094 | 1200 |
| |
1095 | 1201 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + |
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + |
Lines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 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 | + |
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
36 |
| - | |
| 36 | + | |
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
|
Lines changed: 38 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
683 | 683 |
| |
684 | 684 |
| |
685 | 685 |
| |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
686 | 690 |
| |
687 | 691 |
| |
688 | 692 |
| |
| |||
730 | 734 |
| |
731 | 735 |
| |
732 | 736 |
| |
733 |
| - | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
734 | 766 |
| |
735 | 767 |
| |
736 | 768 |
| |
| |||
743 | 775 |
| |
744 | 776 |
| |
745 | 777 |
| |
746 |
| - | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
747 | 783 |
| |
748 | 784 |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
91 |
| - | |
| 91 | + | |
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
|
0 commit comments
Comments
(0)