/[gentoo-x86]/net-misc/openssh/openssh-6.8_p1-r2.ebuild
Gentoo

Contents of /net-misc/openssh/openssh-6.8_p1-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (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.4: +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-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.8_p1-r2.ebuild,v 1.4 2015/03/24 07:07:13 patrick 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.8p1-r3-hpnssh14v5.tar.xz"
13 LDAP_PATCH="${PN}-lpk-6.8p1-0.3.14.patch.xz"
14 X509_VER="8.3" 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? (
27 http://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH}
28 mirror://gentoo/${P}-x509-glue.patch.xz
29 )}
30 "
31
32 LICENSE="BSD GPL-2"
33 SLOT="0"
34 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"
35 # Probably want to drop ssh1/ssl defaulting to on in a future version.
36 IUSE="bindist ${HPN_PATCH:++}hpn kerberos kernel_linux ldap ldns libedit pam +pie sctp selinux skey +ssh1 +ssl static X X509"
37 REQUIRED_USE="pie? ( !static )
38 ssh1? ( ssl )
39 static? ( !kerberos !pam )
40 X509? ( !ldap ssl )"
41
42 LIB_DEPEND="sctp? ( net-misc/lksctp-tools[static-libs(+)] )
43 selinux? ( >=sys-libs/libselinux-1.28[static-libs(+)] )
44 skey? ( >=sys-auth/skey-1.1.5-r1[static-libs(+)] )
45 libedit? ( dev-libs/libedit[static-libs(+)] )
46 ssl? (
47 >=dev-libs/openssl-0.9.6d:0[bindist=]
48 dev-libs/openssl[static-libs(+)]
49 )
50 >=sys-libs/zlib-1.2.3[static-libs(+)]"
51 RDEPEND="
52 !static? (
53 ${LIB_DEPEND//\[static-libs(+)]}
54 ldns? (
55 !bindist? ( net-libs/ldns[ecdsa,ssl] )
56 bindist? ( net-libs/ldns[-ecdsa,ssl] )
57 )
58 )
59 pam? ( virtual/pam )
60 kerberos? ( virtual/krb5 )
61 ldap? ( net-nds/openldap )"
62 DEPEND="${RDEPEND}
63 static? (
64 ${LIB_DEPEND}
65 ldns? (
66 !bindist? ( net-libs/ldns[ecdsa,ssl,static-libs(+)] )
67 bindist? ( net-libs/ldns[-ecdsa,ssl,static-libs(+)] )
68 )
69 )
70 virtual/pkgconfig
71 virtual/os-headers
72 sys-devel/autoconf"
73 RDEPEND="${RDEPEND}
74 pam? ( >=sys-auth/pambase-20081028 )
75 userland_GNU? ( virtual/shadow )
76 X? ( x11-apps/xauth )"
77
78 S=${WORKDIR}/${PARCH}
79
80 pkg_setup() {
81 # this sucks, but i'd rather have people unable to `emerge -u openssh`
82 # than not be able to log in to their server any more
83 maybe_fail() { [[ -z ${!2} ]] && echo "$1" ; }
84 local fail="
85 $(use X509 && maybe_fail X509 X509_PATCH)
86 $(use ldap && maybe_fail ldap LDAP_PATCH)
87 $(use hpn && maybe_fail hpn HPN_PATCH)
88 "
89 fail=$(echo ${fail})
90 if [[ -n ${fail} ]] ; then
91 eerror "Sorry, but this version does not yet support features"
92 eerror "that you requested: ${fail}"
93 eerror "Please mask ${PF} for now and check back later:"
94 eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask"
95 die "booooo"
96 fi
97
98 # Make sure people who are using tcp wrappers are notified of its removal. #531156
99 if grep -qs '^ *sshd *:' "${EROOT}"/etc/hosts.{allow,deny} ; then
100 eerror "Sorry, but openssh no longer supports tcp-wrappers, and it seems like"
101 eerror "you're trying to use it. Update your ${EROOT}etc/hosts.{allow,deny} please."
102 die "USE=tcpd no longer works"
103 fi
104 }
105
106 save_version() {
107 # version.h patch conflict avoidence
108 mv version.h version.h.$1
109 cp -f version.h.pristine version.h
110 }
111
112 src_prepare() {
113 sed -i \
114 -e "/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:${EPREFIX}/usr/bin/xauth:" \
115 pathnames.h || die
116 # keep this as we need it to avoid the conflict between LPK and HPN changing
117 # this file.
118 cp version.h version.h.pristine
119
120 # don't break .ssh/authorized_keys2 for fun
121 sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die
122
123 epatch "${FILESDIR}"/${PN}-6.8_p1-sshd-gssapi-multihomed.patch #378361
124 if use X509 ; then
125 pushd .. >/dev/null
126 epatch "${WORKDIR}"/${P}-x509-glue.patch
127 epatch "${FILESDIR}"/${P}-sctp-x509-glue.patch
128 popd >/dev/null
129 epatch "${WORKDIR}"/${X509_PATCH%.*}
130 epatch "${FILESDIR}"/${PN}-6.3_p1-x509-hpn14v2-glue.patch
131 save_version X509
132 fi
133 if use ldap ; then
134 epatch "${WORKDIR}"/${LDAP_PATCH%.*}
135 save_version LPK
136 fi
137 epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
138 epatch "${FILESDIR}"/${PN}-6.7_p1-openssl-ignore-status.patch
139 epatch "${FILESDIR}"/${PN}-6.8_p1-ssh-keygen-no-ssh1.patch #544078
140 # The X509 patchset fixes this independently.
141 use X509 || epatch "${FILESDIR}"/${PN}-6.8_p1-ssl-engine-configure.patch
142 epatch "${WORKDIR}"/${P}-sctp.patch
143 if use hpn ; then
144 epatch "${WORKDIR}"/${HPN_PATCH%.*.*}/*
145 save_version HPN
146 fi
147
148 tc-export PKG_CONFIG
149 local sed_args=(
150 -e "s:-lcrypto:$(${PKG_CONFIG} --libs openssl):"
151 # Disable PATH reset, trust what portage gives us #254615
152 -e 's:^PATH=/:#PATH=/:'
153 # Disable fortify flags ... our gcc does this for us
154 -e 's:-D_FORTIFY_SOURCE=2::'
155 )
156 # The -ftrapv flag ICEs on hppa #505182
157 use hppa && sed_args+=(
158 -e '/CFLAGS/s:-ftrapv:-fdisable-this-test:'
159 -e '/OSSH_CHECK_CFLAG_LINK.*-ftrapv/d'
160 )
161 sed -i "${sed_args[@]}" configure{.ac,} || die
162
163 epatch_user #473004
164
165 # Now we can build a sane merged version.h
166 (
167 sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
168 macros=()
169 for p in HPN LPK X509 ; do [ -e version.h.${p} ] && macros+=( SSH_${p} ) ; done
170 printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros}"
171 ) > version.h
172
173 eautoreconf
174 }
175
176 src_configure() {
177 addwrite /dev/ptmx
178 addpredict /etc/skey/skeykeys # skey configure code triggers this
179
180 use static && append-ldflags -static
181
182 local myconf=(
183 --with-ldflags="${LDFLAGS}"
184 --disable-strip
185 --with-pid-dir="${EPREFIX}"$(usex kernel_linux '' '/var')/run
186 --sysconfdir="${EPREFIX}"/etc/ssh
187 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/misc
188 --datadir="${EPREFIX}"/usr/share/openssh
189 --with-privsep-path="${EPREFIX}"/var/empty
190 --with-privsep-user=sshd
191 $(use_with kerberos kerberos5 "${EPREFIX}"/usr)
192 # We apply the ldap patch conditionally, so can't pass --without-ldap
193 # unconditionally else we get unknown flag warnings.
194 $(use ldap && use_with ldap)
195 $(use_with ldns)
196 $(use_with libedit)
197 $(use_with pam)
198 $(use_with pie)
199 $(use_with sctp)
200 $(use_with selinux)
201 $(use_with skey)
202 $(use_with ssh1)
203 # The X509 patch deletes this option entirely.
204 $(use X509 || use_with ssl openssl)
205 $(use_with ssl md5-passwords)
206 $(use_with ssl ssl-engine)
207 )
208
209 # Special settings for Gentoo/FreeBSD 9.0 or later (see bug #391011)
210 if use elibc_FreeBSD && version_is_at_least 9.0 "$(uname -r|sed 's/\(.\..\).*/\1/')" ; then
211 myconf+=( --disable-utmp --disable-wtmp --disable-wtmpx )
212 append-ldflags -lutil
213 fi
214
215 econf "${myconf[@]}"
216 }
217
218 src_install() {
219 emake install-nokeys DESTDIR="${D}"
220 fperms 600 /etc/ssh/sshd_config
221 dobin contrib/ssh-copy-id
222 newinitd "${FILESDIR}"/sshd.rc6.4 sshd
223 newconfd "${FILESDIR}"/sshd.confd sshd
224 keepdir /var/empty
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
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