Merge pull request #2034 from magnuslarsen/3.1dev

[Rating] Fix cipher rating, and add penalty for weak ciphers
This commit is contained in:
Dirk Wetter 2021-11-06 12:20:18 +01:00 committed by GitHub
commit b7d6b7ca7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1116,6 +1116,9 @@ set_ciph_str_score() {
[[ $size -gt $CIPH_STR_BEST ]] && let CIPH_STR_BEST=$size
[[ $size -lt $CIPH_STR_WORST ]] && let CIPH_STR_WORST=$size
[[ $size -lt 112 || $size == "None" ]] && set_grade_cap "F" "Using cipher suites weaker than 112 bits"
return 0
}
@ -22001,7 +22004,7 @@ run_rating() {
# Determine the score for the worst key
if [[ $c3_worst_cb -gt 0 && $c3_worst_cb -lt 128 ]]; then
c3_worst=20
elif [[ $c3_worst_cb -lt 256 ]]; then
elif [[ $c3_worst_cb -ge 128 && $c3_worst_cb -lt 256 ]]; then
c3_worst=80
elif [[ $c3_worst_cb -ge 256 ]]; then
c3_worst=100
@ -22016,7 +22019,12 @@ run_rating() {
fileout "cipher_strength_score_weighted" "INFO" "$c3_wscore"
## Calculate final score and grade
# 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
let final_score=0
else
let final_score=$c1_wscore+$c2_wscore+$c3_wscore
fi
pr_bold " Final Score "; outln $final_score
fileout "final_score" "INFO" "$final_score"