1 |
commit: b268b306966b45a54da8a5573e09915e0ca92a96 |
2 |
Author: Raymond Jennings <shentino <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Oct 12 06:50:58 2017 +0000 |
4 |
Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 15 21:11:03 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b268b306 |
7 |
|
8 |
net-misc/bopm: fix security bug with pid file. |
9 |
|
10 |
In theory, someone who explots a hacked bopm could then use it to |
11 |
attack root owned processes. |
12 |
|
13 |
This puts the bopm-written PID file into a disposable junk directory |
14 |
and lets start-stop-daemon do all the grunt work. |
15 |
|
16 |
Bug: https://bugs.gentoo.org/631882 |
17 |
Closes: https://github.com/gentoo/gentoo/pull/5924 |
18 |
|
19 |
.../bopm/{bopm-3.1.3-r3.ebuild => bopm-3.1.3-r4.ebuild} | 3 ++- |
20 |
.../bopm/files/bopm-3.1.3-quarantine-bad-pid-file.patch | 16 ++++++++++++++++ |
21 |
net-misc/bopm/files/{bopm.init.d-r1 => bopm.init.d-r2} | 4 +++- |
22 |
3 files changed, 21 insertions(+), 2 deletions(-) |
23 |
|
24 |
diff --git a/net-misc/bopm/bopm-3.1.3-r3.ebuild b/net-misc/bopm/bopm-3.1.3-r4.ebuild |
25 |
similarity index 93% |
26 |
rename from net-misc/bopm/bopm-3.1.3-r3.ebuild |
27 |
rename to net-misc/bopm/bopm-3.1.3-r4.ebuild |
28 |
index 5e306a50271..5c2096926f2 100644 |
29 |
--- a/net-misc/bopm/bopm-3.1.3-r3.ebuild |
30 |
+++ b/net-misc/bopm/bopm-3.1.3-r4.ebuild |
31 |
@@ -20,6 +20,7 @@ DEPEND="${RDEPEND}" |
32 |
PATCHES=( |
33 |
"${FILESDIR}"/${P}-remove-njabl.patch |
34 |
"${FILESDIR}"/${P}-autotools.patch |
35 |
+ "${FILESDIR}"/${P}-quarantine-bad-pid-file.patch |
36 |
) |
37 |
|
38 |
pkg_setup() { |
39 |
@@ -52,7 +53,7 @@ src_install() { |
40 |
# If anybody wants libopm, please install net-libs/libopm |
41 |
rm -r "${ED}"usr/$(get_libdir) "${ED}"usr/include || die |
42 |
|
43 |
- newinitd "${FILESDIR}"/bopm.init.d-r1 ${PN} |
44 |
+ newinitd "${FILESDIR}"/bopm.init.d-r2 ${PN} |
45 |
newconfd "${FILESDIR}"/bopm.conf.d-r1 ${PN} |
46 |
|
47 |
dodir /var/log/bopm |
48 |
|
49 |
diff --git a/net-misc/bopm/files/bopm-3.1.3-quarantine-bad-pid-file.patch b/net-misc/bopm/files/bopm-3.1.3-quarantine-bad-pid-file.patch |
50 |
new file mode 100644 |
51 |
index 00000000000..fedcd0980a0 |
52 |
--- /dev/null |
53 |
+++ b/net-misc/bopm/files/bopm-3.1.3-quarantine-bad-pid-file.patch |
54 |
@@ -0,0 +1,16 @@ |
55 |
+Bopm writes its own pid file, but this is handled by the init script via |
56 |
+openrc-run. |
57 |
+--- |
58 |
+diff --git a/bopm.conf.sample b/bopm.conf.sample |
59 |
+index e26dc17..fa5ce1d 100644 |
60 |
+--- a/bopm.conf.sample |
61 |
++++ b/bopm.conf.sample |
62 |
+@@ -9,7 +9,7 @@ options { |
63 |
+ * Full path and filename for storing the process ID of the running |
64 |
+ * BOPM. |
65 |
+ */ |
66 |
+- pidfile = "/run/bopm/bopm.pid"; |
67 |
++ pidfile = "/run/bopm/junk/bopm.pid"; |
68 |
+ |
69 |
+ /* |
70 |
+ * How many seconds to store the IP address of hosts which are |
71 |
|
72 |
diff --git a/net-misc/bopm/files/bopm.init.d-r1 b/net-misc/bopm/files/bopm.init.d-r2 |
73 |
similarity index 70% |
74 |
rename from net-misc/bopm/files/bopm.init.d-r1 |
75 |
rename to net-misc/bopm/files/bopm.init.d-r2 |
76 |
index 6a292f800be..de6d959b9f7 100644 |
77 |
--- a/net-misc/bopm/files/bopm.init.d-r1 |
78 |
+++ b/net-misc/bopm/files/bopm.init.d-r2 |
79 |
@@ -12,5 +12,7 @@ depend() { |
80 |
} |
81 |
|
82 |
start_pre() { |
83 |
- checkpath -o ${BOPM_UID} -d "$(dirname "${PIDFILE}")" |
84 |
+ checkpath -o 0:0 -d /run/bopm |
85 |
+ checkpath -o ${BOPM_UID} -d /run/bopm/junk |
86 |
+ checkpath -o ${BOPM_UID} -f /run/bopm/junk/bopm.pid |
87 |
} |