Bug 1282940 - Exception log output when using rhc app ssh "--ssh option" with exist directory
Summary: Exception log output when using rhc app ssh "--ssh option" with exist directory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: Timothy Williams
QA Contact: Wei Sun
URL:
Whiteboard:
Depends On: 1163050
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-17 20:38 UTC by Timothy Williams
Modified: 2015-12-17 17:11 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: RHC ssh did not check whether the ssh executable passed with the '--ssh' option was a directory or a valid file. Consequence: RHC crashes with a backtrace was reported when a directory was passed with '--ssh'. Fix: Before using the specified ssh executable, check to ensure the executable is a valid file. Result: An error is properly reported before the use of the ssh executable if the specified executable is not a regular file.
Clone Of: 1163050
Environment:
Last Closed: 2015-12-17 17:11:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2666 0 normal SHIPPED_LIVE Important: Red Hat OpenShift Enterprise 2.2.8 security, bug fix, and enhancement update 2015-12-17 22:07:54 UTC

Description Timothy Williams 2015-11-17 20:38:05 UTC
+++ This bug was initially created as a clone of Bug #1163050 +++

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

--- Additional comment from Vu Dinh on 2015-11-14 23:31:54 EST ---

This PR <https://github.com/openshift/rhc/pull/728> is submitted to fix this bug.

--- Additional comment from openshift-github-bot on 2015-11-17 10:34:29 EST ---

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 4 Yanping Zhang 2015-11-18 03:26:33 UTC
Reproduced the bug on rhc-1.37.1.2-1.el6op.noarch.
Verified on rhc-1.38.4.2-1.el6op.noarch
Steps to verify:
1.Create an app.
# rhc app create ruby1 ruby-1.9
2.Ssh the app with existing but wrong directory. It will return gracefull error:
# rhc ssh ruby1 --ssh /etc/init.d/
SSH executable '/etc/init.d/' is not a regular file.
3.Ssh the app after set "ssh=/etc/init.d/" in ~/.openshift/express.conf.It will return gracefull error:
# rhc ssh ruby1
SSH executable '/etc/init.d' is not a regular file.
4.Ssh the app with the right directory.
# rhc ssh ruby1 --ssh /usr/bin/ssh
Connecting to domzyp-ruby1-1.com.cn ..
......
[ruby1-domzyp.ose22-auto.com.cn domzyp-ruby1-1]\> ls
app-deployments  app-root  git	ruby

The bug has been fixed, so move it to Verified.

Comment 6 errata-xmlrpc 2015-12-17 17:11:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-2666.html


Note You need to log in before you can comment on or make changes to this bug.