@@ -353,6 +353,14 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
353
353
f .nb [strconv .Itoa (nb .ID )] = & nb
354
354
355
355
for _ , nbcco := range nbco .Configs {
356
+ if nbcco .Protocol == "https" {
357
+ if ! strings .Contains (nbcco .SSLCert , "BEGIN CERTIFICATE" ) {
358
+ f .t .Fatal ("HTTPS port declared without calid ssl cert" , nbcco .SSLCert )
359
+ }
360
+ if ! strings .Contains (nbcco .SSLKey , "BEGIN RSA PRIVATE KEY" ) {
361
+ f .t .Fatal ("HTTPS port declared without calid ssl key" , nbcco .SSLKey )
362
+ }
363
+ }
356
364
nbc := linodego.NodeBalancerConfig {
357
365
ID : rand .Intn (9999 ),
358
366
Port : nbcco .Port ,
@@ -368,10 +376,10 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
368
376
CheckTimeout : nbcco .CheckTimeout ,
369
377
CipherSuite : nbcco .CipherSuite ,
370
378
NodeBalancerID : nb .ID ,
371
- SSLCommonName : "" ,
372
- SSLFingerprint : "" ,
373
- SSLCert : nbcco . SSLCert ,
374
- SSLKey : nbcco . SSLKey ,
379
+ SSLCommonName : "sslcommonname " ,
380
+ SSLFingerprint : "sslfingerprint " ,
381
+ SSLCert : "<REDACTED>" ,
382
+ SSLKey : "<REDACTED>" ,
375
383
}
376
384
f .nbc [strconv .Itoa (nbc .ID )] = & nbc
377
385
@@ -410,6 +418,14 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
410
418
if err != nil {
411
419
f .t .Fatal (err )
412
420
}
421
+ if nbcco .Protocol == "https" {
422
+ if ! strings .Contains (nbcco .SSLCert , "BEGIN CERTIFICATE" ) {
423
+ f .t .Fatal ("HTTPS port declared without calid ssl cert" , nbcco .SSLCert )
424
+ }
425
+ if ! strings .Contains (nbcco .SSLKey , "BEGIN RSA PRIVATE KEY" ) {
426
+ f .t .Fatal ("HTTPS port declared without calid ssl key" , nbcco .SSLKey )
427
+ }
428
+ }
413
429
nbcc := linodego.NodeBalancerConfig {
414
430
ID : nbcid ,
415
431
Port : nbcco .Port ,
@@ -425,11 +441,12 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
425
441
CheckTimeout : nbcco .CheckTimeout ,
426
442
CipherSuite : nbcco .CipherSuite ,
427
443
NodeBalancerID : nbid ,
428
- SSLCommonName : "" ,
429
- SSLFingerprint : "" ,
430
- SSLCert : nbcco . SSLCert ,
431
- SSLKey : nbcco . SSLKey ,
444
+ SSLCommonName : "sslcommonname " ,
445
+ SSLFingerprint : "sslfingerprint " ,
446
+ SSLCert : "<REDACTED>" ,
447
+ SSLKey : "<REDACTED>" ,
432
448
}
449
+
433
450
f .nbc [strconv .Itoa (nbcc .ID )] = & nbcc
434
451
for k , n := range f .nbn {
435
452
if n .ConfigID == nbcc .ID {
@@ -481,10 +498,10 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
481
498
CheckTimeout : nbcco .CheckTimeout ,
482
499
CipherSuite : nbcco .CipherSuite ,
483
500
NodeBalancerID : nbid ,
484
- SSLCommonName : "" ,
485
- SSLFingerprint : "" ,
486
- SSLCert : nbcco . SSLCert ,
487
- SSLKey : nbcco . SSLKey ,
501
+ SSLCommonName : "sslcomonname " ,
502
+ SSLFingerprint : "sslfingerprint " ,
503
+ SSLCert : "<REDACTED>" ,
504
+ SSLKey : "<REDACTED>" ,
488
505
}
489
506
f .nbc [strconv .Itoa (nbcc .ID )] = & nbcc
490
507
@@ -590,10 +607,10 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
590
607
CheckTimeout : nbcco .CheckTimeout ,
591
608
CipherSuite : nbcco .CipherSuite ,
592
609
NodeBalancerID : nbid ,
593
- SSLCommonName : "" ,
594
- SSLFingerprint : "" ,
595
- SSLCert : nbcco . SSLCert ,
596
- SSLKey : nbcco . SSLKey ,
610
+ SSLCommonName : "sslcommonname " ,
611
+ SSLFingerprint : "sslfingerprint " ,
612
+ SSLCert : "<REDACTED>" ,
613
+ SSLKey : "<REDACTED>" ,
597
614
}
598
615
f .nbc [strconv .Itoa (nbcc .ID )] = & nbcc
599
616
0 commit comments