@@ -353,6 +353,14 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
353353 f .nb [strconv .Itoa (nb .ID )] = & nb
354354
355355 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+ }
356364 nbc := linodego.NodeBalancerConfig {
357365 ID : rand .Intn (9999 ),
358366 Port : nbcco .Port ,
@@ -368,10 +376,10 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
368376 CheckTimeout : nbcco .CheckTimeout ,
369377 CipherSuite : nbcco .CipherSuite ,
370378 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>" ,
375383 }
376384 f .nbc [strconv .Itoa (nbc .ID )] = & nbc
377385
@@ -410,6 +418,14 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
410418 if err != nil {
411419 f .t .Fatal (err )
412420 }
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+ }
413429 nbcc := linodego.NodeBalancerConfig {
414430 ID : nbcid ,
415431 Port : nbcco .Port ,
@@ -425,11 +441,12 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
425441 CheckTimeout : nbcco .CheckTimeout ,
426442 CipherSuite : nbcco .CipherSuite ,
427443 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>" ,
432448 }
449+
433450 f .nbc [strconv .Itoa (nbcc .ID )] = & nbcc
434451 for k , n := range f .nbn {
435452 if n .ConfigID == nbcc .ID {
@@ -481,10 +498,10 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
481498 CheckTimeout : nbcco .CheckTimeout ,
482499 CipherSuite : nbcco .CipherSuite ,
483500 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>" ,
488505 }
489506 f .nbc [strconv .Itoa (nbcc .ID )] = & nbcc
490507
@@ -590,10 +607,10 @@ func (f *fakeAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
590607 CheckTimeout : nbcco .CheckTimeout ,
591608 CipherSuite : nbcco .CipherSuite ,
592609 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>" ,
597614 }
598615 f .nbc [strconv .Itoa (nbcc .ID )] = & nbcc
599616
0 commit comments