1 |
commit: c1dd842d0104a10bfe6778597676aaa139f8d360 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Dec 10 19:05:40 2017 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 10 19:06:59 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1dd842d |
7 |
|
8 |
net-misc/rsync: Rev bump to add patch for CVE-2017-{17433,17434} |
9 |
|
10 |
Bug: https://bugs.gentoo.org/640570 |
11 |
Package-Manager: Portage-2.3.16, Repoman-2.3.6 |
12 |
|
13 |
.../files/rsync-3.1.2-CVE-2017-17433-fixup.patch | 33 ++++++++ |
14 |
.../rsync/files/rsync-3.1.2-CVE-2017-17433.patch | 39 +++++++++ |
15 |
.../files/rsync-3.1.2-CVE-2017-17434-part1.patch | 22 +++++ |
16 |
.../files/rsync-3.1.2-CVE-2017-17434-part2.patch | 33 ++++++++ |
17 |
net-misc/rsync/rsync-3.1.2-r2.ebuild | 95 ++++++++++++++++++++++ |
18 |
5 files changed, 222 insertions(+) |
19 |
|
20 |
diff --git a/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17433-fixup.patch b/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17433-fixup.patch |
21 |
new file mode 100644 |
22 |
index 00000000000..0cc9b8256dd |
23 |
--- /dev/null |
24 |
+++ b/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17433-fixup.patch |
25 |
@@ -0,0 +1,33 @@ |
26 |
+From: Wayne Davison <wayned@×××××.org> |
27 |
+Date: Sun, 3 Dec 2017 23:49:56 +0000 (-0800) |
28 |
+Subject: Fix issue with earlier path-check (fixes "make check") |
29 |
+X-Git-Url: https://git.samba.org/?p=rsync.git;a=commitdiff_plain;h=f5e8a17e093065fb20fea00a29540fe2c7896441;hp=5509597decdbd7b91994210f700329d8a35e70a1 |
30 |
+ |
31 |
+Fix issue with earlier path-check (fixes "make check") |
32 |
+--- |
33 |
+ |
34 |
+diff --git a/receiver.c b/receiver.c |
35 |
+index 9c46242..75cb00d 100644 |
36 |
+--- a/receiver.c |
37 |
++++ b/receiver.c |
38 |
+@@ -574,15 +574,15 @@ int recv_files(int f_in, int f_out, char *local_name) |
39 |
+ file = dir_flist->files[cur_flist->parent_ndx]; |
40 |
+ fname = local_name ? local_name : f_name(file, fbuf); |
41 |
+ |
42 |
+- if (daemon_filter_list.head |
43 |
+- && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) { |
44 |
++ if (DEBUG_GTE(RECV, 1)) |
45 |
++ rprintf(FINFO, "recv_files(%s)\n", fname); |
46 |
++ |
47 |
++ if (daemon_filter_list.head && (*fname != '.' || fname[1] != '\0') |
48 |
++ && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) { |
49 |
+ rprintf(FERROR, "attempt to hack rsync failed.\n"); |
50 |
+ exit_cleanup(RERR_PROTOCOL); |
51 |
+ } |
52 |
+ |
53 |
+- if (DEBUG_GTE(RECV, 1)) |
54 |
+- rprintf(FINFO, "recv_files(%s)\n", fname); |
55 |
+- |
56 |
+ #ifdef SUPPORT_XATTRS |
57 |
+ if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && do_xfers |
58 |
+ && !(want_xattr_optim && BITS_SET(iflags, ITEM_XNAME_FOLLOWS|ITEM_LOCAL_CHANGE))) |
59 |
|
60 |
diff --git a/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17433.patch b/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17433.patch |
61 |
new file mode 100644 |
62 |
index 00000000000..0ab8de1fce3 |
63 |
--- /dev/null |
64 |
+++ b/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17433.patch |
65 |
@@ -0,0 +1,39 @@ |
66 |
+From 3e06d40029cfdce9d0f73d87cfd4edaf54be9c51 Mon Sep 17 00:00:00 2001 |
67 |
+From: Jeriko One <jeriko.one@×××.us> |
68 |
+Date: Thu, 2 Nov 2017 23:44:19 -0700 |
69 |
+Subject: [PATCH] Check fname in recv_files sooner. |
70 |
+ |
71 |
+--- |
72 |
+ receiver.c | 12 ++++++------ |
73 |
+ 1 file changed, 6 insertions(+), 6 deletions(-) |
74 |
+ |
75 |
+Index: rsync-3.1.2/receiver.c |
76 |
+=================================================================== |
77 |
+--- rsync-3.1.2.orig/receiver.c |
78 |
++++ rsync-3.1.2/receiver.c |
79 |
+@@ -580,6 +580,12 @@ int recv_files(int f_in, int f_out, char |
80 |
+ file = dir_flist->files[cur_flist->parent_ndx]; |
81 |
+ fname = local_name ? local_name : f_name(file, fbuf); |
82 |
+ |
83 |
++ if (daemon_filter_list.head |
84 |
++ && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) { |
85 |
++ rprintf(FERROR, "attempt to hack rsync failed.\n"); |
86 |
++ exit_cleanup(RERR_PROTOCOL); |
87 |
++ } |
88 |
++ |
89 |
+ if (DEBUG_GTE(RECV, 1)) |
90 |
+ rprintf(FINFO, "recv_files(%s)\n", fname); |
91 |
+ |
92 |
+@@ -651,12 +657,6 @@ int recv_files(int f_in, int f_out, char |
93 |
+ |
94 |
+ cleanup_got_literal = 0; |
95 |
+ |
96 |
+- if (daemon_filter_list.head |
97 |
+- && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) { |
98 |
+- rprintf(FERROR, "attempt to hack rsync failed.\n"); |
99 |
+- exit_cleanup(RERR_PROTOCOL); |
100 |
+- } |
101 |
+- |
102 |
+ if (read_batch) { |
103 |
+ int wanted = redoing |
104 |
+ ? we_want_redo(ndx) |
105 |
|
106 |
diff --git a/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17434-part1.patch b/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17434-part1.patch |
107 |
new file mode 100644 |
108 |
index 00000000000..aeb8c2ee33c |
109 |
--- /dev/null |
110 |
+++ b/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17434-part1.patch |
111 |
@@ -0,0 +1,22 @@ |
112 |
+From 5509597decdbd7b91994210f700329d8a35e70a1 Mon Sep 17 00:00:00 2001 |
113 |
+From: Jeriko One <jeriko.one@×××.us> |
114 |
+Date: Thu, 16 Nov 2017 17:26:03 -0800 |
115 |
+Subject: [PATCH] Check daemon filter against fnamecmp in recv_files(). |
116 |
+ |
117 |
+--- |
118 |
+ receiver.c | 2 +- |
119 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
120 |
+ |
121 |
+Index: rsync-3.1.2/receiver.c |
122 |
+=================================================================== |
123 |
+--- rsync-3.1.2.orig/receiver.c |
124 |
++++ rsync-3.1.2/receiver.c |
125 |
+@@ -728,7 +728,7 @@ int recv_files(int f_in, int f_out, char |
126 |
+ break; |
127 |
+ } |
128 |
+ if (!fnamecmp || (daemon_filter_list.head |
129 |
+- && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0)) { |
130 |
++ && check_filter(&daemon_filter_list, FLOG, fnamecmp, 0) < 0)) { |
131 |
+ fnamecmp = fname; |
132 |
+ fnamecmp_type = FNAMECMP_FNAME; |
133 |
+ } |
134 |
|
135 |
diff --git a/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17434-part2.patch b/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17434-part2.patch |
136 |
new file mode 100644 |
137 |
index 00000000000..5b94efa0c1a |
138 |
--- /dev/null |
139 |
+++ b/net-misc/rsync/files/rsync-3.1.2-CVE-2017-17434-part2.patch |
140 |
@@ -0,0 +1,33 @@ |
141 |
+From 70aeb5fddd1b2f8e143276f8d5a085db16c593b9 Mon Sep 17 00:00:00 2001 |
142 |
+From: Jeriko One <jeriko.one@×××.us> |
143 |
+Date: Thu, 16 Nov 2017 17:05:42 -0800 |
144 |
+Subject: [PATCH] Sanitize xname in read_ndx_and_attrs. |
145 |
+ |
146 |
+--- |
147 |
+ rsync.c | 6 ++++++ |
148 |
+ 1 file changed, 6 insertions(+) |
149 |
+ |
150 |
+Index: rsync-3.1.2/rsync.c |
151 |
+=================================================================== |
152 |
+--- rsync-3.1.2.orig/rsync.c |
153 |
++++ rsync-3.1.2/rsync.c |
154 |
+@@ -50,6 +50,7 @@ extern int flist_eof; |
155 |
+ extern int file_old_total; |
156 |
+ extern int keep_dirlinks; |
157 |
+ extern int make_backups; |
158 |
++extern int sanitize_paths; |
159 |
+ extern struct file_list *cur_flist, *first_flist, *dir_flist; |
160 |
+ extern struct chmod_mode_struct *daemon_chmod_modes; |
161 |
+ #ifdef ICONV_OPTION |
162 |
+@@ -397,6 +398,11 @@ int read_ndx_and_attrs(int f_in, int f_o |
163 |
+ if (iflags & ITEM_XNAME_FOLLOWS) { |
164 |
+ if ((len = read_vstring(f_in, buf, MAXPATHLEN)) < 0) |
165 |
+ exit_cleanup(RERR_PROTOCOL); |
166 |
++ |
167 |
++ if (sanitize_paths) { |
168 |
++ sanitize_path(buf, buf, "", 0, SP_DEFAULT); |
169 |
++ len = strlen(buf); |
170 |
++ } |
171 |
+ } else { |
172 |
+ *buf = '\0'; |
173 |
+ len = -1; |
174 |
|
175 |
diff --git a/net-misc/rsync/rsync-3.1.2-r2.ebuild b/net-misc/rsync/rsync-3.1.2-r2.ebuild |
176 |
new file mode 100644 |
177 |
index 00000000000..d91316b29b7 |
178 |
--- /dev/null |
179 |
+++ b/net-misc/rsync/rsync-3.1.2-r2.ebuild |
180 |
@@ -0,0 +1,95 @@ |
181 |
+# Copyright 1999-2017 Gentoo Foundation |
182 |
+# Distributed under the terms of the GNU General Public License v2 |
183 |
+ |
184 |
+EAPI="6" |
185 |
+ |
186 |
+inherit eutils flag-o-matic prefix systemd |
187 |
+ |
188 |
+DESCRIPTION="File transfer program to keep remote files into sync" |
189 |
+HOMEPAGE="https://rsync.samba.org/" |
190 |
+SRC_URI="https://rsync.samba.org/ftp/rsync/src/${P}.tar.gz" |
191 |
+[[ "${PV}" = *_pre* ]] && SRC_URI="https://rsync.samba.org/ftp/rsync/src-previews/${P/_/}.tar.gz" |
192 |
+ |
193 |
+LICENSE="GPL-3" |
194 |
+SLOT="0" |
195 |
+if [[ ${PV} != *_pre ]] ; then |
196 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
197 |
+fi |
198 |
+IUSE="acl examples iconv ipv6 static stunnel xattr" |
199 |
+ |
200 |
+LIB_DEPEND="acl? ( virtual/acl[static-libs(+)] ) |
201 |
+ xattr? ( kernel_linux? ( sys-apps/attr[static-libs(+)] ) ) |
202 |
+ >=dev-libs/popt-1.5[static-libs(+)]" |
203 |
+RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} ) |
204 |
+ iconv? ( virtual/libiconv )" |
205 |
+DEPEND="${RDEPEND} |
206 |
+ static? ( ${LIB_DEPEND} )" |
207 |
+ |
208 |
+PATCHES=( |
209 |
+ "${FILESDIR}"/${PN}-3.1.2-CVE-2017-16548.patch |
210 |
+ "${FILESDIR}"/${PN}-3.1.2-CVE-2017-17433.patch |
211 |
+ "${FILESDIR}"/${PN}-3.1.2-CVE-2017-17434-part1.patch |
212 |
+ "${FILESDIR}"/${PN}-3.1.2-CVE-2017-17434-part2.patch |
213 |
+ "${FILESDIR}"/${PN}-3.1.2-CVE-2017-17433-fixup.patch |
214 |
+) |
215 |
+ |
216 |
+S=${WORKDIR}/${P/_/} |
217 |
+ |
218 |
+src_configure() { |
219 |
+ use static && append-ldflags -static |
220 |
+ econf \ |
221 |
+ --without-included-popt \ |
222 |
+ $(use_enable acl acl-support) \ |
223 |
+ $(use_enable xattr xattr-support) \ |
224 |
+ $(use_enable ipv6) \ |
225 |
+ $(use_enable iconv) \ |
226 |
+ --with-rsyncd-conf="${EPREFIX}"/etc/rsyncd.conf |
227 |
+ touch proto.h-tstamp #421625 |
228 |
+} |
229 |
+ |
230 |
+src_install() { |
231 |
+ emake DESTDIR="${D}" install |
232 |
+ newconfd "${FILESDIR}"/rsyncd.conf.d rsyncd |
233 |
+ newinitd "${FILESDIR}"/rsyncd.init.d-r1 rsyncd |
234 |
+ dodoc NEWS OLDNEWS README TODO tech_report.tex |
235 |
+ insinto /etc |
236 |
+ newins "${FILESDIR}"/rsyncd.conf-3.0.9-r1 rsyncd.conf |
237 |
+ |
238 |
+ insinto /etc/logrotate.d |
239 |
+ newins "${FILESDIR}"/rsyncd.logrotate rsyncd |
240 |
+ |
241 |
+ insinto /etc/xinetd.d |
242 |
+ newins "${FILESDIR}"/rsyncd.xinetd-3.0.9-r1 rsyncd |
243 |
+ |
244 |
+ # Install stunnel helpers |
245 |
+ if use stunnel ; then |
246 |
+ emake DESTDIR="${D}" install-ssl-client |
247 |
+ emake DESTDIR="${D}" install-ssl-daemon |
248 |
+ fi |
249 |
+ |
250 |
+ # Install the useful contrib scripts |
251 |
+ if use examples ; then |
252 |
+ exeinto /usr/share/rsync |
253 |
+ doexe support/* |
254 |
+ rm -f "${ED}"/usr/share/rsync/{Makefile*,*.c} |
255 |
+ fi |
256 |
+ |
257 |
+ eprefixify "${ED}"/etc/{,xinetd.d}/rsyncd* |
258 |
+ |
259 |
+ systemd_dounit "${FILESDIR}/rsyncd.service" |
260 |
+} |
261 |
+ |
262 |
+pkg_postinst() { |
263 |
+ if egrep -qis '^[[:space:]]use chroot[[:space:]]*=[[:space:]]*(no|0|false)' \ |
264 |
+ "${EROOT}"/etc/rsyncd.conf "${EROOT}"/etc/rsync/rsyncd.conf ; then |
265 |
+ ewarn "You have disabled chroot support in your rsyncd.conf. This" |
266 |
+ ewarn "is a security risk which you should fix. Please check your" |
267 |
+ ewarn "/etc/rsyncd.conf file and fix the setting 'use chroot'." |
268 |
+ fi |
269 |
+ if use stunnel ; then |
270 |
+ einfo "Please install \">=net-misc/stunnel-4\" in order to use stunnel feature." |
271 |
+ einfo |
272 |
+ einfo "You maybe have to update the certificates configured in" |
273 |
+ einfo "${EROOT}/etc/stunnel/rsync.conf" |
274 |
+ fi |
275 |
+} |