Bug 965536

Summary: nagios-plugins package should be built with PIE flags
Product: [Fedora] Fedora Reporter: Dhiru Kholia <dkholia>
Component: nagios-pluginsAssignee: Jose Pedro Oliveira <jose.p.oliveira.oss>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: bressers, jose.p.oliveira.oss, lemenkov, linux, ondrejj
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nagios-plugins-1.4.16-7.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-01 02:24:54 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:

Description Dhiru Kholia 2013-05-21 10:40:16 UTC
Description of problem:

http://fedoraproject.org/wiki/Packaging:Guidelines#PIE says that "you MUST
enable the PIE compiler flags if your package has suid binaries...".

However, currently nagios-plugins is not being built with PIE flags. This is a
clear violation of the packaging guidelines.

This issue (in its wider scope) is being discussed at,

https://fedorahosted.org/fesco/ticket/1104

https://lists.fedoraproject.org/pipermail/devel/2013-March/180827.html

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

nagios-plugins-dhcp-1.4.16-6.fc19.x86_64.rpm

How reproducible:

You can use following programs to check if a package is hardened:

http://people.redhat.com/sgrubb/files/rpm-chksec

OR

https://github.com/kholia/checksec

Steps to Reproduce:

Get scanner.py from https://github.com/kholia/checksec

$ ./scanner.py nagios-plugins-dhcp-1.4.16-6.fc19.x86_64.rpm
nagios-plugins-dhcp,nagios-plugins-dhcp-1.4.16-6.fc19.x86_64.rpm,/usr/lib64/nagios/plugins/check_dhcp,mode=0104750,NX=Enabled,CANARY=Enabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=Enabled,CATEGORY=network-ip

Comment 1 Jose Pedro Oliveira 2013-05-22 20:45:20 UTC
Just added

   %global _hardened_build 1

to the specfile.

This solves the problem for Fedora 18, 19, and rawhide but not for EPEL6.

Comment 2 Fedora Update System 2013-05-22 20:48:28 UTC
nagios-plugins-1.4.16-7.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/nagios-plugins-1.4.16-7.fc19

Comment 3 Fedora Update System 2013-05-22 20:49:11 UTC
nagios-plugins-1.4.16-7.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/nagios-plugins-1.4.16-7.fc18

Comment 4 Dhiru Kholia 2013-05-23 05:24:54 UTC
>> This solves the problem for Fedora 18, 19, and rawhide but not for EPEL6.

What happens under EPEL 6? Does the build fail? If yes, can you post more details?

Comment 5 Jose Pedro Oliveira 2013-05-23 06:16:25 UTC
(In reply to Dhiru Kholia from comment #4)
> >> This solves the problem for Fedora 18, 19, and rawhide but not for EPEL6.
> 
> What happens under EPEL 6? Does the build fail? If yes, can you post more
> details?

The EPEL6 build completes successfully but the definition
  "%global _hardened_build 1"
appears to be have no effect whatsoever.

Steps done:

 1 - downloaded the Fedora 20 SRPM from koji to a local mock builder (SL6.4)
     http://kojipkgs.fedoraproject.org//packages/nagios-plugins/1.4.16/7.fc20/src/nagios-plugins-1.4.16-7.fc20.src.rpm

 2 - used mock to build it for EPEL6 x86_64 (and i386)

 3 - rpmdev-extract ../nagios-plugins-dhcp-1.4.16-7.el6.x86_64.rpm

 4 - checksec.sh --file ./nagios-plugins-dhcp-1.4.16-7.el6.x86_64/usr/lib64/nagios/plugins/check_dhcp

     Reports:
     RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH      FILE
No RELRO        Canary found      NX enabled    No PIE  



Note: For the F18+ builds (Koji RPMs: http://koji.fedoraproject.org/koji/packageinfo?packageID=2594) checksec.sh reports PIE enabled:

$ checksec.sh --file ./nagios-plugins-dhcp-1.4.16-7.fc20.x86_64/usr/lib64/nagios/plugins/check_dhcp
RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH      FILE
Full RELRO      Canary found      NX enabled    PIE enabled     No RPATH   No RUNPATH   ./nagios-plugins-dhcp-1.4.16-7.fc20.x86_64/usr/lib64/nagios/plugins/check_dhcp

Comment 6 Jose Pedro Oliveira 2013-05-23 06:17:49 UTC
I forgot to mention that I have used the shell script checksec.sh downloaded from http://www.trapkit.de/tools/checksec.htm .

Comment 7 Fedora Update System 2013-05-23 12:32:22 UTC
Package nagios-plugins-1.4.16-7.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing nagios-plugins-1.4.16-7.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-8935/nagios-plugins-1.4.16-7.fc18
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2013-06-01 02:24:54 UTC
nagios-plugins-1.4.16-7.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2013-06-01 03:26:54 UTC
nagios-plugins-1.4.16-7.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.