Bug 616139 - sudo tgt-admin --dump => EOF
Summary: sudo tgt-admin --dump => EOF
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sudo   
(Show other bugs)
Version: 5.5
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Daniel Kopeček
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-07-19 18:09 UTC by François Cami
Modified: 2012-03-07 09:26 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-03-07 09:26:47 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
kickstart to help reproduce the problem (2.10 KB, text/plain)
2010-07-19 18:09 UTC, François Cami
no flags Details

Description François Cami 2010-07-19 18:09:50 UTC
Created attachment 432973 [details]
kickstart to help reproduce the problem

Description of problem:
`tgt-admin --dump` works fine (outputs the current tgtd configuration), but `sudo tgt-admin --dump` does not.

Version-Release number of selected component (if applicable):
scsi-target-utils-0.0-6.20091205snap.el5_4.1.x86_64
sudo-1.7.2p1-5.el5.x86_64
sudo-1.7.2p1-7.el5_5.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install RHEL5 with scsi-target-utils
2. configure a LUN with tgt-adm
3. use tgt-admin to dump configuration
4. use tgt-admin to dump configuration, with sudo
  
Actual results:
The first dump contains the configuration, the second (with sudo) does not.

Expected results:
Both outputs should be identical.

Additional info:
I am including a kickstart file to help reproduce the bug. The kickstart installs all the necessary packages and creates a shell script in /root to demonstrate the problem. The root password of the installed system is "testiscsi".
Note that I am not sure the problem comes from scsi-target-utils and not from sudo.

Comment 1 François Cami 2010-07-19 18:11:01 UTC
Sample output:

[root@localhost ~]# tgt-admin --dump
default-driver iscsi

<target iqn.2010-07.NET.YOURDOMAIN:storage.vm1.smh>
	backing-store /dev/tgtdtest/lun0
	initiator-address 192.168.1.0/24
</target>

[root@localhost ~]# sudo tgt-admin --dump
[root@localhost ~]#


The sudoers file includes the line:
root	ALL=(ALL) 	ALL

Comment 2 Mike Christie 2011-02-02 10:19:37 UTC
Sorry for the late response. I just saw this.

Try the current scsi-target-utils in RHEL 5.6.

Comment 3 Roland Friedwagner 2011-02-10 22:16:32 UTC
Funny one.

I confirm the bug/feature for RHEL 5.6::

  $ rpm -qf $(command -v tgt-admin)
  scsi-target-utils-1.0.8-0.el5
  $ tgt-admin --dump
  default-driver iscsi
  
  <target iqn.2008-09.com.redhat.example:tgt1>
          backing-store /dev/sda1
  </target>
  
  $ sudo tgt-admin --dump
  $

Reason is PATH Environment is reset by sudo to "/usr/bin:/bin"
So this all is the same::

  $ sudo tgt-admin --dump
  $ PATH=/usr/bin:/bin /usr/sbin/tgt-admin --dump
  $ sudo /usr/sbin/tgt-admin --dump
  $ sudo bash -c "/usr/sbin/tgt-admin --dump"

  # workaround (not really;):
  $ sudo PATH=/sbin:$PATH tgt-admin --dump
  default-driver iscsi
  
  <target iqn.2008-09.com.redhat.example:tgt1>
          backing-store /dev/sda1
  </target>

Comment 4 Andy Grover 2011-12-20 21:04:13 UTC
see bug 80215, I think this is more properly a sudo issue.

Comment 5 Daniel Kopeček 2012-03-07 09:26:47 UTC
Hello,

(In reply to comment #4)
> see bug 80215, I think this is more properly a sudo issue.

I don't consider this as a bug. You can change/set the path either by the workaround described above or using the secure_path Defaults option.


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