Bug 616139 - sudo tgt-admin --dump => EOF
sudo tgt-admin --dump => EOF
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sudo (Show other bugs)
5.5
All Linux
low Severity medium
: rc
: ---
Assigned To: Daniel Kopeček
BaseOS QE Security Team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-19 14:09 EDT by François Cami
Modified: 2012-03-07 04:26 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-03-07 04:26:47 EST
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 14:09 EDT, François Cami
no flags Details

  None (edit)
Description François Cami 2010-07-19 14:09:50 EDT
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 14:11:01 EDT
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 05:19:37 EST
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 17:16:32 EST
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 16:04:13 EST
see bug 80215, I think this is more properly a sudo issue.
Comment 5 Daniel Kopeček 2012-03-07 04:26:47 EST
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.