Commit 9ad0f6d
committed
feat(spanner): Support dynamic TLS certificate and key rotation for Spanner Omni
Add support for zero-downtime dynamic reloading of client certificates/keys (mTLS)
and server root CA certificates in Spanner Omni without requiring application or connection pool restarts.
Changes:
- DynamicKeyManager (com.google.cloud.spanner.omni): An X509ExtendedKeyManager that
monitors certificate/key file modification times and lengths on disk. Uses non-blocking
tryLock() and atomic versioned alias mapping to reload rotated client certificates and
RSA/EC private keys during active TLS handshakes without blocking Netty event loop threads.
- DynamicTrustManager (com.google.cloud.spanner.omni): An X509ExtendedTrustManager that
dynamically reloads rotated server root CA certificates into an in-memory keystore/trust
manager upon file changes.
- SpannerOptions & Connection API:
- Added Builder.setCaCertificate(String) and getCaCertificate() across SpannerOptions,
ConnectionProperties, ConnectionOptions, and SpannerPool.
- Updated Builder.useClientCert(String, String) to use dynamic key management.
- Preserved raw certificate paths in SpannerOptions and built transient Netty SslContext
in prepareBuilder to prevent transport leaks.
- SpannerOmniHelper: Added support for spanner.ca_cert_path and updated mTLS setup detection.
- Tests: Added comprehensive unit tests covering dynamic certificate/key rotation, CA rotation,
multi-CA bundles, fallback on corruption/mismatch, throttling, and options configuration.
Fixes b/5627552311 parent 48e5ce5 commit 9ad0f6d
12 files changed
Lines changed: 1534 additions & 16 deletions
File tree
- java-spanner/google-cloud-spanner/src
- main/java/com/google/cloud/spanner
- connection
- omni
- testing
- test/java/com/google/cloud/spanner
- connection
- omni
Lines changed: 87 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
356 | 359 | | |
357 | 360 | | |
358 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
359 | 365 | | |
360 | 366 | | |
361 | 367 | | |
| |||
941 | 947 | | |
942 | 948 | | |
943 | 949 | | |
944 | | - | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
945 | 958 | | |
946 | 959 | | |
947 | | - | |
948 | | - | |
| 960 | + | |
| 961 | + | |
949 | 962 | | |
950 | 963 | | |
951 | | - | |
| 964 | + | |
952 | 965 | | |
953 | 966 | | |
954 | 967 | | |
| |||
1292 | 1305 | | |
1293 | 1306 | | |
1294 | 1307 | | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
1295 | 1333 | | |
1296 | 1334 | | |
1297 | 1335 | | |
| |||
1314 | 1352 | | |
1315 | 1353 | | |
1316 | 1354 | | |
1317 | | - | |
| 1355 | + | |
1318 | 1356 | | |
1319 | 1357 | | |
1320 | 1358 | | |
| |||
1399 | 1437 | | |
1400 | 1438 | | |
1401 | 1439 | | |
1402 | | - | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
1403 | 1444 | | |
1404 | 1445 | | |
1405 | 1446 | | |
| |||
1517 | 1558 | | |
1518 | 1559 | | |
1519 | 1560 | | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
1520 | 1564 | | |
1521 | 1565 | | |
1522 | 1566 | | |
| |||
2240 | 2284 | | |
2241 | 2285 | | |
2242 | 2286 | | |
2243 | | - | |
| 2287 | + | |
| 2288 | + | |
2244 | 2289 | | |
2245 | 2290 | | |
2246 | 2291 | | |
2247 | | - | |
2248 | 2292 | | |
2249 | 2293 | | |
2250 | | - | |
2251 | | - | |
2252 | | - | |
2253 | | - | |
2254 | | - | |
2255 | | - | |
2256 | | - | |
2257 | | - | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
2258 | 2314 | | |
2259 | 2315 | | |
2260 | 2316 | | |
| |||
3175 | 3231 | | |
3176 | 3232 | | |
3177 | 3233 | | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
3178 | 3249 | | |
3179 | 3250 | | |
3180 | 3251 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| 172 | + | |
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
| |||
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
245 | 250 | | |
246 | 251 | | |
247 | 252 | | |
| |||
676 | 681 | | |
677 | 682 | | |
678 | 683 | | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
679 | 720 | | |
680 | 721 | | |
681 | 722 | | |
| |||
1300 | 1341 | | |
1301 | 1342 | | |
1302 | 1343 | | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
1303 | 1348 | | |
1304 | 1349 | | |
1305 | 1350 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
329 | 331 | | |
330 | 332 | | |
331 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
332 | 341 | | |
333 | 342 | | |
334 | 343 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
| |||
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
| 225 | + | |
224 | 226 | | |
225 | 227 | | |
226 | 228 | | |
| |||
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
| 266 | + | |
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
| |||
296 | 299 | | |
297 | 300 | | |
298 | 301 | | |
| 302 | + | |
299 | 303 | | |
300 | 304 | | |
301 | 305 | | |
| |||
540 | 544 | | |
541 | 545 | | |
542 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
543 | 550 | | |
544 | 551 | | |
545 | 552 | | |
| |||
0 commit comments