Bug 1282940 - Exception log output when using rhc app ssh "--ssh option" with exist directory
Exception log output when using rhc app ssh "--ssh option" with exist directory
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: Timothy Williams
Wei Sun
Depends On: 1163050
  Show dependency treegraph
Reported: 2015-11-17 15:38 EST by Timothy Williams
Modified: 2015-12-17 12:11 EST (History)
7 users (show)

See Also:
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.
Story Points: ---
Clone Of: 1163050
Last Closed: 2015-12-17 12:11:39 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Timothy Williams 2015-11-17 15:38:05 EST
+++ 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):
rhc 1.32.1

How reproducible:

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@push1-eveusb.int.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

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@redhat.com>
Comment 4 Yanping Zhang 2015-11-17 22:26:33 EST
Reproduced the bug on rhc-
Verified on rhc-
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@ruby1-domzyp.ose22-auto.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 12:11:39 EST
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.


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