Remote ssh using smart-proxy ( Foreman 1.17.1 )

Hello,

I have foreman server and foreman stand alone proxy server.
I could do remote ssh using foreman server but I couldn’t do remote ssh using stand alone smart-proxy.
I could provision servers using both foreman and foreman smart-proxy servers
Foreman version - 1.17.1

Please help me

Thanks
Laxman

You can’t SSH from outside Foreman to the proxy?
Can you ping the proxy server?

yes I could ping proxy server. I could do provisionong servers using smart-proxy. In isolated network. and could do puppetrun. But can’t do remote ssh through smart-proxy

what’s the error summary/log says? when you try to ssh?

I got below error when do remote ssh from smart-proxy

1:
Error initializing command: Net::SSH::ConnectionTimeout - Net::SSH::ConnectionTimeout
2:
Exit status: EXCEPTION

I installed smart-proxy as below

foreman-installer --no-enable-foreman --enable-puppet --puppet-server-ca=false --puppet-server-foreman-url=https://ol07frm00.sstech.com --enable-foreman-proxy --foreman-proxy-puppetca=false --foreman-proxy-tftp=true --foreman-proxy-foreman-base-url=https://ol07frm00.sstech.com --foreman-proxy-trusted-hosts=ol07frm00.sstech.com --foreman-proxy-oauth-consumer-key=ThvpfLqPhbKnXqwhHyV7LfKeiTjfcEyR --foreman-proxy-oauth-consumer-secret=kR8NUvxTqva8azWXiWumnmFZSk3CVeUT --enable-foreman-proxy-plugin-dynflow --enable-foreman-proxy-plugin-remote-execution-ssh

I found below error in foreman production log

