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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Wed Jul 1 20:55:01 2015 UTC (4 years, 3 months ago) by polynomial-c
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Security bump (bug #553724). Removed old

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

1 # Copyright 1999-2014 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 save_version X509
116 fi
117 if ! use X509 ; then
118 if [[ -n ${LDAP_PATCH} ]] && use ldap ; then
119 epatch "${WORKDIR}"/${LDAP_PATCH%.*}
120 save_version LPK
121 fi
122 else
123 use ldap && ewarn "Sorry, X509 and LDAP conflict internally, disabling LDAP"
124 fi
125 epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
126 epatch "${FILESDIR}"/${PN}-6.7_p1-openssl-ignore-status.patch
127 epatch "${WORKDIR}"/${PN}-6.7_p1-sctp.patch
128 if [[ -n ${HPN_PATCH} ]] && use hpn; then
129 epatch "${WORKDIR}"/${HPN_PATCH%.*}/*
130 save_version HPN
131 fi
132
133 tc-export PKG_CONFIG
134 local sed_args=(
135 -e "s:-lcrypto:$(${PKG_CONFIG} --libs openssl):"
136 # Disable PATH reset, trust what portage gives us #254615
137 -e 's:^PATH=/:#PATH=/:'
138 # Disable fortify flags ... our gcc does this for us
139 -e 's:-D_FORTIFY_SOURCE=2::'
140 )
141 # The -ftrapv flag ICEs on hppa #505182
142 use hppa && sed_args+=(
143 -e '/CFLAGS/s:-ftrapv:-fdisable-this-test:'
144 -e '/OSSH_CHECK_CFLAG_LINK.*-ftrapv/d'
145 )
146 sed -i "${sed_args[@]}" configure{.ac,} || die
147
148 epatch_user #473004
149
150 # Now we can build a sane merged version.h
151 (
152 sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
153 macros=()
154 for p in HPN LPK X509 ; do [ -e version.h.${p} ] && macros+=( SSH_${p} ) ; done
155 printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros}"
156 ) > version.h
157
158 eautoreconf
159 }
160
161 static_use_with() {
162 local flag=$1
163 if use static && use ${flag} ; then
164 ewarn "Disabling '${flag}' support because of USE='static'"
165 # rebuild args so that we invert the first one (USE flag)
166 # but otherwise leave everything else working so we can
167 # just leverage use_with
168 shift
169 [[ -z $1 ]] && flag="${flag} ${flag}"
170 set -- !${flag} "$@"
171 fi
172 use_with "$@"
173 }
174
175 src_configure() {
176 local myconf=()
177 addwrite /dev/ptmx
178 addpredict /etc/skey/skeykeys #skey configure code triggers this
179
180 use static && append-ldflags -static
181
182 # Special settings for Gentoo/FreeBSD 9.0 or later (see bug #391011)
183 if use elibc_FreeBSD && version_is_at_least 9.0 "$(uname -r|sed 's/\(.\..\).*/\1/')" ; then
184 myconf+=( --disable-utmp --disable-wtmp --disable-wtmpx )
185 append-ldflags -lutil
186 fi
187
188 econf \
189 --with-ldflags="${LDFLAGS}" \
190 --disable-strip \
191 --with-pid-dir="${EPREFIX}"$(usex kernel_linux '' '/var')/run \
192 --sysconfdir="${EPREFIX}"/etc/ssh \
193 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/misc \
194 --datadir="${EPREFIX}"/usr/share/openssh \
195 --with-privsep-path="${EPREFIX}"/var/empty \
196 --with-privsep-user=sshd \
197 --with-md5-passwords \
198 --with-ssl-engine \
199 $(static_use_with pam) \
200 $(static_use_with kerberos kerberos5 "${EPREFIX}"/usr) \
201 ${LDAP_PATCH:+$(use X509 || ( use ldap && use_with ldap ))} \
202 $(use_with ldns) \
203 $(use_with libedit) \
204 $(use_with pie) \
205 $(use_with sctp) \
206 $(use_with selinux) \
207 $(use_with skey) \
208 "${myconf[@]}"
209 }
210
211 src_install() {
212 emake install-nokeys DESTDIR="${D}"
213 fperms 600 /etc/ssh/sshd_config
214 dobin contrib/ssh-copy-id
215 newinitd "${FILESDIR}"/sshd.rc6.4 sshd
216 newconfd "${FILESDIR}"/sshd.confd sshd
217 keepdir /var/empty
218
219 # not all openssl installs support ecc, or are functional #352645
220 if ! grep -q '#define OPENSSL_HAS_ECC 1' config.h ; then
221 elog "dev-libs/openssl was built with 'bindist' - disabling ecdsa support"
222 sed -i 's:&& gen_key ecdsa::' "${ED}"/etc/init.d/sshd || die
223 fi
224
225 newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
226 if use pam ; then
227 sed -i \
228 -e "/^#UsePAM /s:.*:UsePAM yes:" \
229 -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
230 -e "/^#PrintMotd /s:.*:PrintMotd no:" \
231 -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
232 "${ED}"/etc/ssh/sshd_config || die "sed of configuration file failed"
233 fi
234
235 # Gentoo tweaks to default config files
236 cat <<-EOF >> "${ED}"/etc/ssh/sshd_config
237
238 # Allow client to pass locale environment variables #367017
239 AcceptEnv LANG LC_*
240 EOF
241 cat <<-EOF >> "${ED}"/etc/ssh/ssh_config
242
243 # Send locale environment variables #367017
244 SendEnv LANG LC_*
245 EOF
246
247 # This instruction is from the HPN webpage,
248 # Used for the server logging functionality
249 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
250 keepdir /var/empty/dev
251 fi
252
253 if ! use X509 && [[ -n ${LDAP_PATCH} ]] && use ldap ; then
254 insinto /etc/openldap/schema/
255 newins openssh-lpk_openldap.schema openssh-lpk.schema
256 fi
257
258 doman contrib/ssh-copy-id.1
259 dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config
260
261 diropts -m 0700
262 dodir /etc/skel/.ssh
263
264 systemd_dounit "${FILESDIR}"/sshd.{service,socket}
265 systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service'
266 }
267
268 src_test() {
269 local t tests skipped failed passed shell
270 tests="interop-tests compat-tests"
271 skipped=""
272 shell=$(egetshell ${UID})
273 if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
274 elog "Running the full OpenSSH testsuite"
275 elog "requires a usable shell for the 'portage'"
276 elog "user, so we will run a subset only."
277 skipped="${skipped} tests"
278 else
279 tests="${tests} tests"
280 fi
281 # It will also attempt to write to the homedir .ssh
282 local sshhome=${T}/homedir
283 mkdir -p "${sshhome}"/.ssh
284 for t in ${tests} ; do
285 # Some tests read from stdin ...
286 HOMEDIR="${sshhome}" \
287 emake -k -j1 ${t} </dev/null \
288 && passed="${passed}${t} " \
289 || failed="${failed}${t} "
290 done
291 einfo "Passed tests: ${passed}"
292 ewarn "Skipped tests: ${skipped}"
293 if [[ -n ${failed} ]] ; then
294 ewarn "Failed tests: ${failed}"
295 die "Some tests failed: ${failed}"
296 else
297 einfo "Failed tests: ${failed}"
298 return 0
299 fi
300 }
301
302 pkg_preinst() {
303 enewgroup sshd 22
304 enewuser sshd 22 -1 /var/empty sshd
305 }
306
307 pkg_postinst() {
308 if has_version "<${CATEGORY}/${PN}-5.8_p1" ; then
309 elog "Starting with openssh-5.8p1, the server will default to a newer key"
310 elog "algorithm (ECDSA). You are encouraged to manually update your stored"
311 elog "keys list as servers update theirs. See ssh-keyscan(1) for more info."
312 fi
313 ewarn "Remember to merge your config files in /etc/ssh/ and then"
314 ewarn "reload sshd: '/etc/init.d/sshd reload'."
315 # This instruction is from the HPN webpage,
316 # Used for the server logging functionality
317 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
318 einfo "For the HPN server logging patch, you must ensure that"
319 einfo "your syslog application also listens at /var/empty/dev/log."
320 fi
321 elog "Note: openssh-6.7 versions no longer support USE=tcpd as upstream has"
322 elog " dropped it. Make sure to update any configs that you might have."
323 }

  ViewVC Help
Powered by ViewVC 1.1.20