mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-10-31 13:55:25 +01:00 
			
		
		
		
	Merge pull request #2234 from cancom/fix/grade-cap-sorting
Fix grade cap reasons not showing weak public keys
This commit is contained in:
		
							
								
								
									
										17
									
								
								testssl.sh
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								testssl.sh
									
									
									
									
									
								
							| @@ -22396,10 +22396,6 @@ run_rating() { | |||||||
| 
 | 
 | ||||||
|      [[ -n "$STARTTLS_PROTOCOL" ]] && set_grade_cap "T" "Encryption via STARTTLS is not mandatory (opportunistic)." |      [[ -n "$STARTTLS_PROTOCOL" ]] && set_grade_cap "T" "Encryption via STARTTLS is not mandatory (opportunistic)." | ||||||
| 
 | 
 | ||||||
|      # Sort the reasons. This is just nicer to read in general |  | ||||||
|      IFS=$'\n' sorted_reasons=($(sort -ru <<<"${GRADE_CAP_REASONS[*]}")) |  | ||||||
|      IFS=$'\n' sorted_warnings=($(sort -u <<<"${GRADE_WARNINGS[*]}")) |  | ||||||
|      IFS=$old_ifs |  | ||||||
|      pr_bold " Rating specs"; out " (not complete)  "; outln "SSL Labs's 'SSL Server Rating Guide' (version 2009q from 2020-01-30)" |      pr_bold " Rating specs"; out " (not complete)  "; outln "SSL Labs's 'SSL Server Rating Guide' (version 2009q from 2020-01-30)" | ||||||
|      pr_bold " Specification documentation  "; pr_url "https://github.com/ssllabs/research/wiki/SSL-Server-Rating-Guide" |      pr_bold " Specification documentation  "; pr_url "https://github.com/ssllabs/research/wiki/SSL-Server-Rating-Guide" | ||||||
|      outln |      outln | ||||||
| @@ -22408,6 +22404,11 @@ run_rating() { | |||||||
| 
 | 
 | ||||||
|      # No point in calculating a score, if a cap of "F", "T", or "M" has been set |      # No point in calculating a score, if a cap of "F", "T", or "M" has been set | ||||||
|      if [[ $GRADE_CAP == F || $GRADE_CAP == T || $GRADE_CAP == M ]]; then |      if [[ $GRADE_CAP == F || $GRADE_CAP == T || $GRADE_CAP == M ]]; then | ||||||
|  |           # Sort the reasons | ||||||
|  |           IFS=$'\n' sorted_reasons=($(sort -ru <<<"${GRADE_CAP_REASONS[*]}")) | ||||||
|  |           IFS=$'\n' sorted_warnings=($(sort -u <<<"${GRADE_WARNINGS[*]}")) | ||||||
|  |           IFS=$old_ifs | ||||||
|  | 
 | ||||||
|           pr_bold " Protocol Support"; out " (weighted)  "; outln "0 (0)" |           pr_bold " Protocol Support"; out " (weighted)  "; outln "0 (0)" | ||||||
|           pr_bold " Key Exchange"; out "     (weighted)  "; outln "0 (0)" |           pr_bold " Key Exchange"; out "     (weighted)  "; outln "0 (0)" | ||||||
|           pr_bold " Cipher Strength"; out "  (weighted)  "; outln "0 (0)" |           pr_bold " Cipher Strength"; out "  (weighted)  "; outln "0 (0)" | ||||||
| @@ -22508,6 +22509,12 @@ run_rating() { | |||||||
|           fileout "cipher_strength_score_weighted" "INFO" "$c3_wscore" |           fileout "cipher_strength_score_weighted" "INFO" "$c3_wscore" | ||||||
| 
 | 
 | ||||||
|           ## Calculate final score and grade |           ## Calculate final score and grade | ||||||
|  | 
 | ||||||
|  |           # Sort the reasons | ||||||
|  |           IFS=$'\n' sorted_reasons=($(sort -ru <<<"${GRADE_CAP_REASONS[*]}")) | ||||||
|  |           IFS=$'\n' sorted_warnings=($(sort -u <<<"${GRADE_WARNINGS[*]}")) | ||||||
|  |           IFS=$old_ifs | ||||||
|  | 
 | ||||||
|           # If any category resulted in a score of 0, push final grade to 0 |           # If any category resulted in a score of 0, push final grade to 0 | ||||||
|           if [[ $c1_score -eq 0 || $c2_score -eq 0 || $c3_score -eq 0 ]]; then |           if [[ $c1_score -eq 0 || $c2_score -eq 0 || $c3_score -eq 0 ]]; then | ||||||
|                final_score=0 |                final_score=0 | ||||||
| @@ -22538,7 +22545,7 @@ run_rating() { | |||||||
|                final_grade=$GRADE_CAP |                final_grade=$GRADE_CAP | ||||||
|           # For "exceptional" config, an "A+" is awarded, or "A-" for slightly less "exceptional" |           # For "exceptional" config, an "A+" is awarded, or "A-" for slightly less "exceptional" | ||||||
|           elif [[ -z "$GRADE_CAP" && $pre_cap_grade == A ]]; then |           elif [[ -z "$GRADE_CAP" && $pre_cap_grade == A ]]; then | ||||||
|                if [[ ${#sorted_warnings[@]} -eq 0 ]]; then |                if [[ ${#GRADE_WARNINGS[@]} -eq 0 ]]; then | ||||||
|                     final_grade="A+" |                     final_grade="A+" | ||||||
|                else |                else | ||||||
|                     final_grade="A-" |                     final_grade="A-" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dirk Wetter
					Dirk Wetter