/[gentoo-x86]/net-misc/openssh/openssh-6.7_p1-r4.ebuild
Gentoo

Contents of /net-misc/openssh/openssh-6.7_p1-r4.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Fri Feb 27 22:06:53 2015 UTC (4 years, 7 months ago) by chutzpah
Branch: MAIN
CVS Tags: HEAD
Add patch to fix crasher bug triggered on hardened x86_64 machines with USE=X509 and ancient clients.

(Portage version: 2.2.17/cvs/Linux x86_64, signed Manifest commit with key 0xE3F69979BB4B8928DA78E3D17CBF44EF)

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/openssh-6.7_p1-r3.ebuild,v 1.2 2014/12/31 07:29:47 vapier Exp $
4
5 EAPI="4"
6 inherit eutils user flag-o-matic multilib autotools pam systemd versionator
7
8 # Make it more portable between straight releases
9 # and _p? releases.
10 PARCH=${P/_}
11
12 HPN_PATCH="${PN}-6.7p1-hpnssh14v5.tar.xz"
13 LDAP_PATCH="${PN}-lpk-6.7p1-0.3.14.patch.xz"
14 X509_VER="8.2" X509_PATCH="${PARCH}+x509-${X509_VER}.diff.gz"
15
16 DESCRIPTION="Port of OpenBSD's free SSH release"
17 HOMEPAGE="http://www.openssh.org/"
18 SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz
19 mirror://gentoo/${P}-sctp.patch.xz
20 ${HPN_PATCH:+hpn? (
21 mirror://gentoo/${HPN_PATCH}
22 http://dev.gentoo.org/~vapier/dist/${HPN_PATCH}
23 mirror://sourceforge/hpnssh/${HPN_PATCH}
24 )}
25 ${LDAP_PATCH:+ldap? ( mirror://gentoo/${LDAP_PATCH} )}
26 ${X509_PATCH:+X509? ( http://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH} )}
27 "
28
29 LICENSE="BSD GPL-2"
30 SLOT="0"
31 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
32 IUSE="bindist ${HPN_PATCH:++}hpn kerberos kernel_linux ldap ldns libedit pam +pie sctp selinux skey static X X509"
33 REQUIRED_USE="pie? ( !static )"
34
35 LIB_DEPEND="sctp? ( net-misc/lksctp-tools[static-libs(+)] )
36 selinux? ( >=sys-libs/libselinux-1.28[static-libs(+)] )
37 skey? ( >=sys-auth/skey-1.1.5-r1[static-libs(+)] )
38 libedit? ( dev-libs/libedit[static-libs(+)] )
39 >=dev-libs/openssl-0.9.6d:0[bindist=]
40 dev-libs/openssl[static-libs(+)]
41 >=sys-libs/zlib-1.2.3[static-libs(+)]"
42 RDEPEND="
43 !static? (
44 ${LIB_DEPEND//\[static-libs(+)]}
45 ldns? (
46 !bindist? ( net-libs/ldns[ecdsa,ssl] )
47 bindist? ( net-libs/ldns[-ecdsa,ssl] )
48 )
49 )
50 pam? ( virtual/pam )
51 kerberos? ( virtual/krb5 )
52 ldap? ( net-nds/openldap )"
53 DEPEND="${RDEPEND}
54 static? (
55 ${LIB_DEPEND}
56 ldns? (
57 !bindist? ( net-libs/ldns[ecdsa,ssl,static-libs(+)] )
58 bindist? ( net-libs/ldns[-ecdsa,ssl,static-libs(+)] )
59 )
60 )
61 virtual/pkgconfig
62 virtual/os-headers
63 sys-devel/autoconf"
64 RDEPEND="${RDEPEND}
65 pam? ( >=sys-auth/pambase-20081028 )
66 userland_GNU? ( virtual/shadow )
67 X? ( x11-apps/xauth )"
68
69 S=${WORKDIR}/${PARCH}
70
71 pkg_setup() {
72 # this sucks, but i'd rather have people unable to `emerge -u openssh`
73 # than not be able to log in to their server any more
74 maybe_fail() { [[ -z ${!2} ]] && echo "$1" ; }
75 local fail="
76 $(use X509 && maybe_fail X509 X509_PATCH)
77 $(use ldap && maybe_fail ldap LDAP_PATCH)
78 $(use hpn && maybe_fail hpn HPN_PATCH)
79 "
80 fail=$(echo ${fail})
81 if [[ -n ${fail} ]] ; then
82 eerror "Sorry, but this version does not yet support features"
83 eerror "that you requested: ${fail}"
84 eerror "Please mask ${PF} for now and check back later:"
85 eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask"
86 die "booooo"
87 fi
88 }
89
90 save_version() {
91 # version.h patch conflict avoidence
92 mv version.h version.h.$1
93 cp -f version.h.pristine version.h
94 }
95
96 src_prepare() {
97 sed -i \
98 -e "/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:${EPREFIX}/usr/bin/xauth:" \
99 pathnames.h || die
100 # keep this as we need it to avoid the conflict between LPK and HPN changing
101 # this file.
102 cp version.h version.h.pristine
103
104 # don't break .ssh/authorized_keys2 for fun
105 sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die
106
107 epatch "${FILESDIR}"/${PN}-6.7_p1-sshd-gssapi-multihomed.patch #378361
108 if use X509 ; then
109 pushd .. >/dev/null
110 epatch "${FILESDIR}"/${P}-x509-glue.patch
111 epatch "${FILESDIR}"/${P}-sctp-x509-glue.patch
112 popd >/dev/null
113 epatch "${WORKDIR}"/${X509_PATCH%.*}
114 epatch "${FILESDIR}"/${PN}-6.3_p1-x509-hpn14v2-glue.patch
115 epatch "${FILESDIR}"/${PN}-6.7_p1-xmalloc-include.patch
116 save_version X509
117 fi
118 if ! use X509 ; then
119 if [[ -n ${LDAP_PATCH} ]] && use ldap ; then
120 epatch "${WORKDIR}"/${LDAP_PATCH%.*}
121 save_version LPK
122 fi
123 else
124 use ldap && ewarn "Sorry, X509 and LDAP conflict internally, disabling LDAP"
125 fi
126 epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
127 epatch "${FILESDIR}"/${PN}-6.7_p1-openssl-ignore-status.patch
128 epatch "${WORKDIR}"/${PN}-6.7_p1-sctp.patch
129 if [[ -n ${HPN_PATCH} ]] && use hpn; then
130 epatch "${WORKDIR}"/${HPN_PATCH%.*}/*
131 save_version HPN
132 fi
133
134 tc-export PKG_CONFIG
135 local sed_args=(
136 -e "s:-lcrypto:$(${PKG_CONFIG} --libs openssl):"
137 # Disable PATH reset, trust what portage gives us #254615
138 -e 's:^PATH=/:#PATH=/:'
139 # Disable fortify flags ... our gcc does this for us
140 -e 's:-D_FORTIFY_SOURCE=2::'
141 )
142 # The -ftrapv flag ICEs on hppa #505182
143 use hppa && sed_args+=(
144 -e '/CFLAGS/s:-ftrapv:-fdisable-this-test:'
145 -e '/OSSH_CHECK_CFLAG_LINK.*-ftrapv/d'
146 )
147 sed -i "${sed_args[@]}" configure{.ac,} || die
148
149 epatch_user #473004
150
151 # Now we can build a sane merged version.h
152 (
153 sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
154 macros=()
155 for p in HPN LPK X509 ; do [ -e version.h.${p} ] && macros+=( SSH_${p} ) ; done
156 printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros}"
157 ) > version.h
158
159 eautoreconf
160 }
161
162 static_use_with() {
163 local flag=$1
164 if use static && use ${flag} ; then
165 ewarn "Disabling '${flag}' support because of USE='static'"
166 # rebuild args so that we invert the first one (USE flag)
167 # but otherwise leave everything else working so we can
168 # just leverage use_with
169 shift
170 [[ -z $1 ]] && flag="${flag} ${flag}"
171 set -- !${flag} "$@"
172 fi
173 use_with "$@"
174 }
175
176 src_configure() {
177 local myconf=()
178 addwrite /dev/ptmx
179 addpredict /etc/skey/skeykeys #skey configure code triggers this
180
181 use static && append-ldflags -static
182
183 # Special settings for Gentoo/FreeBSD 9.0 or later (see bug #391011)
184 if use elibc_FreeBSD && version_is_at_least 9.0 "$(uname -r|sed 's/\(.\..\).*/\1/')" ; then
185 myconf+=( --disable-utmp --disable-wtmp --disable-wtmpx )
186 append-ldflags -lutil
187 fi
188
189 econf \
190 --with-ldflags="${LDFLAGS}" \
191 --disable-strip \
192 --with-pid-dir="${EPREFIX}"$(usex kernel_linux '' '/var')/run \
193 --sysconfdir="${EPREFIX}"/etc/ssh \
194 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/misc \
195 --datadir="${EPREFIX}"/usr/share/openssh \
196 --with-privsep-path="${EPREFIX}"/var/empty \
197 --with-privsep-user=sshd \
198 --with-md5-passwords \
199 --with-ssl-engine \
200 $(static_use_with pam) \
201 $(static_use_with kerberos kerberos5 "${EPREFIX}"/usr) \
202 ${LDAP_PATCH:+$(use X509 || ( use ldap && use_with ldap ))} \
203 $(use_with ldns) \
204 $(use_with libedit) \
205 $(use_with pie) \
206 $(use_with sctp) \
207 $(use_with selinux) \
208 $(use_with skey) \
209 "${myconf[@]}"
210 }
211
212 src_install() {
213 emake install-nokeys DESTDIR="${D}"
214 fperms 600 /etc/ssh/sshd_config
215 dobin contrib/ssh-copy-id
216 newinitd "${FILESDIR}"/sshd.rc6.4 sshd
217 newconfd "${FILESDIR}"/sshd.confd sshd
218 keepdir /var/empty
219
220 # not all openssl installs support ecc, or are functional #352645
221 if ! grep -q '#define OPENSSL_HAS_ECC 1' config.h ; then
222 elog "dev-libs/openssl was built with 'bindist' - disabling ecdsa support"
223 sed -i 's:&& gen_key ecdsa::' "${ED}"/etc/init.d/sshd || die
224 fi
225
226 newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
227 if use pam ; then
228 sed -i \
229 -e "/^#UsePAM /s:.*:UsePAM yes:" \
230 -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
231 -e "/^#PrintMotd /s:.*:PrintMotd no:" \
232 -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
233 "${ED}"/etc/ssh/sshd_config || die "sed of configuration file failed"
234 fi
235
236 # Gentoo tweaks to default config files
237 cat <<-EOF >> "${ED}"/etc/ssh/sshd_config
238
239 # Allow client to pass locale environment variables #367017
240 AcceptEnv LANG LC_*
241 EOF
242 cat <<-EOF >> "${ED}"/etc/ssh/ssh_config
243
244 # Send locale environment variables #367017
245 SendEnv LANG LC_*
246 EOF
247
248 # This instruction is from the HPN webpage,
249 # Used for the server logging functionality
250 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
251 keepdir /var/empty/dev
252 fi
253
254 if ! use X509 && [[ -n ${LDAP_PATCH} ]] && use ldap ; then
255 insinto /etc/openldap/schema/
256 newins openssh-lpk_openldap.schema openssh-lpk.schema
257 fi
258
259 doman contrib/ssh-copy-id.1
260 dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config
261
262 diropts -m 0700
263 dodir /etc/skel/.ssh
264
265 systemd_dounit "${FILESDIR}"/sshd.{service,socket}
266 systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service'
267 }
268
269 src_test() {
270 local t tests skipped failed passed shell
271 tests="interop-tests compat-tests"
272 skipped=""
273 shell=$(egetshell ${UID})
274 if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
275 elog "Running the full OpenSSH testsuite"
276 elog "requires a usable shell for the 'portage'"
277 elog "user, so we will run a subset only."
278 skipped="${skipped} tests"
279 else
280 tests="${tests} tests"
281 fi
282 # It will also attempt to write to the homedir .ssh
283 local sshhome=${T}/homedir
284 mkdir -p "${sshhome}"/.ssh
285 for t in ${tests} ; do
286 # Some tests read from stdin ...
287 HOMEDIR="${sshhome}" \
288 emake -k -j1 ${t} </dev/null \
289 && passed="${passed}${t} " \
290 || failed="${failed}${t} "
291 done
292 einfo "Passed tests: ${passed}"
293 ewarn "Skipped tests: ${skipped}"
294 if [[ -n ${failed} ]] ; then
295 ewarn "Failed tests: ${failed}"
296 die "Some tests failed: ${failed}"
297 else
298 einfo "Failed tests: ${failed}"
299 return 0
300 fi
301 }
302
303 pkg_preinst() {
304 enewgroup sshd 22
305 enewuser sshd 22 -1 /var/empty sshd
306 }
307
308 pkg_postinst() {
309 if has_version "<${CATEGORY}/${PN}-5.8_p1" ; then
310 elog "Starting with openssh-5.8p1, the server will default to a newer key"
311 elog "algorithm (ECDSA). You are encouraged to manually update your stored"
312 elog "keys list as servers update theirs. See ssh-keyscan(1) for more info."
313 fi
314 ewarn "Remember to merge your config files in /etc/ssh/ and then"
315 ewarn "reload sshd: '/etc/init.d/sshd reload'."
316 # This instruction is from the HPN webpage,
317 # Used for the server logging functionality
318 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
319 einfo "For the HPN server logging patch, you must ensure that"
320 einfo "your syslog application also listens at /var/empty/dev/log."
321 fi
322 elog "Note: openssh-6.7 versions no longer support USE=tcpd as upstream has"
323 elog " dropped it. Make sure to update any configs that you might have."
324 }

  ViewVC Help
Powered by ViewVC 1.1.20