Package: dbar
Version: 0.0.20100524-2
Severity: important
Tags: patch

Dear Maintainer,

The CPPFLAGS/LDFLAGS hardening flags are missing because they are
not set in debian/rules

DEB_*_MAINT_APPEND is the preferred way to set additional flags
(see man dpkg-buildflags for more information). For more
hardening information please have a look at [1], [2] and [3].

The following patch fixes the issue, buildflags.mk is not
necessary with compat=9.

diff -Nru dbar-0.0.20100524/debian/rules dbar-0.0.20100524/debian/rules
--- dbar-0.0.20100524/debian/rules      2012-02-11 22:16:53.000000000 +0100
+++ dbar-0.0.20100524/debian/rules      2012-03-22 16:55:16.000000000 +0100
@@ -2,16 +2,14 @@
 
 PACKAGE = dbar
 
-include /usr/share/dpkg/buildflags.mk
-CFLAGS += -Wall -pedantic
-LDFLAGS += -Wl,--as-needed
-export CFLAGS LDFLAGS
+DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
+DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
 man:
        $(MAKE) -C debian -f pod2man.mk PACKAGE=$(PACKAGE) makeman
 
 override_dh_auto_build: man
-       $(CC) $(CFLAGS) *.c -o $(PACKAGE)
+       $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) *.c -o $(PACKAGE)
 
 %:
        dh  $@

To check if all flags were correctly enabled you can use
`hardening-check` from the hardening-includes package and check
the build log (hardening-check doesn't catch everything):

    $ hardening-check /usr/bin/dbar
    /usr/bin/dbar:
     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!

(Position Independent Executable and Immediate binding is not
enabled by default.)

Use find -type f \( -executable -o -name \*.so\* \) -exec
hardening-check {} + on the build result to check all files.

Regards,
Simon

[1]: https://wiki.debian.org/ReleaseGoals/SecurityHardeningBuildFlags
[2]: https://wiki.debian.org/HardeningWalkthrough
[3]: https://wiki.debian.org/Hardening
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

Attachment: signature.asc
Description: Digital signature

Reply via email to