Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 484680

Summary: /usr/bin/rhn-config-tnsnames.pl not needed in /etc/sudoers
Product: Red Hat Satellite 5 Reporter: Jan Pazdziora (Red Hat) <jpazdziora>
Component: ServerAssignee: Jan Pazdziora (Red Hat) <jpazdziora>
Status: CLOSED CURRENTRELEASE QA Contact: wes hayutin <whayutin>
Severity: medium Docs Contact:
Priority: low    
Version: 530CC: cperry, msuchy
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sat530 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-10 19:11:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 457079    

Description Jan Pazdziora (Red Hat) 2009-02-09 14:52:25 UTC
Description of problem:

The default installation of Satellite 5.3.0 adds /usr/bin/rhn-config-tnsnames.pl to alias INSTALL_RHN in /etc/sudoers.

I've grepped Spacewalk source and rhn-config-tnsnames appears to be called in two places -- in spacewalk/setup/lib/Spacewalk/Setup.pm, and in web/modules/rhn/RHN/SatInstall.pm. That Spacewalk::Setup is being used by root, so no sudo is needed (and called) there. That RHN::SatInstall calls

sub write_tnsnames {
  my $class = shift;
  my $sid = shift;
  my $addresses = shift;

  my @options;

  foreach my $line (@{$addresses}) {
    push @options, join(",", @{$line}{qw/protocol host port/});
  }

  my @opt_strings = map { "--address=$_" } @options;

  my $ret = system("/usr/bin/sudo", "/usr/bin/rhn-config-tnsnames.pl",
                   "--target=/etc/tnsnames.ora", "--sid=$sid", @opt_strings);

  if ($ret) {
    throw 'There was a problem updating the tnsnames.ora file.  '
      . 'See the webserver error log for details.';
  }

  return;
}

But the function write_tnsnames is not used in the whole Spacewalk codebase. Therefore I assume it is dead code which can be removed, and so can /usr/bin/rhn-config-tnsnames.pl from /etc/sudoers.

Note: I did this scan through our code to figure out if there are some commands that need additional SELinux treatment.

Version-Release number of selected component (if applicable):

Satellite-5.3.0-RHEL5-re20090206.1

How reproducible:

Deterministic.

Steps to Reproduce:
1. Install Satellite 5.3.0.
2. Look into /etc/sudoers.
  
Actual results:

/usr/bin/rhn-config-tnsnames.pl is there.

Expected results:

/usr/bin/rhn-config-tnsnames.pl is not there and Satellite continues to work OK.

Additional info:

Comment 1 Jan Pazdziora (Red Hat) 2009-02-10 12:25:20 UTC
The proposed change is to remove the INSTALL_RHN section and merge whatever needs to be there to CONFIG_RHN. The proposed sudoers.rhn is below. I've tested that with this, the Satellite/Spacewalk works and runs external commands fine.

## RHN specifics ##
Cmnd_Alias CONFIG_RHN = /usr/sbin/rhn-sat-restart-silent,\
                        /usr/bin/rhn-config-satellite.pl,\
                        /usr/bin/rhn-satellite-activate,\
                        /usr/bin/rhn-bootstrap,\
                        /usr/bin/rhn-ssl-tool,\
                        /usr/bin/rhn-ssl-dbstore,\
                        /usr/bin/rhn-load-ssl-cert.pl,\
                        /etc/rc.d/np.d/step Monitoring install,\
                        /etc/rc.d/np.d/step MonitoringScout install,\
                        /etc/rc.d/np.d/step Monitoring uninstall,\
                        /etc/rc.d/np.d/step MonitoringScout uninstall,\
                        /sbin/service Monitoring restart,\
                        /sbin/service MonitoringScout restart,\
                        /sbin/service taskomatic restart

# The CONFIG_RHN commands are required for reconfiguration of a
# running RHN Satellite.  They should be enabled for proper operation
# of the RHN Satellite.
apache  ALL=(root)      NOPASSWD: CONFIG_RHN
tomcat  ALL=(root)      NOPASSWD: CONFIG_RHN

# These two directives allow tomcat and apache to invoke CONFIG_RHN
# commands via sudo even without a real tty
Defaults:tomcat !requiretty
Defaults:apache !requiretty

Comment 2 Clifford Perry 2009-02-10 17:05:39 UTC
This is a throw back from the old Installer - where we had command line install laid down packages. The WebUI then went through configuration/installation of Satellite to get it running, with many many steps, unlike the new WebUI portion that just asks for Username/password to be created for Sat Admin account. 

Cliff.

Comment 3 Jan Pazdziora (Red Hat) 2009-02-11 07:25:56 UTC
Reassigning to myself as the bugzillas are not tracked against the SELinux feature.

Comment 4 Jan Pazdziora (Red Hat) 2009-02-11 07:28:01 UTC
The previous comment should have been "are *now*".

Comment 5 Jan Pazdziora (Red Hat) 2009-02-17 10:18:29 UTC
Committed to Spacewalk repo, 78a1de12fd2d22a652924586dea1e76bb11c1578 and 2ac4bf843521144a002c9d9caafec83908292512.

Comment 6 Jan Pazdziora (Red Hat) 2009-02-24 12:30:48 UTC
With compose Satellite-5.3.0-RHEL5-re20090220.1 available, moving ON_QA.

Comment 7 wes hayutin 2009-02-25 19:04:01 UTC
[root@grandprix ~]# cat /etc/sudoers | grep /usr/bin/rhn-config-tnsnames.pl
[root@grandprix ~]# 

verified 
 Satellite-5.3.0-RHEL5-re20090220.1-i386-embedded-oracle.iso

Comment 8 Miroslav Suchý 2009-08-26 09:28:46 UTC
[root@xen5 ~]# grep rhn-config-tnsnames.pl /etc/sudoers
[root@xen5 ~]#

satellite works fine

verified in stage on xen5

Comment 9 Brandon Perkins 2009-09-10 19:11:33 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html