2018-06-11T15:52:04 06f104e1 [app] [I]   Parameters: {"hosts_needs_refresh"=>"", "host_ids_needing_status_update"=>["19"], "_"=>"1528746595357", "id"=>"28"}
2018-06-11T15:52:04 06f104e1 [app] [I] Current user: admin (administrator)
2018-06-11T15:52:04 06f104e1 [app] [I]   Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.js.erb
2018-06-11T15:52:05 06f104e1 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/_host_status_td.html.erb (1.1ms)
2018-06-11T15:52:05 06f104e1 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.js.erb (45.9ms)
2018-06-11T15:52:05 06f104e1 [app] [I] Completed 200 OK in 76ms (Views: 41.9ms | ActiveRecord: 9.3ms)
2018-06-11T15:16:08  [app] [I] Current user: admin (administrator)
2018-06-11T15:49:54  [app] [I] Current user: admin (administrator)
2018-06-11T15:49:56  [app] [I] Current user: admin (administrator)
2018-06-11T15:49:56  [app] [I] Current user: admin (administrator)
2018-06-11T15:50:04  [app] [I] Current user: admin (administrator)
2018-06-11T15:50:14  [app] [I] Current user: admin (administrator)
2018-06-11T15:50:24  [app] [I] Current user: admin (administrator)
2018-06-11T15:50:34  [app] [I] Current user: admin (administrator)
2018-06-11T15:50:44  [app] [I] Current user: admin (administrator)
2018-06-11T15:50:54  [app] [I] Current user: admin (administrator)
2018-06-11T15:50:56  [app] [I] Current user: admin (administrator)
2018-06-11T15:51:04  [app] [I] Current user: admin (administrator)
2018-06-11T15:51:15  [app] [I] Current user: admin (administrator)
2018-06-11T15:51:25  [app] [I] Current user: admin (administrator)
2018-06-11T15:51:35  [app] [I] Current user: admin (administrator)
2018-06-11T15:51:45  [app] [I] Current user: admin (administrator)
2018-06-11T15:51:55  [app] [I] Current user: admin (administrator)
2018-06-11T15:52:04  [app] [I] Current user: admin (administrator)
2018-06-11T15:52:04  [app] [I] Current user: admin (administrator)
2018-06-11T15:52:04  [background] [E] Job execution failed
2018-06-11T15:52:05  [app] [I] Current user: admin (administrator)
2018-06-11T15:52:05  [background] [E] A sub task failed (RuntimeError)
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action/with_sub_plans.rb:230:in `check_for_errors!'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action/with_sub_plans.rb:136:in `try_to_finish'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action/with_polling_sub_plans.rb:18:in `poll'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action/with_polling_sub_plans.rb:10:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/lib/actions/remote_execution/run_hosts_job.rb:66:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action.rb:531:in `block (3 levels) in execute_run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware.rb:18:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware.rb:31:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware.rb:18:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware.rb:31:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware.rb:18:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.11.2/app/lib/actions/middleware/rails_executor_wrap.rb:14:in `block in run'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/execution_wrapper.rb:85:in `wrap'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.11.2/app/lib/actions/middleware/rails_executor_wrap.rb:13:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware.rb:18:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action/progress.rb:30:in `with_progress_calculation'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action/progress.rb:16:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware.rb:18:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.11.2/app/lib/actions/middleware/keep_current_user.rb:28:in `block in run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.11.2/app/lib/actions/middleware/keep_current_user.rb:51:in `restore_curent_user'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.11.2/app/lib/actions/middleware/keep_current_user.rb:28:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware.rb:18:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware.rb:31:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/middleware/world.rb:30:in `execute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action.rb:530:in `block (2 levels) in execute_run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action.rb:529:in `catch'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action.rb:529:in `block in execute_run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action.rb:444:in `block in with_error_handling'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action.rb:444:in `catch'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action.rb:444:in `with_error_handling'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action.rb:524:in `execute_run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/action.rb:277:in `execute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:9:in `block (2 levels) in execute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/execution_plan/steps/abstract.rb:155:in `with_meta_calculation'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:8:in `block in execute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:22:in `open_action'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:7:in `execute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/director.rb:55:in `execute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/executors/parallel/worker.rb:12:in `block in on_message'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/executors.rb:11:in `run_user_code'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/executors/parallel/worker.rb:11:in `on_message'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/context.rb:46:in `on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/executes_context.rb:7:in `on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.37/lib/dynflow/actor.rb:26:in `on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/awaits.rb:15:in `on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/sets_results.rb:14:in `on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/buffer.rb:38:in `process_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/buffer.rb:31:in `process_envelopes?'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/buffer.rb:20:in `on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/termination.rb:55:in `on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/removes_child.rb:10:in `on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/behaviour/sets_results.rb:14:in `on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/core.rb:161:in `process_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/core.rb:95:in `block in on_envelope'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/core.rb:118:in `block (2 levels) in schedule_execution'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `block in synchronize'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-edge-0.2.4/lib/concurrent/actor/core.rb:115:in `block in schedule_execution'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/serialized_execution.rb:18:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/serialized_execution.rb:96:in `work'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/serialized_execution.rb:77:in `block in call_job'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:348:in `run_task'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:337:in `block (3 levels) in create_worker'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `loop'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `block (2 levels) in create_worker'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `catch'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `block in create_worker'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2018-06-11T15:52:06 580f2c6e [app] [I] Started GET "/job_invocations/28?hosts_needs_refresh=&_=1528746595358" for 192.168.1.253 at 2018-06-11 15:52:06 -0400
2018-06-11T15:52:06 580f2c6e [app] [I] Processing by JobInvocationsController#show as JS
2018-06-11T15:52:06 580f2c6e [app] [I]   Parameters: {"hosts_needs_refresh"=>"", "_"=>"1528746595358", "id"=>"28"}
2018-06-11T15:52:06 580f2c6e [app] [I] Current user: admin (administrator)
2018-06-11T15:52:06 580f2c6e [app] [I]   Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.js.erb
2018-06-11T15:52:07 580f2c6e [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.js.erb (30.5ms)
2018-06-11T15:52:07 580f2c6e [app] [I] Completed 200 OK in 57ms (Views: 29.2ms | ActiveRecord: 7.5ms)

Hello,

Please let me know the command line options to support remote ssh execution and ansible while installing standalone smart-proxy

foreman version 1.17.1
foreman proxy version 1.17.1

I installed smart-proxy in command line using below options

foreman-installer --no-enable-foreman --enable-puppet --puppet-server-ca=false --puppet-server-foreman-url=https:/ol07frm00.sstech.com/ --enable-foreman-proxy --foreman-proxy-puppetca=false --foreman-proxy-tftp=true --foreman-proxy-foreman-base-url=https://ol07frm00.sstech.com --foreman-proxy-trusted-hosts=ol07frm00.sstech.com --foreman-proxy-oauth-consumer-key=ThvpfLqPhbKnXqwhHyV7LfKeiTjfcEyR --foreman-proxy-oauth-consumer-secret=kR8NUvxTqva8azWXiWumnmFZSk3CVeUT --enable-foreman-proxy-plugin-dynflow --enable-foreman-proxy-plugin-remote-execution-ssh

Thanks
Laxman

Hello,

any update on the above request. Please help me

Thanks

Hello,
first, sorry for the late response.

this tells you that remote execution works from the installation point of view. This error means that when a connection was being opened from the smart proxy to the remote host, it timed out, which could be for a variety of reasons. But sadly there’s nothing the installer can do about this. You need to make sure that the host is reachable.

Does regular ssh from the proxy machine to the remote host work?

Hello, thanks for update.

remote host cane be reached through ssh from smart-proxy server.
no direct ssh access from foreman server to client

Thanks
Laxman

Is the correct remote execution proxy defined for the client subnet?

The subnet determines which remote execution proxy will originate the SSH connection. So it’s essential that the client have a valid subnet defined for it’s NIC, that remote execution is enabled on the NIC, and that the subnet have the right proxy defined.

1 Like