Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#900612: apache2-suexec-pristine: Packaging steps undo setting of setuid bit

8 views
Skip to first unread message

Jason Perrin

unread,
Jun 1, 2018, 8:20:02 PM6/1/18
to
Package: apache2-suexec-pristine
Version: 2.4.25-3+deb9u4
Severity: normal
Tags: patch
Justification: fails to build from source (but built successfully in the past)

Dear Maintainer,

When building the apache2-suexec-pristine (and apache2-suexec-custom) packages
from source, I expected the built .deb packages to contain setuid binaries
(at /usr/lib/apache2/suexec-pristine and /usr/lib/apache2/suexec-custom
respectively). However, when packaging was done, the packages contained
binaries with the permissions 0754, not 4754, as set in the debian/rules file.

Looking into this more, it appears that chgrp (through the chown system call)
clears the setuid bit (and all bits in the first octet of permissions) when it
is run, so the steps in override_dh_fixperms-arch end up removing the setuid
bit when chgrp is run after chmod.

This appears to be a problem in the source for this package, on the master
branch, as well as on separate branches for different distros:
https://salsa.debian.org/apache-team/apache2/blob/master/debian/rules#L148-153
I'm not sure how this has worked properly to produce packages, since the last
change to that section was 6 years ago, so I'm a bit confused on that point.

Here is a patch to fix the setting of the setuid bit in both packages by just
moving the chmod to after chgrp has already run:

--- debian/rules
+++ debian/rules
@@ -146,11 +146,11 @@ override_dh_install: clean-config-vars-stamp \

override_dh_fixperms-arch:
# standard suexec
- chmod 4754 debian/apache2-suexec-pristine/usr/lib/apache2/suexec-pristine
chgrp www-data debian/apache2-suexec-pristine/usr/lib/apache2/suexec-pristine
+ chmod 4754 debian/apache2-suexec-pristine/usr/lib/apache2/suexec-pristine
# configurable suexec
- chmod 4754 debian/apache2-suexec-custom/usr/lib/apache2/suexec-custom
chgrp www-data debian/apache2-suexec-custom/usr/lib/apache2/suexec-custom
+ chmod 4754 debian/apache2-suexec-custom/usr/lib/apache2/suexec-custom
dh_fixperms -a -Xusr/lib/apache2/suexec-custom -Xusr/lib/apache2/suexec-pristine
chown -R www-data:www-data debian/apache2/var/cache/apache2/mod_cache_disk
chown root:adm debian/apache2/var/log/apache2


-- System Information:
Debian Release: 9.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-6-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Stefan Fritsch

unread,
Jun 2, 2018, 4:40:04 AM6/2/18
to
On Saturday, 2 June 2018 02:06:10 CEST Jason Perrin wrote:

> This appears to be a problem in the source for this package, on the master
> branch, as well as on separate branches for different distros:
> https://salsa.debian.org/apache-team/apache2/blob/master/debian/rules#L148-1
> 53 I'm not sure how this has worked properly to produce packages, since the
> last change to that section was 6 years ago, so I'm a bit confused on that
> point.


That's weird because it seems all distributed packages in the last 6 years
have the correct permissions. Do you build the package as root? Usually
packages are built as non-root user using fakeroot. Maybe fakeroot is not
being faithful to the real kernel behavior and hides the bug.

Cheers,
Stefan

Jason Perrin

unread,
Jun 2, 2018, 4:30:04 PM6/2/18
to
Hi Stefan,

You're absolutely right, I was building the package as root inside a
docker container, mostly as a one-off kind of build to add some
debugging information. I tried using fakeroot instead, and it masked
the problem as you mentioned, as the file at the end still has the
setuid bit, even though it has changed group (and the same happens if
the owner is changed):

jvperrin@fireball:~$ fakeroot /bin/bash
root@fireball:~# touch test.txt
root@fireball:~# ls -l test.txt
-rw-r--r-- 1 root root 0 Jun 2 13:08 test.txt
root@fireball:~# chmod 4754 test.txt
root@fireball:~# ls -l test.txt
-rwsr-xr-- 1 root root 0 Jun 2 13:08 test.txt*
root@fireball:~# chgrp nogroup test.txt
root@fireball:~# ls -l test.txt
-rwsr-xr-- 1 root nogroup 0 Jun 2 13:08 test.txt*

If I do the same without fakeroot, it loses the setuid bit (as it should):

