Ethan Galstad 23 лет назад
Родитель
Сommit
02c9353c00
2 измененных файлов с 22 добавлено и 6 удалено
  1. 6 3
      src/check_nrpe.c
  2. 16 3
      src/nrpe.c

+ 6 - 3
src/check_nrpe.c

@@ -4,7 +4,7 @@
  * Copyright (c) 1999-2003 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 03-05-2003
+ * Last Modified: 03-06-2003
  *
  * Command line: CHECK_NRPE -H <host_address> [-p port] [-c command] [-to to_sec]
  *
@@ -139,10 +139,12 @@ int main(int argc, char **argv){
 	/* do SSL handshake */
 	if(result==STATE_OK && use_ssl==TRUE){
 		if((ssl=SSL_new(ctx))!=NULL){
-			SSL_CTX_set_cipher_list(ctx,"ALL");
+			/*SSL_CTX_set_cipher_list(ctx,"ALL");*/
+			SSL_CTX_set_cipher_list(ctx,"DH");
 			SSL_set_fd(ssl,sd);
 			if((rc=SSL_connect(ssl))!=1){
 				printf("CHECK_NRPE: Error - Could not complete SSL handshake.\n");
+#ifdef DEBUG
 				printf("SSL_connect=%d\n",rc);
 				/*
 				rc=SSL_get_error(ssl,rc);
@@ -151,11 +153,12 @@ int main(int argc, char **argv){
 				printf("%s\n",ERR_error_string(rc,NULL));
 				*/
 				ERR_print_errors_fp(stdout);
+#endif
 				result=STATE_CRITICAL;
 			        }
 		        }
 		else{
-			printf("CHECK_NRPE: Error - Could not initiate SSL handshake.\n");
+			printf("CHECK_NRPE: Error - Could not create SSL connection structure.\n");
 			result=STATE_CRITICAL;
 		        }
 

+ 16 - 3
src/nrpe.c

@@ -4,7 +4,7 @@
  * Copyright (c) 1999-2003 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 03-05-2003
+ * Last Modified: 03-06-2003
  *
  * Command line: nrpe -c <config_file> [--inetd | --daemon]
  *
@@ -187,7 +187,9 @@ int main(int argc, char **argv){
 			syslog(LOG_ERR,"Error: could not create SSL context.\n");
 			exit(STATE_CRITICAL);
 		        }
-		SSL_CTX_set_cipher_list(ctx,"ALL");
+		/*SSL_CTX_set_cipher_list(ctx,"ALL");*/
+		SSL_CTX_set_options(ctx,SSL_OP_SINGLE_DH_USE);
+		SSL_CTX_set_cipher_list(ctx,"DH");
                 }
 #endif
 
@@ -693,7 +695,9 @@ void handle_connection(int sock){
 	int rc;
 	int x;
 	FILE *fp;
+#ifdef DEBUG
 	FILE *errfp;
+#endif
 #ifdef HAVE_SSL
 	SSL *ssl;
 #endif
@@ -715,14 +719,21 @@ void handle_connection(int sock){
 			SSL_set_fd(ssl,sock);
 			if(SSL_accept(ssl)!=1){
 				syslog(LOG_ERR,"Error: Could not complete SSL handshake.\n");
+#ifdef DEBUG
 				errfp=fopen("/tmp/err.log","w");
 				ERR_print_errors_fp(errfp);
 				fclose(errfp);
+#endif
 				return;
 			        }
 		        }
 		else{
-			syslog(LOG_ERR,"Error: Could not initiate SSL handshake.\n");
+			syslog(LOG_ERR,"Error: Could not create SSL connection structure.\n");
+#ifdef DEBUG
+			errfp=fopen("/tmp/err.log","w");
+			ERR_print_errors_fp(errfp);
+			fclose(errfp);
+#endif
 			return;
 		        }
 	        }
@@ -764,11 +775,13 @@ void handle_connection(int sock){
 		return;
 	        }
 
+#ifdef DEBUG
 	fp=fopen("/tmp/packet","w");
 	if(fp){
 		fwrite(&receive_packet,1,sizeof(receive_packet),fp);
 		fclose(fp);
 	        }
+#endif
 
 	/* make sure the request is valid */
 	if(validate_request(&receive_packet)==ERROR){