Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspec login fails #793

Closed
YarNhoj opened this issue Jun 16, 2016 · 5 comments · Fixed by #927
Closed

inspec login fails #793

YarNhoj opened this issue Jun 16, 2016 · 5 comments · Fixed by #927
Labels
Component: CLI: compliance Type: Bug Feature not working as expected
Milestone

Comments

@YarNhoj
Copy link

YarNhoj commented Jun 16, 2016

Description

The inspec login command fails w/ legacy_login_post': undefined methodsend_request' for Compliance::API:Class (NoMethodError)

InSpec and Platform Version

inspec version 0.23
inspec version 0.25.0

HOST

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=15.10
DISTRIB_CODENAME=wily
DISTRIB_DESCRIPTION="Ubuntu 15.10"
NAME="Ubuntu"
VERSION="15.10 (Wily Werewolf)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 15.10"
VERSION_ID="15.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

VM

CentOS release 6.7 (Final)
Linux compliance.shadow-soft.com 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "bento/centos-6.7"
  # config.omnibus.chef_version = "12.5.1"

  # Enable this to check for updates
  config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.network "forwarded_port", guest: 443, host: 8443

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network "private_network", ip: "10.10.100.10"
  config.vm.hostname="compliance.shadow-soft.com"

  # Add sane hosts entries
  config.vm.provision :hosts do |host|
    host.add_localhost_hostnames = false
    host.add_host '10.10.100.10', ['compliance']
  end

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
   config.vm.provider "virtualbox" do |vb|
  # Customize the amount of memory on the VM:
     vb.memory = "2048"
   end
  #
end

Replication Case

vagrant init bento/centos-6.7
vagrant ssh
sudo su -
wget https://packages.chef.io/stable/el/6/chef-compliance-1.3.1-1.el6.x86_64.rpm
rpm -Uvh chef-compliance-1.3.1-1.el6.x86_64.rpmh
chef-compliance-ctl reconfigure

Log in and run through the setup

inspec compliance login server_name --user=username --password=password

Possible Solutions

This looks like a regression from 689?

Stacktrace

/opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/inspec-0.25.0/lib/bundles/inspec-compliance/api.rb:21:in `legacy_login_post': undefined method `send_request' for Compliance::API:Class (NoMethodError)
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/inspec-0.25.0/lib/bundles/inspec-compliance/cli.rb:213:in `login_legacy'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/inspec-0.25.0/lib/bundles/inspec-compliance/cli.rb:36:in `login'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:235:in `block in subcommand'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /opt/chef-compliance/embedded/lib/ruby/gems/2.2.0/gems/inspec-0.25.0/bin/inspec:9:in `<top (required)>'
    from /opt/chef-compliance/embedded/bin/inspec:22:in `load'
    from /opt/chef-compliance/embedded/bin/inspec:22:in `<main>'
@chris-rock
Copy link
Contributor

@YarNhoj With the latest version of Chef Compliance the login method via username/password is not supported anymore. We upgraded the authentication to a proper OpenID Connect systems.

Try:
inspec compliance login https://compliance.test --insecure --user admin --token 'PASTE-TOKEN-HERE'

Also have a look here: #690

@chris-rock
Copy link
Contributor

@YarNhoj is that still an issue?

@YarNhoj
Copy link
Author

YarNhoj commented Jun 21, 2016

Sorry I'm travelling on an engagement. I'll test it from the hotel tonight. Thanks!

@YarNhoj
Copy link
Author

YarNhoj commented Jun 22, 2016

Works great, It still throws a warning that says Your server supports --user and --password only, I think I just misunderstood what that meant. I was thinking that it meant it only supported that login method.

@chris-rock
Copy link
Contributor

Thanks @YarNhoj for the feedback. We'll fix the false message.

@chris-rock chris-rock added the Type: Bug Feature not working as expected label Jul 11, 2016
@chris-rock chris-rock added this to the 1.0.0 milestone Jul 26, 2016
@chris-rock chris-rock modified the milestones: 0.30.0, 1.0.0 Aug 8, 2016
@chris-rock chris-rock self-assigned this Aug 8, 2016
@chris-rock chris-rock modified the milestones: 0.32.0, 0.30.0, 0.30.1, 0.31.0 Aug 12, 2016
@chris-rock chris-rock assigned vjeffrey and unassigned chris-rock Aug 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CLI: compliance Type: Bug Feature not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants