libraries/ssh_crypto.rb
# return a list of valid algoriths for a current platform
return a list of valid algoriths for a current platform
return a list of valid algoriths for a current platform
def valid_algorithms 
    alg53 = %w(rsa)
    alg60 = %w(rsa ecdsa)
    alg66 = %w(rsa ecdsa ed25519)
    alg = alg66 
    case inspec.os[:name]
    when 'ubuntu'
      case inspec.os[:release]
      when '12.04'
        alg = alg53
      when '14.04', '15.10', '16.04'
        alg = alg66
      end
    when 'debian'
      case inspec.os[:release]
      when /7\./
        alg = alg60
      when /8\./
        alg = alg66
      end
    when 'redhat', 'centos', 'oracle'
      case inspec.os[:release]
      when /6\./
        alg = alg53
      when /7\./
        alg = alg66
      end
    when 'fedora'
      alg = alg66
    when 'opensuse'
      case inspec.os[:release]
      when /13\.2/
        alg = alg66
      when /42\.1/
        alg = alg66
      end
    when 'mac_os_x'
      case inspec.os[:release]
      when /10.9\./
        alg53
      when /10.10\./, /10.11\./, /10.12\./
        alg66
      end
    end
    alg
  end
def valid_algorithms alg53 = %w( rsa ) alg60 = %w( rsa ecdsa ) alg66 = %w( rsa ecdsa ed25519 ) alg = alg66 case inspec . os [ :name ] when 'ubuntu' case inspec . os [ :release ] when '12.04' alg = alg53 when '14.04' , '15.10' , '16.04' alg = alg66 end when 'debian' case inspec . os [ :release ] when / 7 \. / alg = alg60 when / 8 \. / alg = alg66 end when 'redhat' , 'centos' , 'oracle' case inspec . os [ :release ] when / 6 \. / alg = alg53 when / 7 \. / alg = alg66 end when 'fedora' alg = alg66 when 'opensuse' case inspec . os [ :release ] when / 13 \. 2 / alg = alg66 when / 42 \. 1 / alg = alg66 end when 'mac_os_x' case inspec . os [ :release ] when / 10.9 \. / alg53 when / 10.10 \. / , / 10.11 \. / , / 10.12 \. / alg66 end end alg end
return a list of valid algoriths for a current platform
return a list of valid algoriths for a current platform
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength # probably its a best suitable set for everything unknown