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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Jul 1 22:53:26 2015 UTC (4 years, 3 months ago) by chutzpah
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Revision bump, add the updated X509 patch, drop 5.9_p1-r0 ebuild.

(Portage version: 2.2.20/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.9_p1.ebuild,v 1.1 2015/07/01 20:55:01 polynomial-c 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-hpnssh14v5.tar.xz"
13 LDAP_PATCH="${PN}-lpk-6.8p1-0.3.14.patch.xz"
14 #X509_VER="8.3.1" X509_PATCH="${PN}-6.8p1+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? (
27 http://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH}
28 mirror://gentoo/${PN}-6.8_p1-x509-${X509_VER}-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 ssl defaulting to on in a future version.
36 IUSE="bindist debug ${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 if use X509 ; then
124 pushd .. >/dev/null
125 epatch "${WORKDIR}"/${PN}-6.8_p1-x509-${X509_VER}-glue.patch
126 epatch "${FILESDIR}"/${PN}-6.8_p1-sctp-x509-glue.patch
127 popd >/dev/null
128 epatch "${WORKDIR}"/${X509_PATCH%.*}
129 epatch "${FILESDIR}"/${PN}-6.3_p1-x509-hpn14v2-glue.patch
130 save_version X509
131 fi
132 if use ldap ; then
133 epatch "${WORKDIR}"/${LDAP_PATCH%.*}
134 save_version LPK
135 fi
136 epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
137 epatch "${FILESDIR}"/${PN}-6.7_p1-openssl-ignore-status.patch
138 # The X509 patchset fixes this independently.
139 use X509 || epatch "${FILESDIR}"/${PN}-6.8_p1-ssl-engine-configure.patch
140 epatch "${WORKDIR}"/${PN}-6.8_p1-sctp.patch
141 if use hpn ; then
142 EPATCH_FORCE="yes" EPATCH_SUFFIX="patch" \
143 EPATCH_MULTI_MSG="Applying HPN patchset ..." \
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 debug && append-cppflags -DSANDBOX_SECCOMP_FILTER_DEBUG
181 use static && append-ldflags -static
182
183 local myconf=(
184 --with-ldflags="${LDFLAGS}"
185 --disable-strip
186 --with-pid-dir="${EPREFIX}"$(usex kernel_linux '' '/var')/run
187 --sysconfdir="${EPREFIX}"/etc/ssh
188 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/misc
189 --datadir="${EPREFIX}"/usr/share/openssh
190 --with-privsep-path="${EPREFIX}"/var/empty
191 --with-privsep-user=sshd
192 $(use_with kerberos kerberos5 "${EPREFIX}"/usr)
193 # We apply the ldap patch conditionally, so can't pass --without-ldap
194 # unconditionally else we get unknown flag warnings.
195 $(use ldap && use_with ldap)
196 $(use_with ldns)
197 $(use_with libedit)
198 $(use_with pam)
199 $(use_with pie)
200 $(use_with sctp)
201 $(use_with selinux)
202 $(use_with skey)
203 $(use_with ssh1)
204 # The X509 patch deletes this option entirely.
205 $(use X509 || use_with ssl openssl)
206 $(use_with ssl md5-passwords)
207 $(use_with ssl ssl-engine)
208 )
209
210 # Special settings for Gentoo/FreeBSD 9.0 or later (see bug #391011)
211 if use elibc_FreeBSD && version_is_at_least 9.0 "$(uname -r|sed 's/\(.\..\).*/\1/')" ; then
212 myconf+=( --disable-utmp --disable-wtmp --disable-wtmpx )
213 append-ldflags -lutil
214 fi
215
216 econf "${myconf[@]}"
217 }
218
219 src_install() {
220 emake install-nokeys DESTDIR="${D}"
221 fperms 600 /etc/ssh/sshd_config
222 dobin contrib/ssh-copy-id
223 newinitd "${FILESDIR}"/sshd.rc6.4 sshd
224 newconfd "${FILESDIR}"/sshd.confd sshd
225 keepdir /var/empty
226
227 newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
228 if use pam ; then
229 sed -i \
230 -e "/^#UsePAM /s:.*:UsePAM yes:" \
231 -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
232 -e "/^#PrintMotd /s:.*:PrintMotd no:" \
233 -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
234 "${ED}"/etc/ssh/sshd_config || die
235 fi
236
237 # Gentoo tweaks to default config files
238 cat <<-EOF >> "${ED}"/etc/ssh/sshd_config
239
240 # Allow client to pass locale environment variables #367017
241 AcceptEnv LANG LC_*
242 EOF
243 cat <<-EOF >> "${ED}"/etc/ssh/ssh_config
244
245 # Send locale environment variables #367017
246 SendEnv LANG LC_*
247 EOF
248
249 # This instruction is from the HPN webpage,
250 # Used for the server logging functionality
251 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
252 keepdir /var/empty/dev
253 fi
254
255 if ! use X509 && [[ -n ${LDAP_PATCH} ]] && use ldap ; then
256 insinto /etc/openldap/schema/
257 newins openssh-lpk_openldap.schema openssh-lpk.schema
258 fi
259
260 doman contrib/ssh-copy-id.1
261 dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config
262
263 diropts -m 0700
264 dodir /etc/skel/.ssh
265
266 systemd_dounit "${FILESDIR}"/sshd.{service,socket}
267 systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service'
268 }
269
270 src_test() {
271 local t tests skipped failed passed shell
272 tests="interop-tests compat-tests"
273 skipped=""
274 shell=$(egetshell ${UID})
275 if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
276 elog "Running the full OpenSSH testsuite"
277 elog "requires a usable shell for the 'portage'"
278 elog "user, so we will run a subset only."
279 skipped="${skipped} tests"
280 else
281 tests="${tests} tests"
282 fi
283 # It will also attempt to write to the homedir .ssh
284 local sshhome=${T}/homedir
285 mkdir -p "${sshhome}"/.ssh
286 for t in ${tests} ; do
287 # Some tests read from stdin ...
288 HOMEDIR="${sshhome}" \
289 emake -k -j1 ${t} </dev/null \
290 && passed="${passed}${t} " \
291 || failed="${failed}${t} "
292 done
293 einfo "Passed tests: ${passed}"
294 ewarn "Skipped tests: ${skipped}"
295 if [[ -n ${failed} ]] ; then
296 ewarn "Failed tests: ${failed}"
297 die "Some tests failed: ${failed}"
298 else
299 einfo "Failed tests: ${failed}"
300 return 0
301 fi
302 }
303
304 pkg_preinst() {
305 enewgroup sshd 22
306 enewuser sshd 22 -1 /var/empty sshd
307 }
308
309 pkg_postinst() {
310 if has_version "<${CATEGORY}/${PN}-5.8_p1" ; then
311 elog "Starting with openssh-5.8p1, the server will default to a newer key"
312 elog "algorithm (ECDSA). You are encouraged to manually update your stored"
313 elog "keys list as servers update theirs. See ssh-keyscan(1) for more info."
314 fi
315 ewarn "Remember to merge your config files in /etc/ssh/ and then"
316 ewarn "reload sshd: '/etc/init.d/sshd reload'."
317 # This instruction is from the HPN webpage,
318 # Used for the server logging functionality
319 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
320 einfo "For the HPN server logging patch, you must ensure that"
321 einfo "your syslog application also listens at /var/empty/dev/log."
322 fi
323 elog "Note: openssh-6.7 versions no longer support USE=tcpd as upstream has"
324 elog " dropped it. Make sure to update any configs that you might have."
325 }

  ViewVC Help
Powered by ViewVC 1.1.20