Mercurial > dropbear
annotate debian/implicit @ 1930:299f4f19ba19
Add /usr/sbin and /sbin to default root PATH
When dropbear is used in a very restricted environment (such as in a
initrd), the default user shell is often also very restricted
and doesn't take care of setting the PATH so the user ends up
with the PATH set by dropbear. Unfortunately, dropbear always
sets "/usr/bin:/bin" as default PATH even for the root user
which should have /usr/sbin and /sbin too.
For a concrete instance of this problem, see the "Remote Unlocking"
section in this tutorial: https://paxswill.com/blog/2013/11/04/encrypted-raspberry-pi/
It speaks of a bug in the initramfs script because it's written "blkid"
instead of "/sbin/blkid"... this is just because the scripts from the
initramfs do not expect to have a PATH without the sbin directories and
because dropbear is not setting the PATH appropriately for the root user.
I'm thus suggesting to use the attached patch to fix this misbehaviour (I
did not test it, but it's easy enough). It might seem anecdotic but
multiple Kali users have been bitten by this.
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903403
author | Raphael Hertzog <hertzog@debian.org> |
---|---|
date | Mon, 09 Jul 2018 16:27:53 +0200 |
parents | 1857c2c551ea |
children |
rev | line source |
---|---|
327
1857c2c551ea
Bring in changes from Debian 0.48.1-1
Matt Johnston <matt@ucc.asn.au>
parents:
180
diff
changeset
|
1 # $Id: implicit,v 1.11 2005/11/29 21:57:55 pape Exp $ |
70
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
2 |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
3 .PHONY: deb-checkdir deb-checkuid |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
4 |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
5 deb-checkdir: |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
6 @test -e debian/control || sh -cx '! : wrong directory' |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
7 deb-checkuid: |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
8 @test "`id -u`" -eq 0 || sh -cx '! : need root privileges' |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
9 |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
10 %.deb: %.deb-docs %.deb-DEBIAN |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
11 @rm -f $*.deb $*.deb-checkdir $*.deb-docs $*.deb-docs-base \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
12 $*.deb-docs-docs $*.deb-docs-examples $*.deb-DEBIAN \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
13 $*.deb-DEBIAN-dir $*.deb-DEBIAN-scripts $*.deb-DEBIAN-md5sums |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
14 |
180
743fce568f49
Merge in Debian package changes from 0.45-3, grab the dbclient manpage
Matt Johnston <matt@ucc.asn.au>
parents:
70
diff
changeset
|
15 %.udeb: %.deb-DEBIAN |
743fce568f49
Merge in Debian package changes from 0.45-3, grab the dbclient manpage
Matt Johnston <matt@ucc.asn.au>
parents:
70
diff
changeset
|
16 @rm -f $*.deb $*.deb-checkdir $*.deb-DEBIAN $*.deb-DEBIAN-dir \ |
743fce568f49
Merge in Debian package changes from 0.45-3, grab the dbclient manpage
Matt Johnston <matt@ucc.asn.au>
parents:
70
diff
changeset
|
17 $*.deb-DEBIAN-scripts $*.deb-DEBIAN-md5sums |
743fce568f49
Merge in Debian package changes from 0.45-3, grab the dbclient manpage
Matt Johnston <matt@ucc.asn.au>
parents:
70
diff
changeset
|
18 |
70
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
19 %.deb-checkdir: |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
20 @test -d debian/$* || sh -cx '! : directory debian/$* missing' |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
21 @test "`id -u`" -eq 0 || sh -cx '! : need root privileges' |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
22 |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
23 %.deb-docs-base: |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
24 : implicit |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
25 @rm -f debian/$*/usr/share/doc/$*/* || : |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
26 @install -d -m0755 debian/$*/usr/share/doc/$* |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
27 : debian/$*/usr/share/doc/$*/ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
28 @sh -cx 'install -m0644 debian/copyright debian/$*/usr/share/doc/$*/' |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
29 @sh -cx 'install -m0644 debian/changelog \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
30 debian/$*/usr/share/doc/$*/changelog.Debian' |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
31 @test ! -r changelog || \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
32 sh -cx 'install -m0644 changelog debian/$*/usr/share/doc/$*/' |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
33 @test -r debian/$*/usr/share/doc/$*/changelog || \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
34 sh -cx 'mv debian/$*/usr/share/doc/$*/changelog.Debian \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
35 debian/$*/usr/share/doc/$*/changelog' |
180
743fce568f49
Merge in Debian package changes from 0.45-3, grab the dbclient manpage
Matt Johnston <matt@ucc.asn.au>
parents:
70
diff
changeset
|
36 @test -s debian/$*/usr/share/doc/$*/changelog || \ |
743fce568f49
Merge in Debian package changes from 0.45-3, grab the dbclient manpage
Matt Johnston <matt@ucc.asn.au>
parents:
70
diff
changeset
|
37 sh -cx 'rm -f debian/$*/usr/share/doc/$*/changelog' |
70
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
38 @gzip -9 debian/$*/usr/share/doc/$*/changelog* |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
39 %.deb-docs-docs: |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
40 @for i in `cat debian/$*.docs 2>/dev/null || :`; do \ |
327
1857c2c551ea
Bring in changes from Debian 0.48.1-1
Matt Johnston <matt@ucc.asn.au>
parents:
180
diff
changeset
|
41 if test -d $$i; then \ |
1857c2c551ea
Bring in changes from Debian 0.48.1-1
Matt Johnston <matt@ucc.asn.au>
parents:
180
diff
changeset
|
42 sh -cx "install -d -m0755 debian/$*/usr/share/doc/$*/$${i##*/}" && \ |
1857c2c551ea
Bring in changes from Debian 0.48.1-1
Matt Johnston <matt@ucc.asn.au>
parents:
180
diff
changeset
|
43 for j in $$i/*; do \ |
1857c2c551ea
Bring in changes from Debian 0.48.1-1
Matt Johnston <matt@ucc.asn.au>
parents:
180
diff
changeset
|
44 sh -cx "install -m0644 $$j \ |
1857c2c551ea
Bring in changes from Debian 0.48.1-1
Matt Johnston <matt@ucc.asn.au>
parents:
180
diff
changeset
|
45 debian/$*/usr/share/doc/$*/$${i##*/}/" || exit 1; \ |
1857c2c551ea
Bring in changes from Debian 0.48.1-1
Matt Johnston <matt@ucc.asn.au>
parents:
180
diff
changeset
|
46 done || exit 1; \ |
1857c2c551ea
Bring in changes from Debian 0.48.1-1
Matt Johnston <matt@ucc.asn.au>
parents:
180
diff
changeset
|
47 continue; \ |
1857c2c551ea
Bring in changes from Debian 0.48.1-1
Matt Johnston <matt@ucc.asn.au>
parents:
180
diff
changeset
|
48 fi; \ |
70
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
49 sh -cx "install -m0644 $$i debian/$*/usr/share/doc/$*/" || exit 1; \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
50 done |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
51 @test ! -r debian/$*.README.Debian || \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
52 sh -cx 'install -m0644 debian/$*.README.Debian \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
53 debian/$*/usr/share/doc/$*/README.Debian' |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
54 @if test -r debian/$*.NEWS.Debian; then \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
55 sh -cx 'install -m0644 debian/$*.NEWS.Debian \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
56 debian/$*/usr/share/doc/$*/NEWS.Debian && \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
57 gzip -9 debian/$*/usr/share/doc/$*/NEWS.Debian'; \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
58 fi |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
59 %.deb-docs-examples: |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
60 @rm -rf debian/$*/usr/share/doc/$*/examples |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
61 : debian/$*/usr/share/doc/$*/examples/ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
62 @test ! -r debian/$*.examples || \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
63 install -d -m0755 debian/$*/usr/share/doc/$*/examples |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
64 @for i in `cat debian/$*.examples 2>/dev/null || :`; do \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
65 sh -cx "install -m0644 $$i debian/$*/usr/share/doc/$*/examples/" \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
66 || exit 1; \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
67 done |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
68 %.deb-docs: %.deb-checkdir %.deb-docs-base %.deb-docs-docs %.deb-docs-examples |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
69 : debian/$*/usr/share/doc/$*/ ok |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
70 |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
71 %.deb-DEBIAN-base: |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
72 @rm -rf debian/$*/DEBIAN |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
73 : debian/$*/DEBIAN/ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
74 @install -d -m0755 debian/$*/DEBIAN |
180
743fce568f49
Merge in Debian package changes from 0.45-3, grab the dbclient manpage
Matt Johnston <matt@ucc.asn.au>
parents:
70
diff
changeset
|
75 @for i in conffiles shlibs templates; do \ |
70
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
76 test ! -r debian/$*.$$i || \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
77 sh -cx "install -m0644 debian/$*.$$i debian/$*/DEBIAN/$$i" \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
78 || exit 1; \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
79 done |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
80 %.deb-DEBIAN-scripts: |
180
743fce568f49
Merge in Debian package changes from 0.45-3, grab the dbclient manpage
Matt Johnston <matt@ucc.asn.au>
parents:
70
diff
changeset
|
81 @for i in preinst prerm postinst postrm config; do \ |
70
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
82 test ! -r debian/$*.$$i || \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
83 sh -cx "install -m0755 debian/$*.$$i debian/$*/DEBIAN/$$i" \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
84 || exit 1; \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
85 done |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
86 %.deb-DEBIAN-md5sums: |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
87 : debian/$*/DEBIAN/md5sums |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
88 @rm -f debian/$*/DEBIAN/md5sums |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
89 @cd debian/$* && find * -path 'DEBIAN' -prune -o \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
90 -type f -exec md5sum {} >>DEBIAN/md5sums \; |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
91 %.deb-DEBIAN: %.deb-checkdir %.deb-DEBIAN-base %.deb-DEBIAN-scripts \ |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
92 %.deb-DEBIAN-md5sums |
b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
93 : debian/$*/DEBIAN/ ok |