|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | | -# Copyright 2015, Dominik Richter |
| 3 | +# Copyright:: 2015, Dominik Richter |
4 | 4 | # |
5 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | # you may not use this file except in compliance with the License. |
|
18 | 18 | # author: Dominik Richter |
19 | 19 | # author: Patrick Muench |
20 | 20 |
|
21 | | -class SshCrypto < Inspec.resource(1) # rubocop:disable Metrics/ClassLength |
| 21 | +class SshCrypto < Inspec.resource(1) |
22 | 22 | name 'ssh_crypto' |
23 | 23 |
|
24 | 24 | def ssh_version |
25 | 25 | inspec.command('ssh -V 2>&1 | cut -f1 -d" " | cut -f2 -d"_"').stdout.to_f |
26 | 26 | end |
27 | 27 |
|
28 | | - def valid_ciphers # rubocop:disable Metrics/CyclomaticComplexity |
| 28 | + def valid_ciphers |
29 | 29 | # define a set of default ciphers |
30 | 30 | ciphers53 = 'aes256-ctr,aes192-ctr,aes128-ctr' |
31 | 31 | ciphers66 = 'chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr' |
@@ -70,7 +70,7 @@ def valid_ciphers # rubocop:disable Metrics/CyclomaticComplexity |
70 | 70 | ciphers |
71 | 71 | end |
72 | 72 |
|
73 | | - def valid_kexs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity |
| 73 | + def valid_kexs |
74 | 74 | # define a set of default KEXs |
75 | 75 | kex85 = 'sntrup761x25519-sha512@openssh.com,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256' |
76 | 76 | kex80 = 'sntrup4591761x25519-sha512@tinyssh.org,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256' |
@@ -131,7 +131,7 @@ def valid_kexs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, |
131 | 131 | kex |
132 | 132 | end |
133 | 133 |
|
134 | | - def valid_macs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize |
| 134 | + def valid_macs |
135 | 135 | # define a set of default MACs |
136 | 136 | macs66 = 'hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256' |
137 | 137 | macs59 = 'hmac-sha2-512,hmac-sha2-256,hmac-ripemd160' |
@@ -185,7 +185,7 @@ def valid_macs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLen |
185 | 185 | macs |
186 | 186 | end |
187 | 187 |
|
188 | | - def valid_privseparation # rubocop:disable Metrics/CyclomaticComplexity |
| 188 | + def valid_privseparation |
189 | 189 | # define privilege separation set |
190 | 190 | ps53 = 'yes' |
191 | 191 | ps59 = 'sandbox' |
@@ -226,10 +226,10 @@ def valid_privseparation # rubocop:disable Metrics/CyclomaticComplexity |
226 | 226 | end |
227 | 227 |
|
228 | 228 | # return a list of valid algoriths for a current platform |
229 | | - def valid_algorithms # rubocop:disable Metrics/CyclomaticComplexity |
230 | | - alg53 = %w[rsa] |
231 | | - alg60 = %w[rsa ecdsa] |
232 | | - alg66 = %w[rsa ecdsa ed25519] |
| 229 | + def valid_algorithms |
| 230 | + alg53 = %w(rsa) |
| 231 | + alg60 = %w(rsa ecdsa) |
| 232 | + alg66 = %w(rsa ecdsa ed25519) |
233 | 233 | alg = alg66 # probably its a best suitable set for everything unknown |
234 | 234 |
|
235 | 235 | case inspec.os[:name] |
|
0 commit comments