RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1142742 - Improve error message if input wrong username or password for a tcp connection
Summary: Improve error message if input wrong username or password for a tcp connection
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: virt-viewer
Version: 7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Fabiano Fidêncio
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-17 10:26 UTC by CongDong
Modified: 2015-03-05 13:39 UTC (History)
8 users (show)

Fixed In Version: virt-viewer-0.6.0-8.el7
Doc Type: Bug Fix
Doc Text:
Cause: All errors coming from TCP connections have been treated as the same, showing to the user the same message, inclusive when the users tried to cancel the connection dialog. Consequence: Users cannot have a clear understanding about what have failed when an error occurred using a TCP connection (or if some fail really happened, considering the case when the user cancelled the dialog and a random error message was being shown). Fix: Let the users cancel the dialog without show any error and add a custom message, from our side, when the authentication using TCP connection fails. Result: A more accurate message is shown when an authentication error happens using TCP connection and let the users cancel the dialog without show any random message, just leaving the program.
Clone Of:
Environment:
Last Closed: 2015-03-05 13:39:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0295 0 normal SHIPPED_LIVE virt-viewer bug fix and enhancement update 2015-03-05 17:33:00 UTC

Description CongDong 2014-09-17 10:26:10 UTC
Description of problem:
When input wrong username or password for a tcp connection,
the error message is not clear

Version-Release number of selected component (if applicable):
virt-viewer-0.6.0-5.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.On host A,set tcp server environment.
1.1 Edit /etc/sysconfig/libvirtd
       LIBVIRTD_ARGS="--listen"

1.2 Edit /etc/libvirt/libvirtd.conf
       listen_tls = 0
       listen_tcp=1
       auth_tcp="sasl"

1.3 Add a user named "fred", and setting his password as "redhat"
   # saslpasswd2 -a libvirt fred
   Password: xxxxxx
   Again (for verification): xxxxxx

1.4 Restart libvirtd service and set iptables.
# service libvirtd restart

#iptables -F

2. Prepare a spice guest on host A,set it's listen address as 0.0.0.0,the xml shows as below:
# virsh dumpxml $vm
    <graphics type='spice' port='5900' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

3. On host B, try to connect the guest on host A with virt-viewer
# virt-viewer -c qemu+tcp://10.66.7.56/system $vm

4. A login dialog will come out, input a wrong username or password, and click OK
5. Repeat Step 3, and click "Cancle" button when the dialog comes out

Actual results:
Step 4, error message:
Unable to connect to libvirt with URI qemu+tcp://$hsot_a_ip/system
Step5, get same error message.

Expected results:
Step4, error message should tell user the username and password are wrong.
Step5, If click "Cancle" button, don't try to connect, just quit virt-viewer.

Additional info:

Comment 2 Fabiano Fidêncio 2014-09-23 11:36:58 UTC
We have 2 problems here and, IMHO, it should be split in 2 different bugs.

Let's start with the easiest one:
1) Cancel button should quit virt-viewer without show any error.
It's easily doable in the client side and a patch was sent to ML about it: https://www.redhat.com/archives/virt-tools-list/2014-September/msg00192.html

2) RFE: Improve libvirt errors exposed to the user when an authentication fail
This is something related to the libvirt and not to our client, AFAIU. I've done some investigation and started a thread about this in virt-tools-list: https://www.redhat.com/archives/virt-tools-list/2014-September/msg00186.html. Let's wait for answers there and see if we have an agreement about how to expose possible authentication errors.

Shall we open a different bug for 1) and change this bug title for 2)?

Comment 3 Fabiano Fidêncio 2014-09-23 14:52:23 UTC
(In reply to Fabiano Fidêncio from comment #2)
> We have 2 problems here and, IMHO, it should be split in 2 different bugs.
> 
> Let's start with the easiest one:
> 1) Cancel button should quit virt-viewer without show any error.
> It's easily doable in the client side and a patch was sent to ML about it:
> https://www.redhat.com/archives/virt-tools-list/2014-September/msg00192.html
> 
> 2) RFE: Improve libvirt errors exposed to the user when an authentication
> fail
> This is something related to the libvirt and not to our client, AFAIU. I've
> done some investigation and started a thread about this in virt-tools-list:
> https://www.redhat.com/archives/virt-tools-list/2014-September/msg00186.html.
> Let's wait for answers there and see if we have an agreement about how to
> expose possible authentication errors.

