Bug 972692 - network-servcies should be a hardening build / RELRO / PIE
network-servcies should be a hardening build / RELRO / PIE
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: samba (Show other bugs)
18
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Guenther Deschner
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-10 08:17 EDT by Harald Reindl
Modified: 2013-07-24 20:47 EDT (History)
6 users (show)

See Also:
Fixed In Version: samba-4.0.7-2.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-24 20:42:35 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Harald Reindl 2013-06-10 08:17:31 EDT
[root@srv-rhsoft:~]$ hardening-check.sh /usr/sbin/smbd
RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH      FILE
Partial RELRO   Canary found      NX enabled    No PIE          RPATH      No RUNPATH   /usr/sbin/smbd
/usr/sbin/smbd:
 Position Independent Executable: no, normal executable!
 Stack protected: yes
 Fortify Source functions: yes (some protected functions found)
 Read-only relocations: yes
 Immediate binding: no, not found!
Comment 1 Andreas Schneider 2013-06-10 12:47:41 EDT
This will be fixed soon when Samba 4.0.7 is released.
Comment 2 Harald Reindl 2013-07-03 14:47:02 EDT
4.0.7 is PIE but still *not* full RELO
http://tk-blog.blogspot.co.at/2009/02/relro-not-so-well-known-memory.html

as maintainer of server-packages you should install 
"checksec" and "hardening-check" which are in the
Fedora repos for F18, F19 and F20

[root@srv-rhsoft:~]$ hardening-check /usr/sbin/smbd
/usr/sbin/smbd:
 Position Independent Executable: yes
 Stack protected: yes
 Fortify Source functions: yes (some protected functions found)
 Read-only relocations: yes
 Immediate binding: no, not found!

[root@srv-rhsoft:~]$ checksec --file /usr/sbin/smbd
RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH      FILE
Partial RELRO   Canary found      NX enabled    PIE enabled     RPATH      No RUNPATH   /usr/sbin/smbd
Comment 3 Andreas Schneider 2013-07-04 12:24:39 EDT
Ok, I will propose a patch for 4.0.8 to enable RELRO.
Comment 4 Harald Reindl 2013-07-04 12:29:11 EDT
thx, but this can be fixed in 99% of all cases in the RPM SPEC

export LDFLAGS="-Wl,-z,now -Wl,-z,relro,-z"
before %configure and you are mostly done

i am using this for any local maintained package as well as explicit CFLAGS for hardening with stronger options than Fedora defaults (httpd, php, dovecot, postfix, dbmail, trafficserver....) and i would like to use the fedota-samba apckages instead add it my "private builds"
Comment 5 Harald Reindl 2013-07-04 12:30:49 EDT
argh - errata

export LDFLAGS="-Wl,-z,now -Wl,-z,relro"
_____________________________________

the trailing ",z" came from copy&paste of my dovecot build

%build
export CFLAGS="%{optflags} -fPIC -fPIE -fstack-protector-all"
export CXXFLAGS="%{optflags} -fPIC -fPIE -fstack-protector-all"
export FFLAGS="%{optflags} -fPIC -fPIE -fstack-protector-all"
export CPPFLAGS="%{optflags} -fPIC -fPIE -fstack-protector-all"
export LDFLAGS="-Wl,-z,now -Wl,-z,relro,-z,noexecstack -pie"
export SH_LDFLAGS="-Wl,-z,now -Wl,-z,relro,-z,noexecstack -pie"
%configure.................
Comment 6 Fedora Update System 2013-07-16 07:40:50 EDT
samba-4.0.7-2.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/samba-4.0.7-2.fc19
Comment 7 Harald Reindl 2013-07-16 08:09:42 EDT
that looks much better (samba-4.0.7-2.fc18.x86_64)

[root@rh:~]$ hardening-check /usr/sbin/smbd 
/usr/sbin/smbd:
 Position Independent Executable: yes
 Stack protected: yes
 Fortify Source functions: yes (some protected functions found)
 Read-only relocations: yes
 Immediate binding: yes
Comment 8 Fedora Update System 2013-07-16 08:26:15 EDT
samba-4.0.7-2.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/samba-4.0.7-2.fc18
Comment 9 Andreas Schneider 2013-07-16 08:44:47 EDT
I've also added a patch upstream which checks if the linker supports it and enables it by default!
Comment 10 Fedora Update System 2013-07-16 23:02:44 EDT
Package samba-4.0.7-2.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing samba-4.0.7-2.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-13060/samba-4.0.7-2.fc19
then log in and leave karma (feedback).
Comment 11 Fedora Update System 2013-07-24 20:42:35 EDT
samba-4.0.7-2.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 12 Fedora Update System 2013-07-24 20:47:04 EDT
samba-4.0.7-2.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

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