Sfoglia il codice sorgente

load intermediate cert from certfile

This is required for public certificates as many servers will be unable to verify the certificate if a partial chain is presented.
Changing `SSL_CTX_use_certificate_file` to `SSL_CTX_use_certificate_chain_file` fixes this issue since now the certificate and intermediate can be loaded from the same file.
This reflects behaviour of other software including popular webservers.
Furthermore the use of `SSL_CTX_use_certificate_chain_file` is suggested by the corresponding OpenSSL man page.

Signed-off-by: benaryorg <binary@benary.org>
benaryorg 4 anni fa
parent
commit
28e360a1db
3 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 2 1
      THANKS
  2. 1 1
      src/check_nrpe.c
  3. 1 1
      src/nrpe.c

+ 2 - 1
THANKS

@@ -5,6 +5,7 @@ Andrew Ryder
 Andrew Widdersheim
 Andrew Widdersheim
 Bartosz Woronicz
 Bartosz Woronicz
 Bas Couwenberg
 Bas Couwenberg
+benaryorg
 Bill Mitchell
 Bill Mitchell
 Bjoern Beutel
 Bjoern Beutel
 Brian Seklecki
 Brian Seklecki
@@ -51,4 +52,4 @@ Subhendu Ghosh
 Sven Nierlein
 Sven Nierlein
 Thierry Bertaud
 Thierry Bertaud
 Ton Voon
 Ton Voon
-Vadim Antipov
+Vadim Antipov

+ 1 - 1
src/check_nrpe.c

@@ -970,7 +970,7 @@ void setup_ssl()
 		SSL_CTX_set_options(ctx, ssl_opts);
 		SSL_CTX_set_options(ctx, ssl_opts);
 
 
 		if (sslprm.cert_file != NULL && sslprm.privatekey_file != NULL) {
 		if (sslprm.cert_file != NULL && sslprm.privatekey_file != NULL) {
-			if (!SSL_CTX_use_certificate_file(ctx, sslprm.cert_file, SSL_FILETYPE_PEM)) {
+			if (!SSL_CTX_use_certificate_chain_file(ctx, sslprm.cert_file)) {
 				printf("Error: could not use certificate file '%s'.\n", sslprm.cert_file);
 				printf("Error: could not use certificate file '%s'.\n", sslprm.cert_file);
 				while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
 				while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
 					printf("Error: could not use certificate file '%s': %s\n", sslprm.cert_file, ERR_reason_error_string(x));
 					printf("Error: could not use certificate file '%s': %s\n", sslprm.cert_file, ERR_reason_error_string(x));

+ 1 - 1
src/nrpe.c

@@ -421,7 +421,7 @@ void init_ssl(void)
 	SSL_CTX_set_options(ctx, ssl_opts);
 	SSL_CTX_set_options(ctx, ssl_opts);
 
 
 	if (sslprm.cert_file != NULL) {
 	if (sslprm.cert_file != NULL) {
-		if (!SSL_CTX_use_certificate_file(ctx, sslprm.cert_file, SSL_FILETYPE_PEM)) {
+		if (!SSL_CTX_use_certificate_chain_file(ctx, sslprm.cert_file)) {
 			SSL_CTX_free(ctx);
 			SSL_CTX_free(ctx);
 			while ((x = ERR_get_error()) != 0) {
 			while ((x = ERR_get_error()) != 0) {
 				ERR_error_string(x, errstr);
 				ERR_error_string(x, errstr);