I've just sent a patch to virt-tools-list improving the error message.
This is the best we can do from our side, expose the libvirt error with our default message. If any improvement is required, it should be done in the libvirt side.
https://www.redhat.com/archives/virt-tools-list/2014-September/msg00201.html

Comment 5 CongDong 2014-10-09 03:03:14 UTC
Test with virt-viewer-0.6.0-7.el7.x86_64

Steps are same with description.

Result:
After input username and correct password, virt-viewer is exit, didn't connect the guest.

#virt-viewer -c qemu+tcp://$ip/system $vm --debug
(virt-viewer:24212): virt-viewer-DEBUG: Insert window 0 0x23dd010
(virt-viewer:24212): virt-viewer-DEBUG: Insert window 1 0x23dd0d0
(virt-viewer:24212): virt-viewer-DEBUG: Insert window 2 0x23dd190
(virt-viewer:24212): virt-viewer-DEBUG: Insert window 3 0x23dd250
(virt-viewer:24212): virt-viewer-DEBUG: fullscreen display 0: 0
(virt-viewer:24212): virt-viewer-DEBUG: fullscreen display 1: 0
(virt-viewer:24212): virt-viewer-DEBUG: fullscreen display 3: 0
(virt-viewer:24212): virt-viewer-DEBUG: fullscreen display 2: 0
(virt-viewer:24212): virt-viewer-DEBUG: connecting ...
(virt-viewer:24212): virt-viewer-DEBUG: Opening connection to libvirt with URI qemu+tcp://10.66.4.107/system
(virt-viewer:24212): virt-viewer-DEBUG: Add handle 12 1 0x2555f20
(virt-viewer:24212): virt-viewer-DEBUG: Got libvirt credential request for 2 credential(s)
(virt-viewer:24212): virt-viewer-DEBUG: Return -1
(virt-viewer:24212): virt-viewer-DEBUG: Remove handle 1 12
(virt-viewer:24212): virt-viewer-DEBUG: Disposing window 0x23dd010

(virt-viewer:24212): virt-viewer-DEBUG: Disposing window 0x23dd0d0

(virt-viewer:24212): virt-viewer-DEBUG: Disposing window 0x23dd250

(virt-viewer:24212): virt-viewer-DEBUG: Disposing window 0x23dd190

(virt-viewer:24212): virt-viewer-DEBUG: Set connect info: (null),(null),(null),-1,(null),(null),(null),0

As the result, virt-viewer cannot connect the guest over tcp connection.

Comment 6 Fabiano Fidêncio 2014-10-09 14:10:19 UTC
I found the problem.
In the upstream code virt_viewer_auth_collect_credentials() returns a gboolean (0 as FALSE or !FALSE as TRUE) while in the downstream code it returns an integer (-1 as FALSE and 0 as TRUE).
Dunno what is better, fix the behavior of my patch downstream or backport the patch that added this change plus a few more adapting the code to the change.

Comment 8 CongDong 2014-10-31 08:34:12 UTC
I can reproduce with virt-viewer-0.6.0-5.el7.x86_64.rpm

VERIFY with virt-viewer-0.6.0-10.el7.x86_64

Steps:
1.On host A,set tcp server environment.
1.1 Edit /etc/sysconfig/libvirtd
       LIBVIRTD_ARGS="--listen"

1.2 Edit /etc/libvirt/libvirtd.conf
       listen_tls = 0
       listen_tcp=1
       auth_tcp="sasl"

1.3 Add a user named "fred", and setting his password as "redhat"
   # saslpasswd2 -a libvirt fred
   Password: xxxxxx
   Again (for verification): xxxxxx

1.4 Restart libvirtd service and set iptables.
# service libvirtd restart

#iptables -F

2. Prepare a spice guest on host A,set it's listen address as 0.0.0.0,the xml shows as below:
# virsh dumpxml $vm
    <graphics type='spice' port='5900' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

3. On host B, try to connect the guest on host A with virt-viewer
# virt-viewer -c qemu+tcp://10.66.7.56/system $vm

4. A login dialog will come out, input a wrong username or password, and click OK
5. Repeat Step 3, and click "Cancle" button when the dialog comes out
6, retry with right password and username

Result:
Step 4, 
Unable to connect to libvirt with URI: qemu+tcp://10.66.4.104/system.
Authentication failed.
Step 5, dilog close without error message
step 6, can connect the guest

As the result, set VERIFIED

Comment 10 errata-xmlrpc 2015-03-05 13:39:45 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/RHBA-2015-0295.html


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