jvperrin@fireball:~$ sudo -i
root@fireball:~# touch test.txt
root@fireball:~# ls -l test.txt
-rw-r--r-- 1 root root 0 Jun 2 13:11 test.txt
root@fireball:~# chmod 4754 test.txt
root@fireball:~# ls -l test.txt
-rwsr-xr-- 1 root root 0 Jun 2 13:11 test.txt*
root@fireball:~# chgrp nogroup test.txt
root@fireball:~# ls -l test.txt
-rwxr-xr-- 1 root nogroup 0 Jun 2 13:11 test.txt*

This suggests to me that this is indeed a problem with fakeroot, not
with this package, although I do still think the patch I included on
this bug report could be helpful as it wouldn't change the behavior
when it fakeroot and fixes the issue if anyone else is building
manually outside of fakeroot. Looking at fakeroot's bug reports, it's
already been reported almost a decade ago
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=497109). It hasn't
had any activity since then, so that's unfortunate, I'll try and
follow up there. Thank you for your help, that was very useful!

Dorian Kwiatkowski

unread,
Sep 27, 2021, 4:00:10 AM9/27/21
to
Dzień dobry,

kontaktuję się z Państwem, ponieważ dostrzegam możliwość redukcji opłat za prąd.

Odpowiednio dobrana instalacja fotowoltaiczna to rozwiązanie, które pozwala wygenerować spore oszczędności w skali roku.

Chciałbym porozmawiać z Państwem o tego typu rozwiązaniu, a także przedstawić wstępne kalkulacje.

Czy są Państwo zainteresowani?

Pozdrawiam,
Dorian Kwiatkowski

Patryk Górecki

unread,
Oct 14, 2021, 4:00:06 AM10/14/21
to
Dzień dobry,

jakiś czas temu zgłosiła się do nas firma, której strona internetowa nie pozycjonowała się wysoko w wyszukiwarce Google.

Na podstawie wykonanego przez nas audytu SEO zoptymalizowaliśmy treści na stronie pod kątem wcześniej opracowanych słów kluczowych. Nasz wewnętrzny system codziennie analizuje prawidłowe działanie witryny. Dzięki indywidualnej strategii, firma zdobywa coraz więcej Klientów.

Czy chcieliby Państwo zwiększyć liczbę osób odwiedzających stronę internetową firmy? Mógłbym przedstawić ofertę?


Pozdrawiam serdecznie,
Patryk Górecki

Patryk Górecki

unread,
Oct 20, 2021, 4:00:05 AM10/20/21
to

Dawid Rowicki

unread,
Nov 8, 2021, 4:00:05 AM11/8/21
to
Dzień dobry!

Czy mógłbym przedstawić rozwiązanie, które umożliwia monitoring każdego auta w czasie rzeczywistym w tym jego pozycję, zużycie paliwa i przebieg?

Dodatkowo nasze narzędzie minimalizuje koszty utrzymania samochodów, skraca czas przejazdów, a także tworzenie planu tras czy dostaw.

Z naszej wiedzy i doświadczenia korzysta już ponad 49 tys. Klientów. Monitorujemy 809 000 pojazdów na całym świecie, co jest naszą najlepszą wizytówką.

Bardzo proszę o e-maila zwrotnego, jeśli moglibyśmy wspólnie omówić potencjał wykorzystania takiego rozwiązania w Państwa firmie.


Z poważaniem,
Dawid Rowicki

Adrian Ostojski

unread,
Nov 18, 2021, 4:20:04 AM11/18/21
to
Dzień dobry,

czy interesuje Państwa wymiana niezapłaconych przez Klientów faktur na gotówkę?

Pomagamy wszystkim przedsiębiorcom, którzy szukają gwarancji bezpieczeństwa i płynności finansowej.

Jeśli są Państwo otwarci na wstępną rozmowę w tym temacie proszę o odpowiedź.


Pozdrawiam,
Adrian Ostojski
Dyrektor Finansowy

Adam Furgalski

unread,
Dec 15, 2021, 4:00:03 AM12/15/21
to
Dzień dobry,

zapoznałem się z Państwa ofertą i z przyjemnością przyznaję, że przyciąga uwagę i zachęca do dalszych rozmów.

Pomyślałem, że może mógłbym mieć swój wkład w Państwa rozwój i pomóc dotrzeć z tą ofertą do większego grona odbiorców. Pozycjonuję strony www, dzięki czemu generują świetny ruch w sieci.

Możemy porozmawiać w najbliższym czasie?


Pozdrawiam
Adam Furgalski
0 new messages