dev-sec / ssl-baseline

DevSec SSL/TLS Baseline - InSpec Profile
https://dev-sec.io/baselines/ssl/
Apache License 2.0
67 stars 23 forks source link

Inspec cannot run this profile against Amazon Linux 2. #24

Open Michael-McClelland4 opened 5 years ago

Michael-McClelland4 commented 5 years ago

Describe the bug Inspec cannot run this profile against Amazon Linux 2.

Expected behavior Inspec profile runs and reports detectable flaws in target system ssl/tls listeners.

Actual behavior

Traceback (most recent call last):
        39: from C:/opscode/chefdk/bin/inspec:312:in `<main>'
        38: from C:/opscode/chefdk/bin/inspec:312:in `load'
        37: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/inspec-3.0.52/bin/inspec:12:in `<top (required)>'
        36: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
        35: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
        34: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
        33: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
        32: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/inspec-3.0.52/lib/inspec/cli.rb:242:in `exec'
        31: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/inspec-3.0.52/lib/inspec/cli.rb:242:in `new'
        30: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/inspec-3.0.52/lib/inspec/runner.rb:58:in `initialize'
        29: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/inspec-3.0.52/lib/inspec/runner.rb:66:in `configure_transport'
        28: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/inspec-3.0.52/lib/inspec/backend.rb:51:in `create'
        27: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/transports/ssh.rb:81:in `connection'
        26: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/transports/ssh.rb:208:in `create_new_connection'
        25: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/transports/ssh.rb:208:in `new'
        24: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/transports/ssh_connection.rb:53:in `initialize'
        23: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/extras/command_wrapper.rb:128:in `load'
        22: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/plugins/base_connection.rb:114:in `platform'
        21: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect.rb:9:in `scan'
        20: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:27:in `scan'
        19: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:27:in `each'
        18: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:33:in `block in scan'
        17: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `scan_children'
        16: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `each'
        15: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:51:in `block in scan_children'
        14: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:60:in `scan_family_children'
        13: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `scan_children'
        12: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `each'
        11: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:51:in `block in scan_children'
        10: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:60:in `scan_family_children'
         9: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `scan_children'
         8: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `each'
         7: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:51:in `block in scan_children'
         6: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:60:in `scan_family_children'
         5: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `scan_children'
         4: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `each'
         3: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:46:in `block in scan_children'
         2: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:46:in `instance_eval'
         1: from C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/specifications/os.rb:194:in `block in load'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/helpers/os_linux.rb:16:in `redhatish_version': undefined method `[]' for nil:NilClass (NoMethodError)

Example code

inspec exec .\ssl-baseline\ -t ssh://ec2-user@myec2hostip.com -i C:\pathto\my\private\key.pem

OS / Environment

Chef Inspec run from Windows 10 Version: 10.0.17134.0
Chef Inspec run on ec2.internal 4.14.77-81.59.amzn2.x86_64 #1 SMP Mon Nov 12 21:32:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Inspec Version

inspec --version
3.0.52

Baseline Version

45152ca8ccc99b5325d2aa515d0f89706d810c5b

Additional context Profile is working successfully with rhel6/7 systems (tested in both AWS infrastructure and local virtual machine) so I believe this bug is completely unique to Amazon Linux 2.