You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using encountering an issue when running inspec exec on shell-local provisioner in Packer
Describe the problem
Inspec and packer is running on windows machine. targeting linux server using ssh.
when I am running the below command targeting linux build on packer shell-local. Inspec returns an error and prompting for password.
note: i have used & on my password hence i have used "" to escape the character.
C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/prompt.rb:45:in noecho': Bad file descriptor (Errno::EBADF) ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/prompt.rb:45:in ask'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/methods/password.rb:68:in ask_password' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/methods/password.rb:21:in authenticate'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:86:in block in authenticate' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:72:in each'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:72:in authenticate' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh.rb:255:in start'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh_connection.rb:213:in establish_connection' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh_connection.rb:292:in session'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh_connection.rb:250:in run_command_via_connection' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/plugins/base_connection.rb:149:in run_command'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/helpers/os_windows.rb:9:in check_cmd' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/helpers/os_windows.rb:4:in detect_windows'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/specifications/os.rb:20:in block in load_windows' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:44:in instance_eval'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:44:in block in scan_children' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:43:in each'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:43:in scan_children' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:31:in block in scan'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:25:in each' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:25:in scan'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect.rb:7:in scan' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/plugins/base_connection.rb:123:in platform'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/extras/command_wrapper.rb:190:in load' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh_connection.rb:60:in initialize'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh.rb:259:in new' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh.rb:259:in create_new_connection'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh.rb:85:in connection' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/backend.rb:38:in create'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/runner.rb:87:in configure_transport' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/runner.rb:79:in initialize'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/cli.rb:285:in new' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/cli.rb:285:in exec'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in run' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in dispatch' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/base.rb:485:in start'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/base_cli.rb:35:in start' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-bin-4.46.13/bin/inspec:11:in <top (required)>'
==> vsphere-iso.orac_v79: from C:/opscode/inspec/bin/inspec:285:in load' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/bin/inspec:285:in
'
vsphere-iso.orac_v79: @10.x.x.x's password:
I have also tried inputting the json config file as described in this thread #2413
The problem i am facing is sudo-passoword. is there a options to specify sudo-password hardcoded in the config file?
SSH-key is one of the options i am going to try but this may be happen to winrm connection as well when password has & character.
Possible Solution
The text was updated successfully, but these errors were encountered:
Please try SSH key instead; you should not be hard-coding passwords in files like that. At least pass in the passwords as environment variables or something, so they are not hardcoded in the source code.
Please try SSH key instead; you should not be hard-coding passwords in files like that. At least pass in the passwords as environment variables or something, so they are not hardcoded in the source code.
I Planning to move ssh key.
could you please give some light on setting up environment variables ? is it on Windows OS Env?
I am running inspec on windows server and not using any other chef products .
I am using encountering an issue when running inspec exec on shell-local provisioner in Packer
Describe the problem
Inspec and packer is running on windows machine. targeting linux server using ssh.
when I am running the below command targeting linux build on packer shell-local. Inspec returns an error and prompting for password.
note: i have used & on my password hence i have used "" to escape the character.
provisioner "shell-local" {
inline = [
"inspec exec Profilename -t ssh://root@10.11.12.13 --password='123"&"456T$ --sudo-password='123"&"456T$' --reporter junit:test_xml.xml"
C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/prompt.rb:45:in
'noecho': Bad file descriptor (Errno::EBADF) ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/prompt.rb:45:in
ask'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/methods/password.rb:68:in
ask_password' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/methods/password.rb:21:in
authenticate'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:86:in
block in authenticate' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:72:in
each'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/authentication/session.rb:72:in
authenticate' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh.rb:255:in
start'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh_connection.rb:213:in
establish_connection' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh_connection.rb:292:in
session'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh_connection.rb:250:in
run_command_via_connection' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/plugins/base_connection.rb:149:in
run_command'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/helpers/os_windows.rb:9:in
check_cmd' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/helpers/os_windows.rb:4:in
detect_windows'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/specifications/os.rb:20:in
block in load_windows' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:44:in
instance_eval'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:44:in
block in scan_children' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:43:in
each'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:43:in
scan_children' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:31:in
block in scan'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:25:in
each' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect/scanner.rb:25:in
scan'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/platforms/detect.rb:7:in
scan' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/plugins/base_connection.rb:123:in
platform'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/extras/command_wrapper.rb:190:in
load' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh_connection.rb:60:in
initialize'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh.rb:259:in
new' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh.rb:259:in
create_new_connection'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-core-3.8.1/lib/train/transports/ssh.rb:85:in
connection' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/backend.rb:38:in
create'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/runner.rb:87:in
configure_transport' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/runner.rb:79:in
initialize'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/cli.rb:285:in
new' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/cli.rb:285:in
exec'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in
run' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in
invoke_command'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in
dispatch' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/base.rb:485:in
start'==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.46.13/lib/inspec/base_cli.rb:35:in
start' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-bin-4.46.13/bin/inspec:11:in
<top (required)>'==> vsphere-iso.orac_v79: from C:/opscode/inspec/bin/inspec:285:in
load' ==> vsphere-iso.orac_v79: from C:/opscode/inspec/bin/inspec:285:in
vsphere-iso.orac_v79: @10.x.x.x's password:
I have also tried inputting the json config file as described in this thread #2413
The problem i am facing is sudo-passoword. is there a options to specify sudo-password hardcoded in the config file?
SSH-key is one of the options i am going to try but this may be happen to winrm connection as well when password has & character.
Possible Solution
The text was updated successfully, but these errors were encountered: