Bug 1163050

Summary: Exception log output when using rhc app ssh "--ssh option" with exist directory
Product: OpenShift Online Reporter: DeShuai Ma <dma>
Component: ocAssignee: Vu Dinh <vdinh>
Status: CLOSED WONTFIX QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 2.xCC: jokerman, mmccomas, vdinh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1282940 (view as bug list) Environment:
Last Closed: 2017-05-31 18:22:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1282940    

Description DeShuai Ma 2014-11-12 10:13:12 UTC
Description of problem:
create a app and try to rhc ssh the app with a wrong execute path by using --ssh parameter
(eg: rhc app ssh -a existapp --ssh /etc/init.d/), just exception log output.
login in the system use root.

Version-Release number of selected component (if applicable):
devenv_5293
rhc 1.32.1

How reproducible:
Always

Steps to Reproduce:
1. Create an app 
$ rhc app create push1 jboss-unified-push-1
2. Ssh the app with exist directory

Actual results:
# rhc app-ssh -a push1 --ssh /etc/init.d/
Connecting to 546313da6cec0e1994000e17.rhcloud.com ...
/usr/local/rvm/gems/ruby-1.9.3-p550/gems/rhc-1.32.0/lib/rhc/commands/ssh.rb:45:in `exec': Permission denied - /etc/init.d/ (Errno::EACCES)
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/rhc-1.32.0/lib/rhc/commands/ssh.rb:45:in `run'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/rhc-1.32.0/lib/rhc/commands.rb:294:in `execute'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/rhc-1.32.0/lib/rhc/commands.rb:285:in `block (3 levels) in to_commander'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/commander-4.2.1/lib/commander/runner.rb:419:in `run_active_command'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/rhc-1.32.0/lib/rhc/command_runner.rb:72:in `run!'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/commander-4.2.1/lib/commander/delegates.rb:12:in `run!'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/rhc-1.32.0/lib/rhc/cli.rb:37:in `start'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/gems/rhc-1.32.0/bin/rhc:20:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/bin/rhc:23:in `load'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/bin/rhc:23:in `<main>'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/bin/ruby_executable_hooks:15:in `eval'
    from /usr/local/rvm/gems/ruby-1.9.3-p550/bin/ruby_executable_hooks:15:in `<main>'

Expected results:

Additional info:

Reference : https://bugzilla.redhat.com/show_bug.cgi?id=978837

Comment 1 Vu Dinh 2015-11-15 04:31:54 UTC
This PR <https://github.com/openshift/rhc/pull/728> is submitted to fix this bug.

Comment 2 openshift-github-bot 2015-11-17 15:34:29 UTC
Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/33de65a472561fe11e93fc638c5da7b05a010bfd
Bug 1163050 - Fix exception using rhc app ssh --ssh with custom path

The rhc app ssh --ssh with custom and exist path fails due to lacking
of checking whether the path is a readable file or not.

This commit modifies check_ssh_executable? method to check if the path
is a readable file or not and it no longer accepted directory as a
valid input. A exception is raised in case of unreadable/non existent
file or directory is provided.

Bug 1163050
Link <https://bugzilla.redhat.com/show_bug.cgi?id=1163050>

Signed-off-by: Vu Dinh <vdinh>

Comment 3 DeShuai Ma 2015-11-18 05:57:19 UTC
Verify on devenv_5712.

[root@ip-172-18-10-219 ~]# rhc apps
ruby1 @ http://ruby1-dma.dev.rhcloud.com/ (uuid: 564c0e116749e9a846000006)
--------------------------------------------------------------------------
  Domain:     dma
  Created:    12:35 AM
  Gears:      1 (defaults to small)
  Git URL:    ssh://564c0e116749e9a846000006.rhcloud.com/~/git/ruby1.git/
  SSH:        564c0e116749e9a846000006.rhcloud.com
  Deployment: auto (on git push)

  ruby-2.0 (Ruby 2.0)
  -------------------
    Gears: 1 small

You have access to 1 application.
[root@ip-172-18-10-219 ~]# rhc ssh ruby1 --ssh /etc/init.d/
SSH executable '/etc/init.d/' is not a regular file.
[root@ip-172-18-10-219 ~]# rhc --version
rhc 1.38.4

Comment 4 Eric Paris 2017-05-31 18:22:11 UTC
We apologize, however, we do not plan to address this report at this time. The majority of our active development is for the v3 version of OpenShift. If you would like for Red Hat to reconsider this decision, please reach out to your support representative. We are very sorry for any inconvenience this may cause.