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

Contents of /net-misc/openssh/openssh-6.6_p1-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download)
Sat Jan 31 18:05:34 2015 UTC (4 years, 8 months ago) by polynomial-c
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +1 -1 lines
FILE REMOVED
Removed old (and vulnerable) versions

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

  ViewVC Help
Powered by ViewVC 1.1.20