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 1356858 - The default uri should be libvirtd:///session in non-root session
Summary: The default uri should be libvirtd:///session in non-root session
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Erik Skultety
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-15 07:22 UTC by Fangge Jin
Modified: 2016-11-03 18:48 UTC (History)
6 users (show)

Fixed In Version: libvirt-2.0.0-5.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:48:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Fangge Jin 2016-07-15 07:22:51 UTC
Description of problem:
When logging in as non-root user, virt-admin connects to socket of system mode by default.

Version-Release number of selected component:
libvirt-2.0.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Log in as non-root user

2.
[fjin@localhost ~]$ virt-admin connect
error: Failed to connect to the admin server
Connected to the admin server
error: Failed to connect socket to '/var/run/libvirt/libvirt-admin-sock': Permission denied

Actual results:
When logging in as non-root user, virt-admin connects to socket of system mode by default.

Expected results:
When logging in as non-root user, virt-admin connects to socket: /home/fjin/.cache/libvirt/libvirt-admin-sock successfully:
$ virt-admin connect
Connected to the admin server


Additional info:
If specifying the connection uri in command line, it can be connected successfully
[fjin@localhost ~]$ virsh list
[fjin@localhost ~]$ virt-admin connect libvirtd:///session
Connected to the admin server

Comment 2 Erik Skultety 2016-08-09 15:00:46 UTC
The original patch pushed upstream: https://www.redhat.com/archives/libvir-list/2016-July/msg01233.html, but the issue was truly resolved by a follow-up commit:

commit 9e5e7f3a5b7a9a7325ad4ac719abd469cd7f8a45
Author:     Erik Skultety <eskultet>
AuthorDate: Tue Aug 9 13:57:41 2016 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Tue Aug 9 15:24:19 2016 +0200

    virt-admin: Properly fix the default session daemon URI to admin server
    
    Commit 30ce2f0e tried to fix the issue with an incorrect session URI to
    admin server but it messed up the checks:
    
        if (geteuid == 0 && VIR_STRDUP(*uristr, "libvirtd:///system") < 0)
            return -1;
        else if (VIR_STRDUP(*uristr, "libvirtd:///session") < 0)
            return -1;
    
    So if a client executed with root privileges tries to connect, its euid is
    checked (true) and the correct URI is successfully copied to @uristr
    (false), therefore the 'else' branch is taken and @uristr is replaced by
    the session URI which for root results in:
        Failed to connect socket to '/root/.cache/libvirt/libvirt-admin-sock':
        No such file or directory
    
    Signed-off-by: Erik Skultety <eskultet>

Comment 5 Lili Zhu 2016-08-24 06:19:40 UTC
Reproduce with libvirt-2.0.0-4.el7.x86_64

 Verified with the packages:

 libvirt-2.0.0-5.el7.x86_64 

Test steps:

1. Log in as non-root user

2.[lizhu@lizhu-testq ~]$ virt-admin "connect;uri"

Test results:

Connected to the admin server
libvirtd:///session

Comment 7 errata-xmlrpc 2016-11-03 18:48:53 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-2016-2577.html


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