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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Wed Aug 5 08:21:17 2015 UTC (4 years, 2 months ago) by vapier
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +4 -1 lines
Use the rlimit sandbox for x32 ABI until the seccomp one is fixed #553748 by Kyle Sanderson.

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

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.9_p1-r2.ebuild,v 1.11 2015/07/28 01:08:12 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.9p1-r1-hpnssh14v5.tar.xz"
13 LDAP_PATCH="${PN}-lpk-6.8p1-0.3.14.patch.xz"
14 X509_VER="8.4" X509_PATCH="${PN}-6.9p1+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/${PN}-6.8_p1-sctp.patch.xz
20 ${HPN_PATCH:+hpn? (
21 mirror://gentoo/${HPN_PATCH}
22 http://dev.gentoo.org/~polynomial-c/${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 # Probably want to drop ssl defaulting to on in a future version.
33 IUSE="bindist debug ${HPN_PATCH:++}hpn kerberos kernel_linux ldap ldns libedit pam +pie sctp selinux skey ssh1 +ssl static X X509"
34 REQUIRED_USE="ldns? ( ssl )
35 pie? ( !static )
36 ssh1? ( ssl )
37 static? ( !kerberos !pam )
38 X509? ( !ldap ssl )"
39
40 LIB_DEPEND="
41 ldns? (
42 net-libs/ldns[static-libs(+)]
43 !bindist? ( net-libs/ldns[ecdsa,ssl] )
44 bindist? ( net-libs/ldns[-ecdsa,ssl] )
45 )
46 libedit? ( dev-libs/libedit[static-libs(+)] )
47 sctp? ( net-misc/lksctp-tools[static-libs(+)] )
48 selinux? ( >=sys-libs/libselinux-1.28[static-libs(+)] )
49 skey? ( >=sys-auth/skey-1.1.5-r1[static-libs(+)] )
50 ssl? (
51 >=dev-libs/openssl-0.9.6d:0[bindist=]
52 dev-libs/openssl[static-libs(+)]
53 )
54 >=sys-libs/zlib-1.2.3[static-libs(+)]"
55 RDEPEND="
56 !static? ( ${LIB_DEPEND//\[static-libs(+)]} )
57 pam? ( virtual/pam )
58 kerberos? ( virtual/krb5 )
59 ldap? ( net-nds/openldap )"
60 DEPEND="${RDEPEND}
61 static? ( ${LIB_DEPEND} )
62 virtual/pkgconfig
63 virtual/os-headers
64 sys-devel/autoconf"
65 RDEPEND="${RDEPEND}
66 pam? ( >=sys-auth/pambase-20081028 )
67 userland_GNU? ( virtual/shadow )
68 X? ( x11-apps/xauth )"
69
70 S=${WORKDIR}/${PARCH}
71
72 pkg_setup() {
73 # this sucks, but i'd rather have people unable to `emerge -u openssh`
74 # than not be able to log in to their server any more
75 maybe_fail() { [[ -z ${!2} ]] && echo "$1" ; }
76 local fail="
77 $(use X509 && maybe_fail X509 X509_PATCH)
78 $(use ldap && maybe_fail ldap LDAP_PATCH)
79 $(use hpn && maybe_fail hpn HPN_PATCH)
80 "
81 fail=$(echo ${fail})
82 if [[ -n ${fail} ]] ; then
83 eerror "Sorry, but this version does not yet support features"
84 eerror "that you requested: ${fail}"
85 eerror "Please mask ${PF} for now and check back later:"
86 eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask"
87 die "booooo"
88 fi
89
90 # Make sure people who are using tcp wrappers are notified of its removal. #531156
91 if grep -qs '^ *sshd *:' "${EROOT}"/etc/hosts.{allow,deny} ; then
92 eerror "Sorry, but openssh no longer supports tcp-wrappers, and it seems like"
93 eerror "you're trying to use it. Update your ${EROOT}etc/hosts.{allow,deny} please."
94 die "USE=tcpd no longer works"
95 fi
96 }
97
98 save_version() {
99 # version.h patch conflict avoidence
100 mv version.h version.h.$1
101 cp -f version.h.pristine version.h
102 }
103
104 src_prepare() {
105 sed -i \
106 -e "/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:${EPREFIX}/usr/bin/xauth:" \
107 pathnames.h || die
108 # keep this as we need it to avoid the conflict between LPK and HPN changing
109 # this file.
110 cp version.h version.h.pristine
111
112 # don't break .ssh/authorized_keys2 for fun
113 sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die
114
115 if use X509 ; then
116 pushd .. >/dev/null
117 #epatch "${WORKDIR}"/${PN}-6.8_p1-x509-${X509_VER}-glue.patch
118 epatch "${FILESDIR}"/${PN}-6.8_p1-sctp-x509-glue.patch
119 popd >/dev/null
120 epatch "${WORKDIR}"/${X509_PATCH%.*}
121 epatch "${FILESDIR}"/${PN}-6.3_p1-x509-hpn14v2-glue.patch
122 epatch "${FILESDIR}"/${PN}-6.9_p1-x509-warnings.patch
123 save_version X509
124 fi
125 if use ldap ; then
126 epatch "${WORKDIR}"/${LDAP_PATCH%.*}
127 save_version LPK
128 fi
129 epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
130 epatch "${FILESDIR}"/${PN}-6.7_p1-openssl-ignore-status.patch
131 # The X509 patchset fixes this independently.
132 use X509 || epatch "${FILESDIR}"/${PN}-6.8_p1-ssl-engine-configure.patch
133 epatch "${WORKDIR}"/${PN}-6.8_p1-sctp.patch
134 if use hpn ; then
135 EPATCH_FORCE="yes" EPATCH_SUFFIX="patch" \
136 EPATCH_MULTI_MSG="Applying HPN patchset ..." \
137 epatch "${WORKDIR}"/${HPN_PATCH%.*.*}
138 save_version HPN
139 fi
140
141 tc-export PKG_CONFIG
142 local sed_args=(
143 -e "s:-lcrypto:$(${PKG_CONFIG} --libs openssl):"
144 # Disable PATH reset, trust what portage gives us #254615
145 -e 's:^PATH=/:#PATH=/:'
146 # Disable fortify flags ... our gcc does this for us
147 -e 's:-D_FORTIFY_SOURCE=2::'
148 )
149 # The -ftrapv flag ICEs on hppa #505182
150 use hppa && sed_args+=(
151 -e '/CFLAGS/s:-ftrapv:-fdisable-this-test:'
152 -e '/OSSH_CHECK_CFLAG_LINK.*-ftrapv/d'
153 )
154 sed -i "${sed_args[@]}" configure{.ac,} || die
155
156 epatch_user #473004
157
158 # Now we can build a sane merged version.h
159 (
160 sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
161 macros=()
162 for p in HPN LPK X509 ; do [ -e version.h.${p} ] && macros+=( SSH_${p} ) ; done
163 printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros}"
164 ) > version.h
165
166 eautoreconf
167 }
168
169 src_configure() {
170 addwrite /dev/ptmx
171 addpredict /etc/skey/skeykeys # skey configure code triggers this
172
173 use debug && append-cppflags -DSANDBOX_SECCOMP_FILTER_DEBUG
174 use static && append-ldflags -static
175
176 local myconf=(
177 --with-ldflags="${LDFLAGS}"
178 --disable-strip
179 --with-pid-dir="${EPREFIX}"$(usex kernel_linux '' '/var')/run
180 --sysconfdir="${EPREFIX}"/etc/ssh
181 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/misc
182 --datadir="${EPREFIX}"/usr/share/openssh
183 --with-privsep-path="${EPREFIX}"/var/empty
184 --with-privsep-user=sshd
185 $(use_with kerberos kerberos5 "${EPREFIX}"/usr)
186 # We apply the ldap patch conditionally, so can't pass --without-ldap
187 # unconditionally else we get unknown flag warnings.
188 $(use ldap && use_with ldap)
189 $(use_with ldns)
190 $(use_with libedit)
191 $(use_with pam)
192 $(use_with pie)
193 $(use_with sctp)
194 $(use_with selinux)
195 $(use_with skey)
196 $(use_with ssh1)
197 # The X509 patch deletes this option entirely.
198 $(use X509 || use_with ssl openssl)
199 $(use_with ssl md5-passwords)
200 $(use_with ssl ssl-engine)
201 )
202
203 # The seccomp sandbox is broken on x32, so use the older method for now. #553748
204 use amd64 && [[ ${ABI} == "x32" ]] && myconf+=( --with-sandbox=rlimit )
205
206 # Special settings for Gentoo/FreeBSD 9.0 or later (see bug #391011)
207 if use elibc_FreeBSD && version_is_at_least 9.0 "$(uname -r|sed 's/\(.\..\).*/\1/')" ; then
208 myconf+=( --disable-utmp --disable-wtmp --disable-wtmpx )
209 append-ldflags -lutil
210 fi
211
212 econf "${myconf[@]}"
213 }
214
215 src_install() {
216 emake install-nokeys DESTDIR="${D}"
217 fperms 600 /etc/ssh/sshd_config
218 dobin contrib/ssh-copy-id
219 newinitd "${FILESDIR}"/sshd.rc6.4 sshd
220 newconfd "${FILESDIR}"/sshd.confd sshd
221 keepdir /var/empty
222
223 newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
224 if use pam ; then
225 sed -i \
226 -e "/^#UsePAM /s:.*:UsePAM yes:" \
227 -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
228 -e "/^#PrintMotd /s:.*:PrintMotd no:" \
229 -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
230 "${ED}"/etc/ssh/sshd_config || die
231 fi
232
233 # Gentoo tweaks to default config files
234 cat <<-EOF >> "${ED}"/etc/ssh/sshd_config
235
236 # Allow client to pass locale environment variables #367017
237 AcceptEnv LANG LC_*
238 EOF
239 cat <<-EOF >> "${ED}"/etc/ssh/ssh_config
240
241 # Send locale environment variables #367017
242 SendEnv LANG LC_*
243 EOF
244
245 if ! use X509 && [[ -n ${LDAP_PATCH} ]] && use ldap ; then
246 insinto /etc/openldap/schema/
247 newins openssh-lpk_openldap.schema openssh-lpk.schema
248 fi
249
250 doman contrib/ssh-copy-id.1
251 dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config
252
253 diropts -m 0700
254 dodir /etc/skel/.ssh
255
256 systemd_dounit "${FILESDIR}"/sshd.{service,socket}
257 systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service'
258 }
259
260 src_test() {
261 local t tests skipped failed passed shell
262 tests="interop-tests compat-tests"
263 skipped=""
264 shell=$(egetshell ${UID})
265 if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
266 elog "Running the full OpenSSH testsuite"
267 elog "requires a usable shell for the 'portage'"
268 elog "user, so we will run a subset only."
269 skipped="${skipped} tests"
270 else
271 tests="${tests} tests"
272 fi
273 # It will also attempt to write to the homedir .ssh
274 local sshhome=${T}/homedir
275 mkdir -p "${sshhome}"/.ssh
276 for t in ${tests} ; do
277 # Some tests read from stdin ...
278 HOMEDIR="${sshhome}" \
279 emake -k -j1 ${t} </dev/null \
280 && passed="${passed}${t} " \
281 || failed="${failed}${t} "
282 done
283 einfo "Passed tests: ${passed}"
284 ewarn "Skipped tests: ${skipped}"
285 if [[ -n ${failed} ]] ; then
286 ewarn "Failed tests: ${failed}"
287 die "Some tests failed: ${failed}"
288 else
289 einfo "Failed tests: ${failed}"
290 return 0
291 fi
292 }
293
294 pkg_preinst() {
295 enewgroup sshd 22
296 enewuser sshd 22 -1 /var/empty sshd
297 }
298
299 pkg_postinst() {
300 if has_version "<${CATEGORY}/${PN}-5.8_p1" ; then
301 elog "Starting with openssh-5.8p1, the server will default to a newer key"
302 elog "algorithm (ECDSA). You are encouraged to manually update your stored"
303 elog "keys list as servers update theirs. See ssh-keyscan(1) for more info."
304 fi
305 if has_version "<${CATEGORY}/${PN}-6.9_p1" ; then
306 elog "Starting with openssh-6.9p1, ssh1 support is disabled by default."
307 fi
308 ewarn "Remember to merge your config files in /etc/ssh/ and then"
309 ewarn "reload sshd: '/etc/init.d/sshd reload'."
310 elog "Note: openssh-6.7 versions no longer support USE=tcpd as upstream has"
311 elog " dropped it. Make sure to update any configs that you might have."
312 }

  ViewVC Help
Powered by ViewVC 1.1.20